Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CommonTools_Utils_ExpressionBinaryOperator_h
0002 #define CommonTools_Utils_ExpressionBinaryOperator_h
0003 /* \class reco::parser::ExpressionBinaryOperator
0004  *
0005  * Binary Operator expression
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/ExpressionBase.h"
0014 #include "CommonTools/Utils/interface/parser/ExpressionStack.h"
0015 
0016 namespace reco {
0017   namespace parser {
0018     template <typename Op>
0019     struct ExpressionBinaryOperator : public ExpressionBase {
0020       double value(const edm::ObjectWithDict& o) const override { return op_((*lhs_).value(o), (*rhs_).value(o)); }
0021       ExpressionBinaryOperator(ExpressionStack& expStack) {
0022         rhs_ = expStack.back();
0023         expStack.pop_back();
0024         lhs_ = expStack.back();
0025         expStack.pop_back();
0026       }
0027 
0028     private:
0029       Op op_;
0030       ExpressionPtr lhs_, rhs_;
0031     };
0032   }  // namespace parser
0033 }  // namespace reco
0034 
0035 #endif