Orocos Real-Time Toolkit  2.9.0
ArgumentsParser.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 19 14:11:26 CET 2004 ArgumentsParser.hpp
3 
4  ArgumentsParser.hpp - description
5  -------------------
6  begin : Mon January 19 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens@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 #ifndef ARGUMENTSPARSER_HPP
39 #define ARGUMENTSPARSER_HPP
40 
41 #include "parser-types.hpp"
42 
43 #include "../PropertyBag.hpp"
44 #include "CommonParser.hpp"
45 #include "../TaskContext.hpp"
46 
47 #ifdef ORO_PRAGMA_INTERFACE
48 #pragma interface
49 #endif
50 
51 namespace RTT { namespace scripting
52 {
53 
54 
55 
67  {
68  // the arguments we have already parsed.
69  std::vector<base::DataSourceBase::shared_ptr> margs;
70  bool mparsed;
71 
72  rule_t arguments, argument;
73 
74  ExpressionParser& expressionparser;
75 
76  void seen_arg();
77  void seenarguments();
78 
79  std::string mobject;
80  std::string mmethod;
81  TaskContext* _peer;
82  Service::shared_ptr mtobject;
83  public:
90  const std::string& object, const std::string& method );
91 
93 
95  {
96  return _peer;
97  }
98 
100  {
101  return mtobject;
102  }
103 
105  {
106  return arguments;
107  }
108 
112  std::vector<base::DataSourceBase::shared_ptr> result()
113  {
114  return margs;
115  }
121  bool parsed() const
122  {
123  return mparsed;
124  }
125 
126  std::string objectname()
127  {
128  return mobject;
129  }
130  std::string methodname()
131  {
132  return mmethod;
133  }
134  };
135 }}
136 
137 #endif
std::vector< base::DataSourceBase::shared_ptr > result()
Get the parsed internal::DataSource&#39;s.
ArgumentsParser(ExpressionParser &p, TaskContext *peer, Service::shared_ptr tobject, const std::string &object, const std::string &method)
Construct a new ArgumentsParser.
This is a parser that you construct to parse a set of arguments.
boost::shared_ptr< Service > shared_ptr
Definition: Service.hpp:101
How we parse: this parser works like a stack-based RPN calculator.
rule< scanner_t > rule_t
bool parsed() const
Some syntaxes allow an argument list to be left out, and then this variable is useful to find out whe...
The TaskContext is the C++ representation of an Orocos component.
Definition: TaskContext.hpp:93
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52