CMS 3D CMS Logo

BinarySelectorSetter.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_BinarySelectorSetter_h
2 #define CommonTools_Utils_BinarySelectorSetter_h
3 /* \class reco::parser::BinarySelectorSetter
4  *
5  * Binary selector setter
6  *
7  * \author original version: Chris Jones, Cornell,
8  * adapted by Luca Lista, INFN
9  *
10  * \version $Revision: 1.2 $
11  *
12  */
18 
19 namespace reco {
20  namespace parser {
22  public:
24  : selStack_(selStack), cmpStack_(cmpStack), expStack_(expStack) {}
25 
26  void operator()(const char* begin, const char*) const {
27  if (expStack_.empty())
28  throw Exception(begin) << "Grammar error: empty expression stack. Please contact developer.";
29  if (cmpStack_.empty())
30  throw Exception(begin) << "Grammar error: empty comparator stack. Please contact developer."
31  << "\"";
32  std::shared_ptr<ExpressionBase> rhs = expStack_.back();
33  expStack_.pop_back();
34  std::shared_ptr<ExpressionBase> lhs = expStack_.back();
35  expStack_.pop_back();
36  std::shared_ptr<ComparisonBase> comp = cmpStack_.back();
37  cmpStack_.pop_back();
38 #ifdef BOOST_SPIRIT_DEBUG
39  BOOST_SPIRIT_DEBUG_OUT << "pushing binary selector" << std::endl;
40 #endif
41  selStack_.push_back(SelectorPtr(new BinarySelector(lhs, comp, rhs)));
42  }
43 
44  private:
48  };
49  } // namespace parser
50 } // namespace reco
51 
52 #endif
std::vector< std::shared_ptr< ComparisonBase > > ComparisonStack
BinarySelectorSetter(SelectorStack &selStack, ComparisonStack &cmpStack, ExpressionStack &expStack)
void operator()(const char *begin, const char *) const
std::vector< std::shared_ptr< ExpressionBase > > ExpressionStack
std::vector< SelectorPtr > SelectorStack
Definition: SelectorStack.h:18
fixed size matrix
std::shared_ptr< SelectorBase > SelectorPtr
Definition: SelectorPtr.h:18