00001 #ifndef Utilities_ExpressionBinaryOperatorSetter_h 00002 #define Utilities_ExpressionBinaryOperatorSetter_h 00003 /* \class reco::parser::ExpressionBinaryOperator 00004 * 00005 * Binary operator expression setter 00006 * 00007 * \author original version: Chris Jones, Cornell, 00008 * adapted to Reflex by Luca Lista, INFN 00009 * 00010 * \version $Revision: 1.3 $ 00011 * 00012 */ 00013 #include "PhysicsTools/Utilities/src/ExpressionBinaryOperator.h" 00014 #include "PhysicsTools/Utilities/src/ExpressionStack.h" 00015 #include <cmath> 00016 00017 namespace reco { 00018 namespace parser { 00019 00020 template<typename T> 00021 struct power_of { 00022 T operator()(T lhs, T rhs) const { return pow(lhs, rhs); } 00023 }; 00024 00025 template<typename Op> 00026 struct ExpressionBinaryOperatorSetter { 00027 ExpressionBinaryOperatorSetter(ExpressionStack & stack) : stack_(stack) { } 00028 void operator()(const char*, const char*) const { 00029 stack_.push_back(ExpressionPtr(new ExpressionBinaryOperator<Op>(stack_))); 00030 } 00031 private: 00032 ExpressionStack & stack_; 00033 }; 00034 } 00035 } 00036 00037 #endif