Orocos Real-Time Toolkit  2.9.0
ValueParser.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 19 14:11:26 CET 2004 ValueParser.hpp
3 
4  ValueParser.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 VALUEPARSER_HPP
39 #define VALUEPARSER_HPP
40 
41 #include "parser-types.hpp"
42 #include "CommonParser.hpp"
43 #include "PeerParser.hpp"
44 #include "PropertyParser.hpp"
45 #include "../ConfigurationInterface.hpp"
46 
47 #include <memory>
48 #include <map>
49 
50 namespace RTT
51 {
52  namespace scripting {
59  {
60  rule_t constant, const_float, const_double, const_int, const_uint, const_llong, const_ullong, const_bool, named_constant,
61  const_string, const_char, const_hex;
62  CommonParser& commonparser;
63  PeerParser peerparser;
64  PropertyParser propparser;
65 
66  // a auto_ptr used only to make sure we don't forget to delete
67  // the TaskVariableBase it holds.. Here we store a pointer to
68  // the TaskVariableBase for a temporary variable we've just
69  // parsed. If we parse a non-temporary, then we don't need to
70  // delete it, as it remains in the values map, however a
71  // constant only gets stored temporarily in ret, so this
72  // variable makes sure it gets deleted.
73  //std::auto_ptr<base::AttributeBase> deleter;
74  // the internal::DataSource we've just parsed.. we only store it and
75  // assume that the ProgramParser will do something useful with
76  // it. We don't ever own it, and don't delete it, or set it to
77  // 0..
79  // contains the string constant we're parsing ( it has to be
80  // parsed char-by-char, because of the way c_escape_ch_p works
81  // )..
82  std::string mcurstring;
83 
84  void seennamedconstant( iter_t begin, iter_t end );
85  void seenboolconstant( iter_t begin, iter_t end );
86  void seenintconstant( int c );
87  void seenhexconstant( unsigned int c );
88  void seenuintconstant( unsigned int c ); // RobWork uint -> unsigned int
89  void seenllongconstant( long long c );
90  void seenullongconstant( unsigned long long c );
91  void seencharconstant( iter_t c );
92  void seenfloatconstant( double c );
93  void seendoubleconstant( double c );
94  void push_str_char( char c );
95  void seenstring();
96  void seennull();
97  void seenpeer();
98 
99  public:
101 
102  ~ValueParser();
106  void clear();
107 
108  rule_t& parser();
109 
111  {
112  return ret;
113  }
114  };
115 }}
116 
117 #endif
ValueParser(TaskContext *tc, CommonParser &cp)
Definition: ValueParser.cpp:48
void clear()
Clears this parser, not the repository where it stores its results.
This class contains some very common parser definitions.
A class for parsing const values.
Definition: ValueParser.hpp:58
Get the peer and object from an invocation path like a.b.c.d() .
Definition: PeerParser.hpp:58
rule< scanner_t > rule_t
Get the property and bag from an invocation path like bag.subbag.prop .
The TaskContext is the C++ representation of an Orocos component.
Definition: TaskContext.hpp:93
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
our_pos_iter_t iter_t
const base::DataSourceBase::shared_ptr lastParsed() const