Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:36:15

0001 #ifndef CommonTools_Utils_ExpressionBinaryOperatorSetter_h
0002 #define CommonTools_Utils_ExpressionBinaryOperatorSetter_h
0003 /* \class reco::parser::ExpressionBinaryOperator
0004  *
0005  * Binary operator expression setter
0006  *
0007  * \author original version: Chris Jones, Cornell, 
0008  *         adapted by Luca Lista, INFN
0009  *
0010  * \version $Revision: 1.2 $
0011  *
0012  */
0013 #include "CommonTools/Utils/interface/parser/ExpressionBinaryOperator.h"
0014 #include "CommonTools/Utils/interface/parser/ExpressionStack.h"
0015 #include <cmath>
0016 
0017 namespace reco {
0018   namespace parser {
0019 
0020     template <typename T>
0021     struct power_of {
0022       T operator()(T lhs, T rhs) const { return pow(lhs, rhs); }
0023     };
0024 
0025     template <typename Op>
0026     struct ExpressionBinaryOperatorSetter {
0027       ExpressionBinaryOperatorSetter(ExpressionStack& stack) : stack_(stack) {}
0028       void operator()(const char*, const char*) const {
0029         stack_.push_back(ExpressionPtr(new ExpressionBinaryOperator<Op>(stack_)));
0030       }
0031 
0032     private:
0033       ExpressionStack& stack_;
0034     };
0035   }  // namespace parser
0036 }  // namespace reco
0037 
0038 #endif