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 ()
 
void select (FWEventItem *iItem, const std::string &iExpression, Color_t c=-1) 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
void FWModelExpressionSelector::select ( FWEventItem iItem,
const std::string &  iExpression,
Color_t  c = -1 
) const

Throws an FWExpressionException if there is a problem

Definition at line 74 of file FWModelExpressionSelector.cc.

References reco::parser::baseExceptionWhat(), FWEventItem::changeManager(), FWEventItem::ModelInfo::displayProperties(), alignCSCRings::e, getHLTprescales::index, fireworks::expression::indexFromNewFormatToOldFormat(), FWEventItem::modelData(), FWEventItem::modelInfo(), FWEventItem::modelType(), python.connectstrParser::o, fireworks::expression::oldToNewFormat(), triggerExpression::parse(), FWEventItem::select(), FWDisplayProperties::setColor(), FWEventItem::setDisplayProperties(), FWEventItem::size(), and groupFilesInBlocks::temp.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), 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  try {
89  if(!parse(temp.c_str(), grammar.use_parser<0>() >> end_p, space_p).full) {
90  throw FWExpressionException("syntax error", -1);
91  //std::cout <<"failed to parse "<<iExpression<<" because of syntax error"<<std::endl;
92  }
93  } catch(const reco::parser::BaseException& e) {
94  //NOTE: need to calculate actual position before doing the regex
96  //std::cout <<"failed to parse "<<iExpression<<" because "<<reco::parser::baseExceptionWhat(e)<<std::endl;
97  }
98 
99 
100  FWChangeSentry sentry(*(iItem->changeManager()));
101  for( unsigned int index = 0; index < iItem->size(); ++index ) {
102  ROOT::Reflex::Object o(type, const_cast<void *>(iItem->modelData(index)));
103 
104  if((*selectorPtr)(o)) {
105  iItem->select(index);
106 
107  if (iColor > 0) {
109  props.setColor(iColor);
110  iItem->setDisplayProperties(index, props);
111  }
112  }
113  }
114 }
type
Definition: HCALResponse.h:22
long indexFromNewFormatToOldFormat(const std::string &iNewFormat, long iNewFormatIndex, const std::string &iOldFormat)
void setColor(Color_t iColor)
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:131
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
boost::spirit::classic::parser_error< reco::parser::SyntaxErrors > BaseException
Definition: Exception.h:37
Evaluator * parse(const T &text)
void setDisplayProperties(int iIndex, const FWDisplayProperties &) const
Definition: FWEventItem.cc:277
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:548
boost::shared_ptr< SelectorBase > SelectorPtr
Definition: SelectorPtr.h:17
std::string oldToNewFormat(const std::string &iExpression)
const TClass * modelType() const
Definition: FWEventItem.cc:561
void select(int iIndex) const
Definition: FWEventItem.cc:251
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:567
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535