Orocos Real-Time Toolkit  2.9.0
parse_exception.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Jul 15 11:21:06 CEST 2004 parse_exception.cxx
3 
4  parse_exception.cxx - description
5  -------------------
6  begin : Thu July 15 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens at mech.kuleuven.ac.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 #ifdef ORO_PRAGMA_INTERFACE
39 #pragma implementation
40 #endif
41 #include "parse_exception.hpp"
42 
43 #include <sstream>
44 
45 namespace RTT
46 {
47  using namespace detail;
48  // implemented here to avoid having to include sstream in the header
50  {
51  std::ostringstream stream;
52  stream << "Wrong number of arguments in call of function \""
53  << mcomponentname << "." << mmethodname
54  << "\": expected " << mexpectednumber
55  << ", received " << mreceivednumber << ".";
56  return stream.str();
57  }
58 
59  // implemented here to avoid having to include sstream in the header
61  {
62  std::ostringstream stream;
63  stream << "Wrong type of argument provided for argument number "
64  << margnumber << " in call of function \""
65  << mcomponentname << "." << mmethodname
66  << "\". Expected type "<<mexpected<<", got type "<< mreceived <<".";
67  return stream.str();
68  }
69 
71  {
72  delete mpe;
73  }
74 
76  : mpe( rhs.mpe->copy() ), mfile( rhs.mfile ), mline( rhs.mline ),
77  mcolumn( rhs.mcolumn )
78  {
79  }
80 
81  const std::string file_parse_exception::what() const
82  {
83  std::ostringstream stream;
84  stream << "Parse error at line "
85  << mline << ": " << mpe->what();
86  return stream.str();
87  }
88 
90  std::vector<DataSourceBase::shared_ptr> args)
91  : margsig( "No such constructor found: " + tname + "(")
92  {
93 
94  for(std::vector<DataSourceBase::shared_ptr>::iterator it = args.begin();
95  it != args.end();
96  ) {
97  margsig += (*it)->getType();
98  if ( ++it != args.end() )
99  margsig += ", ";
100  }
101  margsig += ")";
102  }
103 }
const std::string what() const
virtual const std::string what() const =0
parse_exception_no_such_constructor(const std::string &tname, std::vector< base::DataSourceBase::shared_ptr > args)
This is an exception class that keeps a parse_exception pointer along with the location in the file a...
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
parse_exception_wrong_number_of_arguments * copy() const
file_parse_exception(const file_parse_exception &rhs)