CMS 3D CMS Logo

ExpressionSelectorSetter.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_ExpressionSelectorSetter_h
2 #define CommonTools_Utils_ExpressionSelectorSetter_h
3 /* \class reco::parser::ExpressionSelectorSetter
4  *
5  * Creates an implicit Binary selector setter by comparing an expression to 0
6  *
7  * \author original version: Chris Jones, Cornell,
8  * adapted by Luca Lista, INFN
9  *
10  * \version $Revision: 1.2 $
11  *
12  */
19 #include <boost/shared_ptr.hpp>
20 #include <functional>
21 
22 namespace reco {
23  namespace parser {
25  public:
27  selStack_(selStack), expStack_(expStack) { }
28 
29  void operator()(const char * begin, const char *) const {
30  if(expStack_.empty())
31  throw Exception(begin)
32  << "Grammar error: empty expression stack. Please contact developer." << "\"";
33  boost::shared_ptr<ExpressionBase> rhs = expStack_.back(); expStack_.pop_back();
34  boost::shared_ptr<ExpressionBase> lhs(new ExpressionNumber(0.0));
35  boost::shared_ptr<ComparisonBase> comp(new Comparison<std::not_equal_to<double> >());
36 #ifdef BOOST_SPIRIT_DEBUG
37  BOOST_SPIRIT_DEBUG_OUT << "pushing expression selector" << std::endl;
38 #endif
39  selStack_.push_back(SelectorPtr(new BinarySelector(lhs, comp, rhs)));
40  }
41  private:
44  };
45  }
46 }
47 
48 #endif
std::vector< boost::shared_ptr< ExpressionBase > > ExpressionStack
std::vector< SelectorPtr > SelectorStack
Definition: SelectorStack.h:18
boost::shared_ptr< SelectorBase > SelectorPtr
Definition: SelectorPtr.h:17
fixed size matrix
#define begin
Definition: vmac.h:30
void operator()(const char *begin, const char *) const
ExpressionSelectorSetter(SelectorStack &selStack, ExpressionStack &expStack)