The Gaudi Framework  v29r0 (ff2e7097)
Interpolation.cpp
Go to the documentation of this file.
3 #include <cassert>
4 #include <iomanip>
5 
6 namespace
7 {
8  const char* table[] = {"Linear", "Polynomial", "Cspline", "Cspline_Periodic", "Akima", "Akima_Periodic"};
9 }
10 
11 using namespace GaudiMath::Interpolation;
12 
13 namespace Gaudi
14 {
15  namespace Parsers
16  {
17 
18  template <typename Iterator, typename Skipper>
19  struct InterpolGrammar : qi::grammar<Iterator, GaudiMath::Interpolation::Type(), Skipper> {
21  InterpolGrammar() : InterpolGrammar::base_type( literal )
22  {
23  literal = ( qi::lit( table[Linear] ) )[qi::_val = Linear] |
24  ( qi::lit( table[Polynomial] ) )[qi::_val = Polynomial] |
25  ( qi::lit( table[Cspline] ) )[qi::_val = Cspline] |
26  ( qi::lit( table[Cspline_Periodic] ) )[qi::_val = Cspline_Periodic] |
27  ( qi::lit( table[Akima] ) )[qi::_val = Akima] |
28  ( qi::lit( table[Akima_Periodic] ) )[qi::_val = Akima_Periodic];
29  }
30  qi::rule<Iterator, ResultT(), Skipper> literal;
31  };
33  }
34 }
35 
36 namespace GaudiMath
37 {
38  namespace Interpolation
39  {
40 
41  StatusCode parse( Type& t, const std::string& in ) { return Gaudi::Parsers::parse_( t, in ); }
43  {
44  assert( 0 <= t && t <= Type::Akima_Periodic );
45  return table[t];
46  }
47  std::ostream& toStream( const Type& t, std::ostream& os ) { return os << std::quoted( toString( t ), '\'' ); }
48  }
49 }
StatusCode parse_(ResultT &result, const std::string &input)
qi::rule< Iterator, ResultT(), Skipper > literal
STL class.
std::ostream & toStream(const Type &, std::ostream &)
StatusCode parse(Type &, const std::string &)
GaudiMath::Interpolation::Type ResultT
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
GaudiMath.h GaudiMath/GaudiMath.h.
Definition: Adapters.h:13
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1
std::string toString(const Type &)
#define REGISTER_GRAMMAR(ResultType, GrammarName)
Definition: GrammarsV2.h:71