File indexing completed on 2024-04-06 12:01:17
0001 #ifndef CommonTools_Utils_ExpressionUnaryOperator_h
0002 #define CommonTools_Utils_ExpressionUnaryOperator_h
0003
0004
0005
0006
0007
0008
0009
0010
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 ExpressionUnaryOperator : public ExpressionBase {
0020 double value(const edm::ObjectWithDict& o) const override { return op_((*exp_).value(o)); }
0021 ExpressionUnaryOperator(ExpressionStack& expStack) {
0022 exp_ = expStack.back();
0023 expStack.pop_back();
0024 }
0025
0026 private:
0027 Op op_;
0028 ExpressionPtr exp_;
0029 };
0030 }
0031 }
0032
0033 #endif