![]() |
![]() |
#include <Fireworks/Core/interface/FWModelFilter.h>
Public Member Functions | |
const std::string & | expression () const |
FWModelFilter (const std::string &iExpression, const std::string &iClassName) | |
bool | passesFilter (const void *) const |
void | setClassName (const std::string &) |
void | setExpression (const std::string &) |
bool | trivialFilter () const |
virtual | ~FWModelFilter () |
Private Attributes | |
std::string | m_className |
std::string | m_expression |
reco::parser::SelectorPtr | m_selector |
ROOT::Reflex::Type | m_type |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 33 of file FWModelFilter.h.
FWModelFilter::FWModelFilter | ( | const std::string & | iExpression, |
const std::string & | iClassName | ||
) |
Definition at line 39 of file FWModelFilter.cc.
References setExpression().
: m_className(iClassName), m_type(ROOT::Reflex::Type::ByName(iClassName)) { setExpression(iExpression); }
FWModelFilter::~FWModelFilter | ( | ) | [virtual] |
Definition at line 52 of file FWModelFilter.cc.
{ }
const std::string & FWModelFilter::expression | ( | ) | const |
Definition at line 118 of file FWModelFilter.cc.
References m_expression.
Referenced by FWEventItem::filterExpression().
{ return m_expression; }
bool FWModelFilter::passesFilter | ( | const void * | iObject | ) | const |
Definition at line 124 of file FWModelFilter.cc.
References m_expression, m_selector, m_type, and connectstrParser::o.
Referenced by FWEventItem::runFilter().
{ if(m_expression.empty() || !m_selector.get()) { return true; } ROOT::Reflex::Object o(m_type, const_cast<void *>(iObject)); return (*m_selector)(o); }
void FWModelFilter::setClassName | ( | const std::string & | iClassName | ) |
Definition at line 103 of file FWModelFilter.cc.
References m_className, m_expression, m_type, and setExpression().
Referenced by FWEventItem::FWEventItem().
{ //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 FWModelFilter::setExpression | ( | const std::string & | iExpression | ) |
Throws an FWExpressionException if there is a problem
Definition at line 72 of file FWModelFilter.cc.
References reco::parser::baseExceptionWhat(), fireworks::expression::indexFromNewFormatToOldFormat(), m_expression, m_selector, m_type, fireworks::expression::oldToNewFormat(), triggerExpression::parse(), and cond::rpcobtemp::temp.
Referenced by FWModelFilter(), setClassName(), and FWEventItem::setFilterExpression().
{ 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::SelectorPtr tmpPtr; reco::parser::Grammar grammar(tmpPtr,m_type); try { if(parse(temp.c_str(), grammar.use_parser<0>() >> end_p, space_p).full) { m_selector = 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; } }
bool FWModelFilter::trivialFilter | ( | ) | const |
Definition at line 135 of file FWModelFilter.cc.
References m_expression.
{ return m_expression.empty(); }
std::string FWModelFilter::m_className [private] |
Definition at line 62 of file FWModelFilter.h.
Referenced by setClassName().
std::string FWModelFilter::m_expression [private] |
Definition at line 61 of file FWModelFilter.h.
Referenced by expression(), passesFilter(), setClassName(), setExpression(), and trivialFilter().
Definition at line 63 of file FWModelFilter.h.
Referenced by passesFilter(), and setExpression().
ROOT::Reflex::Type FWModelFilter::m_type [private] |
Definition at line 64 of file FWModelFilter.h.
Referenced by passesFilter(), setClassName(), and setExpression().