All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Parsers.icpp
Go to the documentation of this file.
1 // $Id: Parsers.icpp,v 1.5 2008/10/28 14:02:18 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIKERNEL_PARSERS_ICPP
4 #define GAUDIKERNEL_PARSERS_ICPP 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 // STD&STL
9 // ============================================================================
10 #include <vector>
11 #include <map>
12 #include <string>
13 // ============================================================================
14 // Boost.Bind
15 // ============================================================================
16 #include "boost/bind.hpp"
17 // ============================================================================
18 // Boost.Spirit, Boost.Spirit.Phoenix
19 // ============================================================================
20 #include <boost/version.hpp>
21 #if BOOST_VERSION >= 103800
22 // FIXME: Move to the new boost::spirit::classic namespace
23 #if !defined(BOOST_SPIRIT_USE_OLD_NAMESPACE)
24 #define BOOST_SPIRIT_USE_OLD_NAMESPACE
25 #endif
26 #include <boost/spirit/include/classic.hpp>
27 #include <boost/spirit/include/phoenix1.hpp>
28 #else
29 #include <boost/spirit.hpp>
30 #include <boost/spirit/phoenix.hpp>
31 #endif
32 // ============================================================================
33 // GaudiKernel
34 // ============================================================================
35 #include "GaudiKernel/Parsers.h"
36 #include "GaudiKernel/Grammars.h"
37 // ============================================================================
55 // ============================================================================
56 namespace Gaudi
57 {
58  namespace Parsers
59  {
60  using namespace std;
61  using namespace boost::spirit ;
62 
64  typedef boost::spirit::position_iterator<string::const_iterator> IteratorT;
65 
67  inline IteratorT createIterator( const std::string& input)
68  { return IteratorT ( input.begin(), input.end() ) ; }
69 
70  // ========================================================================
83  // ========================================================================
84  template<typename IntegerT>
86  (IntegerT& result,const string& input)
87  {
89  return parse
90  ( createIterator(input),
91  IteratorT(),
92  g[var(result)=arg1]).full;
93  }
94  // ========================================================================
110  // ========================================================================
111  template<typename IntegerT>
113  ( std::vector<IntegerT>& result,const string& input)
114  {
116  return parse
117  ( createIterator(input),
118  IteratorT(),
119  g[var(result)=arg1],
120  SkipperGrammar()).full;
121  }
122  // ========================================================================
135  // ========================================================================
136  template<typename CharT>
137  inline StatusCode parse_char
138  ( CharT& result , const string& input )
139  {
141  return parse
142  ( createIterator(input),
143  IteratorT(),
144  g[var(result)=arg1]).full;
145  }
146  // ========================================================================
162  // ========================================================================
163  template<typename CharT>
165  (std::vector<CharT>& result,const string& input)
166  {
168  return parse
169  ( createIterator(input),
170  IteratorT(),
171  g[var(result)=arg1],
172  SkipperGrammar()).full;
173  }
174  // ========================================================================
187  template<typename RealT>
188  inline StatusCode parse_real
189  ( RealT& result , const string& input)
190  {
192  return parse
193  ( createIterator(input),
194  IteratorT(),
195  g[var(result)=arg1],
196  SkipperGrammar()).full;
197  }
198  // ========================================================================
214  // ========================================================================
215  template<typename RealT>
217  ( std::vector<RealT>& result,const string& input)
218  {
220  return parse
221  ( createIterator(input),
222  IteratorT(),
223  g[var(result)=arg1],
224  SkipperGrammar()).full;
225  }
226  } // end of namespace Gaudi::Parsers
227 } // end of namespace Gaudi
228 // ============================================================================
229 #endif
230 // ============================================================================
231 // The END
232 // ============================================================================
233 
234 
The valid represenation of char values are:
Definition: Grammars.h:137
IteratorT createIterator(const std::string &input)
create the position iterator from the input
Definition: Parsers.icpp:67
The valid represenation of real values are:
Definition: Grammar.h:111
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
StatusCode parse_real_vector(std::vector< RealT > &result, const string &input)
helper function to "merge" the implementation of all parsers for vector of 'char-like' quantities int...
Definition: Parsers.icpp:217
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
StatusCode parse_integer(IntegerT &result, const string &input)
helper function to "merge" the implementation of all parsers for integer-like quantities into one tem...
Definition: Parsers.icpp:86
boost::spirit::position_iterator< string::const_iterator > IteratorT
the actual type of position iterator
Definition: Parsers.icpp:64
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Collection of grammars for property types.
StatusCode parse_real(RealT &result, const string &input)
helper function to "merge" the implementation of all parsers for "float-like" quantities into one tem...
Definition: Parsers.icpp:189
The valid representation of integers values are:
Definition: Grammars.h:174
StatusCode parse_integer_vector(std::vector< IntegerT > &result, const string &input)
helper function to "merge" the implementation of all parsers for vector of integer-like quantities in...
Definition: Parsers.icpp:113
The valid represenation of vector are:
Definition: Grammars.h:424
Skipping spaces and comments.
Definition: Grammar.h:45
StatusCode parse_char(CharT &result, const string &input)
helper function to "merge" the implementation of all parsers for "char-like" quantities into one temp...
Definition: Parsers.icpp:138
std
AIDA -> ROTO converter.
Definition: GaudiAlgs.py:73
dictionary g
Definition: gaudirun.py:364
StatusCode parse_char_vector(std::vector< CharT > &result, const string &input)
helper function to "merge" the implementation of all parsers for vector of 'char-like' quantities int...
Definition: Parsers.icpp:165
This is a number of static methods for bootstrapping the Gaudi framework.
Definition: Bootstrap.h:15