| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Interpolation.cpp
Go to the documentation of this file.
1 #include "GaudiMath/Interpolation.h"
2 #include "GaudiKernel/ParsersFactory.h"
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> {
20 typedef GaudiMath::Interpolation::Type ResultT;
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 };
32 REGISTER_GRAMMAR( GaudiMath::Interpolation::Type, InterpolGrammar );
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 ); }
42 std::string toString( const Type& t )
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 }
Gaudi::Parsers::parse_
StatusCode parse_(ResultT &result, const std::string &input)
Definition: ParsersFactory.h:33
GaudiMath::Interpolation::Akima
Definition: Interpolation.h:20
Gaudi::Parsers::InterpolGrammar::literal
qi::rule< Iterator, ResultT(), Skipper > literal
Definition: Interpolation.cpp:30
GaudiMath::Interpolation::Polynomial
Definition: Interpolation.h:17
ParsersFactory.h
std::string
STL class.
GaudiMath::Interpolation::toStream
std::ostream & toStream(const Type &, std::ostream &)
Definition: Interpolation.cpp:47
GaudiMath::Interpolation::parse
StatusCode parse(Type &, const std::string &)
Definition: Interpolation.cpp:41
Gaudi::Parsers::InterpolGrammar::InterpolGrammar
InterpolGrammar()
Definition: Interpolation.cpp:21
Gaudi::Parsers::InterpolGrammar::ResultT
GaudiMath::Interpolation::Type ResultT
Definition: Interpolation.cpp:20
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
GaudiMath::Interpolation::Cspline
Definition: Interpolation.h:18
GaudiMath::Interpolation
Definition: Interpolation.h:13
Interpolation.h
GaudiMath::Interpolation::Type
Type
Definition: Interpolation.h:15
GaudiMath
GaudiMath.h GaudiMath/GaudiMath.h.
Definition: Adapters.h:13
GaudiMath::Interpolation::Akima_Periodic
Definition: Interpolation.h:21
GaudiMath::Interpolation::Cspline_Periodic
Definition: Interpolation.h:19
GaudiMath::Interpolation::Linear
Definition: Interpolation.h:16
Gaudi::Parsers::InterpolGrammar
Definition: Interpolation.cpp:19
std::ostream
STL class.
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
GaudiMath::Interpolation::toString
std::string toString(const Type &)
Definition: Interpolation.cpp:42
REGISTER_GRAMMAR
#define REGISTER_GRAMMAR(ResultType, GrammarName)
Definition: GrammarsV2.h:71