#include <ScannerHelpers.h>
Public Member Functions | |
Parser () | |
Empty constructor, necessary for Reflex, useless. | |
Static Public Member Functions | |
static Reflex::Type | elementType (const Reflex::Type &wrapperType) |
Perform the type deduction form edm::Wrapper<C> to C::value_type and resolves typedefs. | |
static double | eval (const reco::parser::ExpressionPtr &sel, const Reflex::Type type, const void *obj) |
Make a Reflex::Object(type, obj) and pass it to the expression. | |
static reco::parser::ExpressionPtr | makeExpression (const std::string &expr, const Reflex::Type &type) |
Parse an expression for a given object type (using lazy parsing when resolving methods) | |
static reco::parser::SelectorPtr | makeSelector (const std::string &expr, const Reflex::Type &type) |
Parse an expression for a given object type (using lazy parsing when resolving methods) | |
static bool | test (const reco::parser::SelectorPtr &sel, const Reflex::Type type, const void *obj) |
Make a Reflex::Object(type, obj) and pass it to the selector. |
Class helper::Parser has collection of useful static methods related to StringParser that can be exported to CINT via Reflex dictionaries. It's mosly meant to be used through the helper::ScannerBase class.
Definition at line 24 of file ScannerHelpers.h.
helper::Parser::Parser | ( | ) | [inline] |
Empty constructor, necessary for Reflex, useless.
Definition at line 27 of file ScannerHelpers.h.
{}
Reflex::Type helper::Parser::elementType | ( | const Reflex::Type & | wrapperType | ) | [static] |
Perform the type deduction form edm::Wrapper<C> to C::value_type and resolves typedefs.
Definition at line 39 of file ScannerHelpers.cc.
References dtNoiseDBValidation_cfg::cerr, runEdmFileComparison::collection, and i.
Referenced by fwlite::Scanner< Collection >::Scanner().
{ Reflex::Type collection = wrapperType.TemplateArgumentAt(0); while (collection.IsTypedef()) collection = collection.ToType(); // now search for value_type for (size_t i = 0; i < collection.SubTypeSize(); ++i) { Reflex::Type objtype = collection.SubTypeAt(i); if (objtype.Name() == "value_type") { while (objtype.IsTypedef()) objtype = objtype.ToType(); return objtype; } } std::cerr << "Can't get a type out of " << wrapperType.Name(Reflex::SCOPED) << std::endl; return Reflex::Type(); }
double helper::Parser::eval | ( | const reco::parser::ExpressionPtr & | sel, |
const Reflex::Type | type, | ||
const void * | obj | ||
) | [static] |
Make a Reflex::Object(type, obj) and pass it to the expression.
Definition at line 61 of file ScannerHelpers.cc.
References VarParsing::obj.
reco::parser::ExpressionPtr helper::Parser::makeExpression | ( | const std::string & | expr, |
const Reflex::Type & | type | ||
) | [static] |
Parse an expression for a given object type (using lazy parsing when resolving methods)
NOTA BENE: <0> for cuts, <1> for expresions (why? boh!)
Definition at line 9 of file ScannerHelpers.cc.
References reco::parser::baseExceptionWhat(), dtNoiseDBValidation_cfg::cerr, alignCSCRings::e, triggerExpression::parse(), and runTheMatrix::ret.
Referenced by helper::ScannerBase::addExpression().
{ reco::parser::ExpressionPtr ret; using namespace boost::spirit::classic; reco::parser::Grammar grammar(ret, type, true); const char* startingFrom = expr.c_str(); try { parse(startingFrom, grammar.use_parser<1>() >> end_p, space_p).full; } catch(reco::parser::BaseException&e){ std::cerr << "Expression parser error:"<<reco::parser::baseExceptionWhat(e)<<" (char "<<e.where-startingFrom<<")" << std::endl; } return ret; }
reco::parser::SelectorPtr helper::Parser::makeSelector | ( | const std::string & | expr, |
const Reflex::Type & | type | ||
) | [static] |
Parse an expression for a given object type (using lazy parsing when resolving methods)
NOTA BENE: <0> for cuts, <1> for expresions (why? boh!)
Definition at line 24 of file ScannerHelpers.cc.
References reco::parser::baseExceptionWhat(), dtNoiseDBValidation_cfg::cerr, alignCSCRings::e, triggerExpression::parse(), and runTheMatrix::ret.
Referenced by helper::ScannerBase::addExtraCut(), and helper::ScannerBase::setCut().
{ reco::parser::SelectorPtr ret; using namespace boost::spirit::classic; reco::parser::Grammar grammar(ret, type, true); const char* startingFrom = expr.c_str(); try { parse(startingFrom, grammar.use_parser<0>() >> end_p, space_p).full; } catch(reco::parser::BaseException&e){ std::cerr << "Selector parser error:"<<reco::parser::baseExceptionWhat(e)<<" (char "<<e.where-startingFrom<<")" << std::endl; } return ret; }
bool helper::Parser::test | ( | const reco::parser::SelectorPtr & | sel, |
const Reflex::Type | type, | ||
const void * | obj | ||
) | [static] |
Make a Reflex::Object(type, obj) and pass it to the selector.
Definition at line 55 of file ScannerHelpers.cc.
References VarParsing::obj.