1919#include < set>
2020#include < stack>
2121#include < unordered_map>
22+ #include " CommonConstants/MathConstants.h"
2223
2324using namespace o2 ::framework;
2425
@@ -29,9 +30,67 @@ void unknownParameterUsed(const char* name)
2930 runtime_error_f (" Unknown parameter used in expression: %s" , name);
3031}
3132
33+ // / a map between BasicOp and tokens in string expressions
34+ constexpr std::array<std::string_view, BasicOp::Conditional + 1 > mapping{
35+ " &&" ,
36+ " ||" ,
37+ " +" ,
38+ " -" ,
39+ " /" ,
40+ " *" ,
41+ " &" ,
42+ " |" ,
43+ " ^" ,
44+ " <" ,
45+ " <=" ,
46+ " >" ,
47+ " >=" ,
48+ " ==" ,
49+ " !=" ,
50+ " natan2" ,
51+ " npow" ,
52+ " nsqrt" ,
53+ " nexp" ,
54+ " nlog" ,
55+ " nlog10" ,
56+ " nsin" ,
57+ " ncos" ,
58+ " ntan" ,
59+ " nasin" ,
60+ " nacos" ,
61+ " natan" ,
62+ " nabs" ,
63+ " nround" ,
64+ " nbitwise_not" ,
65+ " ifnode" };
66+
67+ // / math constants to recognize in string expressions
68+ constexpr std::array<std::string_view, 9 > mathConstants{
69+ " Almost0" ,
70+ " Epsilon" ,
71+ " Almost1" ,
72+ " VeryBig" ,
73+ " PI" ,
74+ " TwoPI" ,
75+ " PIHalf" ,
76+ " PIThird" ,
77+ " PIQuarter" };
78+
79+ // / values of math constants to substiture
80+ constexpr std::array<float , 9 > mathConstantsValues{
81+ o2::constants::math::Almost0,
82+ o2::constants::math::Epsilon,
83+ o2::constants::math::Almost1,
84+ o2::constants::math::VeryBig,
85+ o2::constants::math::PI,
86+ o2::constants::math::TwoPI,
87+ o2::constants::math::PIHalf,
88+ o2::constants::math::PIThird,
89+ o2::constants::math::PIQuarter};
90+
3291// / a map between BasicOp and gandiva node definitions
3392// / note that logical 'and' and 'or' are created separately
34- static constexpr std::array<const char *, BasicOp::Conditional + 1 > basicOperationsMap = {
93+ constexpr std::array<const char *, BasicOp::Conditional + 1 > basicOperationsMap = {
3594 " and" ,
3695 " or" ,
3796 " add" ,
0 commit comments