CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
FWModelExpressionSelector Class Reference

#include <Fireworks/Core/interface/FWModelExpressionSelector.h>

Public Member Functions

 FWModelExpressionSelector ()
 
bool select (FWEventItem *iItem, const std::string &iExpression) const
 

Private Member Functions

 FWModelExpressionSelector (const FWModelExpressionSelector &)
 
const FWModelExpressionSelectoroperator= (const FWModelExpressionSelector &)
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 30 of file FWModelExpressionSelector.h.

Constructor & Destructor Documentation

FWModelExpressionSelector::FWModelExpressionSelector ( )
inline

Definition at line 34 of file FWModelExpressionSelector.h.

34  {
35  }
FWModelExpressionSelector::FWModelExpressionSelector ( const FWModelExpressionSelector )
private

Member Function Documentation

const FWModelExpressionSelector& FWModelExpressionSelector::operator= ( const FWModelExpressionSelector )
private
bool FWModelExpressionSelector::select ( FWEventItem iItem,
const std::string &  iExpression 
) const

Throws an FWExpressionException if there is a problem

Definition at line 74 of file FWModelExpressionSelector.cc.

References reco::parser::baseExceptionWhat(), FWEventItem::changeManager(), ExpressReco_HICollisions_FallBack::e, getHLTprescales::index, fireworks::expression::indexFromNewFormatToOldFormat(), FWEventItem::modelData(), FWEventItem::modelType(), connectstrParser::o, fireworks::expression::oldToNewFormat(), triggerExpression::parse(), FWEventItem::select(), FWEventItem::size(), summarizeEdmComparisonLogfiles::succeeded, and cond::rpcobtemp::temp.

Referenced by python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), python.Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), python.Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), python.Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), python.Vispa.Views.AbstractView.AbstractView::restoreSelection(), and CmsShowEDI::runSelection().

75 {
76  using namespace fireworks::expression;
77 
78  ROOT::Reflex::Type type= ROOT::Reflex::Type::ByName(iItem->modelType()->GetName());
79  assert(type != ROOT::Reflex::Type());
80 
81  //Backwards compatibility with old format
82  std::string temp = oldToNewFormat(iExpression);
83 
84  //now setup the parser
85  using namespace boost::spirit::classic;
86  reco::parser::SelectorPtr selectorPtr;
87  reco::parser::Grammar grammar(selectorPtr,type);
88  bool succeeded=true;
89  try {
90  if(!parse(temp.c_str(), grammar.use_parser<0>() >> end_p, space_p).full) {
91  throw FWExpressionException("syntax error", -1);
92  //std::cout <<"failed to parse "<<iExpression<<" because of syntax error"<<std::endl;
93  succeeded=false;
94  }
95  } catch(const reco::parser::BaseException& e) {
96  //NOTE: need to calculate actual position before doing the regex
98  //std::cout <<"failed to parse "<<iExpression<<" because "<<reco::parser::baseExceptionWhat(e)<<std::endl;
99  succeeded=false;
100  }
101  if(!succeeded) { return false;}
102 
103 
104  FWChangeSentry sentry(*(iItem->changeManager()));
105  for( unsigned int index = 0; index < iItem->size(); ++index ) {
106  ROOT::Reflex::Object o(type, const_cast<void *>(iItem->modelData(index)));
107 
108  if((*selectorPtr)(o)) {
109  iItem->select(index);
110  }
111  }
112 
113  return true;
114 }
type
Definition: HCALResponse.h:22
long indexFromNewFormatToOldFormat(const std::string &iNewFormat, long iNewFormatIndex, const std::string &iOldFormat)
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:130
boost::spirit::classic::parser_error< reco::parser::SyntaxErrors > BaseException
Definition: Exception.h:37
Evaluator * parse(const T &text)
const char * baseExceptionWhat(const BaseException &e)
returns the appropriate &#39;what&#39; message for the exception
Definition: Exception.h:40
size_t size() const
Definition: FWEventItem.cc:549
boost::shared_ptr< SelectorBase > SelectorPtr
Definition: SelectorPtr.h:17
std::string oldToNewFormat(const std::string &iExpression)
const TClass * modelType() const
Definition: FWEventItem.cc:562
void select(int iIndex) const
Definition: FWEventItem.cc:261
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:568