00001 #ifndef Utilities_ExpressionBinaryOperator_h 00002 #define Utilities_ExpressionBinaryOperator_h 00003 /* \class reco::parser::ExpressionBinaryOperator 00004 * 00005 * Binary Operator expression 00006 * 00007 * \author original version: Chris Jones, Cornell, 00008 * adapted to Reflex by Luca Lista, INFN 00009 * 00010 * \version $Revision: 1.2 $ 00011 * 00012 */ 00013 #include "PhysicsTools/Utilities/src/ExpressionBase.h" 00014 #include "PhysicsTools/Utilities/src/ExpressionStack.h" 00015 00016 namespace reco { 00017 namespace parser { 00018 template<typename Op> 00019 struct ExpressionBinaryOperator : public ExpressionBase { 00020 virtual double value(const ROOT::Reflex::Object& o) const { 00021 return op_((*lhs_).value(o), (*rhs_).value(o)); 00022 } 00023 ExpressionBinaryOperator(ExpressionStack & expStack) { 00024 rhs_ = expStack.back(); expStack.pop_back(); 00025 lhs_ = expStack.back(); expStack.pop_back(); 00026 } 00027 private: 00028 Op op_; 00029 ExpressionPtr lhs_, rhs_; 00030 }; 00031 } 00032 } 00033 00034 #endif