00001 #ifndef CommonTools_Utils_ExpressionUnaryOperatorSetter_h 00002 #define CommonTools_Utils_ExpressionUnaryOperatorSetter_h 00003 /* \class reco::parser::ExpressionUnaryOperator 00004 * 00005 * Unary Operator expression setter 00006 * 00007 * \author original version: Chris Jones, Cornell, 00008 * adapted by Luca Lista, INFN 00009 * 00010 * \version $Revision: 1.3 $ 00011 * 00012 */ 00013 #include "CommonTools/Utils/src/ExpressionUnaryOperator.h" 00014 #include "CommonTools/Utils/src/ExpressionStack.h" 00015 #ifdef BOOST_SPIRIT_DEBUG 00016 #include <string> 00017 #include <iostream> 00018 #endif 00019 namespace reco { 00020 namespace parser { 00021 00022 #ifdef BOOST_SPIRIT_DEBUG 00023 template <typename Op> struct op1_out { static const std::string value; }; 00024 #endif 00025 00026 template<typename Op> 00027 struct ExpressionUnaryOperatorSetter { 00028 ExpressionUnaryOperatorSetter(ExpressionStack & stack) : stack_(stack) { } 00029 void operator()(const char*, const char*) const { 00030 #ifdef BOOST_SPIRIT_DEBUG 00031 BOOST_SPIRIT_DEBUG_OUT << "pushing unary operator" << op1_out<Op>::value << std::endl; 00032 #endif 00033 stack_.push_back(ExpressionPtr(new ExpressionUnaryOperator<Op>(stack_))); 00034 } 00035 private: 00036 ExpressionStack & stack_; 00037 }; 00038 } 00039 } 00040 00041 #endif