CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
FWModelExpressionSelector Class Reference

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

Public Member Functions

 FWModelExpressionSelector ()
 
void select (FWEventItem *iItem, const std::string &iExpression, Color_t iColor=-1) const
 

Private Member Functions

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

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.

References operator=(), select(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Function Documentation

const FWModelExpressionSelector& FWModelExpressionSelector::operator= ( const FWModelExpressionSelector )
privatedelete
void FWModelExpressionSelector::select ( FWEventItem iItem,
const std::string &  iExpression,
Color_t  iColor = -1 
) const

Throws an FWExpressionException if there is a problem

Definition at line 73 of file FWModelExpressionSelector.cc.

References reco::parser::baseExceptionWhat(), edm::TypeWithDict::byName(), FWEventItem::changeManager(), FWEventItem::ModelInfo::displayProperties(), MillePedeFileConverter_cfg::e, diffTreeTool::index, fireworks::expression::indexFromNewFormatToOldFormat(), FWEventItem::modelData(), FWEventItem::modelInfo(), FWEventItem::modelType(), connectstrParser::o, fireworks::expression::oldToNewFormat(), dumpparser::parse(), FWEventItem::select(), FWDisplayProperties::setColor(), FWEventItem::setDisplayProperties(), FWEventItem::size(), AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

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

74 {
75  using namespace fireworks::expression;
76 
78  assert(type != edm::TypeWithDict());
79 
80  //Backwards compatibility with old format
81  std::string temp = oldToNewFormat(iExpression);
82 
83  //now setup the parser
84  using namespace boost::spirit::classic;
85  reco::parser::SelectorPtr selectorPtr;
86  reco::parser::Grammar grammar(selectorPtr,type);
87  try {
88  if(!parse(temp.c_str(), grammar.use_parser<0>() >> end_p, space_p).full) {
89  throw FWExpressionException("syntax error", -1);
90  //std::cout <<"failed to parse "<<iExpression<<" because of syntax error"<<std::endl;
91  }
92  } catch(const reco::parser::BaseException& e) {
93  //NOTE: need to calculate actual position before doing the regex
94  throw FWExpressionException(reco::parser::baseExceptionWhat(e), indexFromNewFormatToOldFormat(temp,e.where-temp.c_str(),iExpression));
95  //std::cout <<"failed to parse "<<iExpression<<" because "<<reco::parser::baseExceptionWhat(e)<<std::endl;
96  }
97 
98 
99  FWChangeSentry sentry(*(iItem->changeManager()));
100  for( unsigned int index = 0; index < iItem->size(); ++index ) {
101  edm::ObjectWithDict o(type, const_cast<void *>(iItem->modelData(index)));
102  if((*selectorPtr)(o)) {
103  iItem->select(index);
104  if (iColor > 0) {
106  props.setColor(iColor);
107  iItem->setDisplayProperties(index, props);
108  }
109  }
110  }
111 }
type
Definition: HCALResponse.h:21
long indexFromNewFormatToOldFormat(const std::string &iNewFormat, long iNewFormatIndex, const std::string &iOldFormat)
void setColor(Color_t iColor)
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:132
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
boost::spirit::classic::parser_error< reco::parser::SyntaxErrors > BaseException
Definition: Exception.h:37
void setDisplayProperties(int iIndex, const FWDisplayProperties &) const
Definition: FWEventItem.cc:278
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:59
const char * baseExceptionWhat(const BaseException &e)
returns the appropriate &#39;what&#39; message for the exception
Definition: Exception.h:40
def parse(path, config)
Definition: dumpparser.py:13
size_t size() const
Definition: FWEventItem.cc:550
boost::shared_ptr< SelectorBase > SelectorPtr
Definition: SelectorPtr.h:17
std::string oldToNewFormat(const std::string &iExpression)
const TClass * modelType() const
Definition: FWEventItem.cc:563
void select(int iIndex) const
Definition: FWEventItem.cc:252
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:569
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537