File indexing completed on 2024-04-06 12:01:17
0001 #ifndef CommonTools_Utils_FunctionSetter_h
0002 #define CommonTools_Utils_FunctionSetter_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "CommonTools/Utils/interface/parser/Function.h"
0013 #include "CommonTools/Utils/interface/parser/FunctionStack.h"
0014
0015 namespace reco {
0016 namespace parser {
0017 struct FunctionSetter {
0018 FunctionSetter(Function fun, FunctionStack& stack) : fun_(fun), stack_(stack) {}
0019
0020 void operator()(const char*, const char*) const {
0021 #ifdef BOOST_SPIRIT_DEBUG
0022 BOOST_SPIRIT_DEBUG_OUT << "pushing math function: " << functionNames[fun_] << std::endl;
0023 #endif
0024 stack_.push_back(fun_);
0025 }
0026
0027 private:
0028 Function fun_;
0029 FunctionStack& stack_;
0030 };
0031
0032 struct FunctionSetterCommit {
0033 FunctionSetterCommit(FunctionStack& stackFrom, FunctionStack& stackTo) : from_(stackFrom), to_(stackTo) {}
0034 void operator()(const char&) const {
0035 to_.push_back(from_.back());
0036 from_.clear();
0037 }
0038
0039 private:
0040 FunctionStack& from_;
0041 FunctionStack& to_;
0042 };
0043 }
0044 }
0045
0046 #endif