CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 to Reflex by Luca Lista, INFN
9  *
10  * \version $Revision: 1.1 $
11  *
12  */
18 #include <boost/shared_ptr.hpp>
19 
20 namespace reco {
21  namespace parser {
23  public:
25  ComparisonStack& cmpStack, ExpressionStack& expStack) :
26  selStack_(selStack), cmpStack_(cmpStack), expStack_(expStack) { }
27 
28  void operator()(const char * begin, const char *) const {
29  if(expStack_.empty())
30  throw Exception(begin)
31  << "Grammar error: empty expression stack. Please contact developer.";
32  if(cmpStack_.empty())
33  throw Exception(begin)
34  << "Grammar error: empty comparator stack. Please contact developer." << "\"";
35  boost::shared_ptr<ExpressionBase> rhs = expStack_.back(); expStack_.pop_back();
36  boost::shared_ptr<ExpressionBase> lhs = expStack_.back(); expStack_.pop_back();
37  boost::shared_ptr<ComparisonBase> comp = cmpStack_.back(); 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  private:
47  };
48  }
49 }
50 
51 #endif
BinarySelectorSetter(SelectorStack &selStack, ComparisonStack &cmpStack, ExpressionStack &expStack)
void operator()(const char *begin, const char *) const
std::vector< boost::shared_ptr< ExpressionBase > > ExpressionStack
std::vector< SelectorPtr > SelectorStack
Definition: SelectorStack.h:18
boost::shared_ptr< SelectorBase > SelectorPtr
Definition: SelectorPtr.h:17
#define begin
Definition: vmac.h:31
std::vector< boost::shared_ptr< ComparisonBase > > ComparisonStack