#include <Fireworks/Core/interface/FWExpressionEvaluator.h>
Public Member Functions | |
double | evalExpression (const void *) const |
const std::string & | expression () const |
FWExpressionEvaluator (const std::string &iExpression, const std::string &iClassName) | |
void | setClassName (const std::string &) |
void | setExpression (const std::string &) |
virtual | ~FWExpressionEvaluator () |
Private Attributes | |
std::string | m_className |
reco::parser::ExpressionPtr | m_expr |
std::string | m_expression |
ROOT::Reflex::Type | m_type |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 35 of file FWExpressionEvaluator.h.
FWExpressionEvaluator::FWExpressionEvaluator | ( | const std::string & | iExpression, |
const std::string & | iClassName | ||
) |
Definition at line 38 of file FWExpressionEvaluator.cc.
References setExpression().
: m_className(iClassName), m_type(ROOT::Reflex::Type::ByName(iClassName)) { setExpression(iExpression); }
FWExpressionEvaluator::~FWExpressionEvaluator | ( | ) | [virtual] |
Definition at line 51 of file FWExpressionEvaluator.cc.
{ }
double FWExpressionEvaluator::evalExpression | ( | const void * | iObject | ) | const |
Definition at line 123 of file FWExpressionEvaluator.cc.
References m_expr, m_expression, m_type, and connectstrParser::o.
const std::string & FWExpressionEvaluator::expression | ( | ) | const |
Definition at line 117 of file FWExpressionEvaluator.cc.
References m_expression.
{ return m_expression; }
void FWExpressionEvaluator::setClassName | ( | const std::string & | iClassName | ) |
Definition at line 102 of file FWExpressionEvaluator.cc.
References m_className, m_expression, m_type, and setExpression().
{ //NOTE: How do we handle the case where the filter was created before // the library for the class was loaded and therefore we don't have // a Reflex dictionary for it? m_className = iClassName; m_type = ROOT::Reflex::Type::ByName(iClassName); setExpression(m_expression); }
void FWExpressionEvaluator::setExpression | ( | const std::string & | iExpression | ) |
Throws an FWExpressionException if there is a problem
Definition at line 71 of file FWExpressionEvaluator.cc.
References reco::parser::baseExceptionWhat(), ExpressReco_HICollisions_FallBack::e, fireworks::expression::indexFromNewFormatToOldFormat(), m_expr, m_expression, m_type, fireworks::expression::oldToNewFormat(), triggerExpression::parse(), and cond::rpcobtemp::temp.
Referenced by FWExpressionEvaluator(), and setClassName().
{ if(m_type != ROOT::Reflex::Type() && iExpression.size()) { using namespace fireworks::expression; //Backwards compatibility with old format std::string temp = oldToNewFormat(iExpression); //now setup the parser using namespace boost::spirit::classic; reco::parser::ExpressionPtr tmpPtr; reco::parser::Grammar grammar(tmpPtr,m_type); try { if(parse(temp.c_str(), grammar.use_parser<1>() >> end_p, space_p).full) { m_expr = tmpPtr; m_expression = iExpression; } else { throw FWExpressionException("syntax error", -1); //std::cout <<"failed to parse "<<iExpression<<" because of syntax error"<<std::endl; } } catch(const reco::parser::BaseException& e) { //NOTE: need to calculate actual position before doing the regex throw FWExpressionException(reco::parser::baseExceptionWhat(e), indexFromNewFormatToOldFormat(temp,e.where-temp.c_str(),iExpression)); //std::cout <<"failed to parse "<<iExpression<<" because "<<reco::parser::baseExceptionWhat(e)<<std::endl; } } else { m_expression=iExpression; } }
std::string FWExpressionEvaluator::m_className [private] |
Definition at line 62 of file FWExpressionEvaluator.h.
Referenced by setClassName().
Definition at line 63 of file FWExpressionEvaluator.h.
Referenced by evalExpression(), and setExpression().
std::string FWExpressionEvaluator::m_expression [private] |
Definition at line 61 of file FWExpressionEvaluator.h.
Referenced by evalExpression(), expression(), setClassName(), and setExpression().
ROOT::Reflex::Type FWExpressionEvaluator::m_type [private] |
Definition at line 64 of file FWExpressionEvaluator.h.
Referenced by evalExpression(), setClassName(), and setExpression().