DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
Base class describing string evaluation to C++ objects using boost::spirit. More...
#include <Grammar.h>
Classes | |
struct | specialization_t |
Structure to be filled if automatic object parsing from string is supposed to be supported. More... | |
Public Types | |
typedef unsigned long long int | key_type |
Public Member Functions | |
key_type | hash () const |
Access the hash value for this grammar type. More... | |
const std::string & | type_name () const |
Access to the type information name. More... | |
int | data_type () const |
Access ROOT data type for fundamentals. More... | |
TClass * | clazz () const |
Access the ROOT class for complex objects. More... | |
virtual void | setCast (const Cast *cast) const |
Set cast structure. More... | |
virtual const Cast & | cast () const |
Access ABI object cast. More... | |
virtual bool | equals (const std::type_info &other_type) const =0 |
Access to the type information. More... | |
virtual const std::type_info & | type () const =0 |
Access to the type information. More... | |
virtual size_t | sizeOf () const =0 |
Access the object size (sizeof operator) More... | |
virtual void | destruct (void *pointer) const =0 |
Opaque object destructor. More... | |
virtual std::string | str (const void *ptr) const |
Serialize an opaque value to a string. More... | |
virtual bool | fromString (void *ptr, const std::string &value) const |
Set value from serialized string. On successful data conversion TRUE is returned. More... | |
virtual int | evaluate (void *ptr, const std::string &value) const |
Evaluate string value if possible before calling boost::spirit. More... | |
Static Public Member Functions | |
template<typename TYPE > | |
static const BasicGrammar & | instance () |
Instance factory. More... | |
static const BasicGrammar & | get (const std::type_info &info) |
Access grammar by type info. More... | |
static const BasicGrammar & | get (unsigned long long int hash_code) |
Lookup existing grammar using the grammar's hash code/hash64(type-name) (used for reading objects) More... | |
static void | invalidConversion (const std::type_info &from, const std::type_info &to) |
Error callback on invalid conversion. More... | |
static void | invalidConversion (const std::string &value, const std::type_info &to) |
Error callback on invalid conversion. More... | |
Public Attributes | |
const std::string | name |
Instance type name. More... | |
const key_type | hash_value = 0 |
Instance hash code. More... | |
TClass * | root_class = 0 |
Cached TClass reference for speed improvements. More... | |
int | root_data_type = -1 |
Cached TDataType information for fundamental types. More... | |
bool | inited = false |
Initialization flag. More... | |
struct dd4hep::BasicGrammar::specialization_t | specialization |
Protected Member Functions | |
BasicGrammar (const std::string &typ) | |
Default constructor. More... | |
virtual | ~BasicGrammar () |
Default destructor. More... | |
void | initialize () const |
Second step initialization after the virtual table is fixed. More... | |
int | initialized_data_type () const |
Access ROOT data type for fundamentals. More... | |
TClass * | initialized_clazz () const |
Access the ROOT class for complex objects. More... | |
Static Protected Member Functions | |
static void | pre_note (const std::type_info &info, const BasicGrammar &(*fcn)(), specialization_t specs) |
Instance factory. More... | |
Friends | |
class | GrammarRegistry |
Base class describing string evaluation to C++ objects using boost::spirit.
Grammar object handle the boost::spirit conversion between strings and numeric values/objects. Numeric objects could be atomic (int, long, float, double, etc) or complex (vector<int>, vector<float>...). This way e.g. a vector<int> may be converted into a list<double>. The conversion though requires an intermediate string representation. For this reason the conversion mechanism is relatively slow and hence should not be used inside number-crunching algorithms.
typedef unsigned long long int dd4hep::BasicGrammar::key_type |
|
protected |
Default constructor.
Definition at line 102 of file Grammar.cpp.
|
protectedvirtual |
Default destructor.
Definition at line 115 of file Grammar.cpp.
|
virtual |
Access ABI object cast.
Definition at line 253 of file Grammar.cpp.
|
inline |
|
inline |
|
pure virtual |
Opaque object destructor.
Implemented in dd4hep::Grammar< TYPE >.
|
pure virtual |
Access to the type information.
Implemented in dd4hep::Grammar< TYPE >.
|
virtual |
Evaluate string value if possible before calling boost::spirit.
Definition at line 278 of file Grammar.cpp.
|
virtual |
Set value from serialized string. On successful data conversion TRUE is returned.
Definition at line 269 of file Grammar.cpp.
|
static |
Access grammar by type info.
Lookup existing grammar using hash code (reading objects)
Definition at line 184 of file Grammar.cpp.
|
static |
Lookup existing grammar using the grammar's hash code/hash64(type-name) (used for reading objects)
Lookup existing grammar using hash code (reading objects)
Definition at line 153 of file Grammar.cpp.
|
inline |
|
protected |
Second step initialization after the virtual table is fixed.
Definition at line 198 of file Grammar.cpp.
|
protected |
Access the ROOT class for complex objects.
Definition at line 224 of file Grammar.cpp.
|
protected |
Access ROOT data type for fundamentals.
Definition at line 218 of file Grammar.cpp.
|
static |
|
static |
Error callback on invalid conversion.
Definition at line 230 of file Grammar.cpp.
|
static |
Error callback on invalid conversion.
Definition at line 238 of file Grammar.cpp.
|
staticprotected |
Instance factory.
Prenote loadable grammar.
If the grammer was instantiated before the pre-note: update the grammar...
Definition at line 119 of file Grammar.cpp.
|
virtual |
Set cast structure.
Definition at line 247 of file Grammar.cpp.
|
pure virtual |
Access the object size (sizeof operator)
Implemented in dd4hep::Grammar< TYPE >.
|
virtual |
Serialize an opaque value to a string.
Definition at line 261 of file Grammar.cpp.
|
pure virtual |
Access to the type information.
Implemented in dd4hep::Grammar< TYPE >.
|
inline |
|
friend |
const key_type dd4hep::BasicGrammar::hash_value = 0 |
|
mutable |
const std::string dd4hep::BasicGrammar::name |
|
mutable |
|
mutable |
struct dd4hep::BasicGrammar::specialization_t dd4hep::BasicGrammar::specialization |