diff --git a/Framework/Core/include/Framework/BasicOps.h b/Framework/Core/include/Framework/BasicOps.h index 306a1ec99175d..06880de275b9e 100644 --- a/Framework/Core/include/Framework/BasicOps.h +++ b/Framework/Core/include/Framework/BasicOps.h @@ -81,8 +81,7 @@ static constexpr std::array mapping{ "nabs", "nround", "nbitwise_not", - "ifnode" -}; + "ifnode"}; static constexpr std::array mathConstants{ "Almost0", @@ -93,8 +92,7 @@ static constexpr std::array mathConstants{ "TwoPI", "PIHalf", "PIThird", - "PIQuarter" -}; + "PIQuarter"}; static constexpr std::array mathConstantsValues{ o2::constants::math::Almost0, @@ -105,8 +103,7 @@ static constexpr std::array mathConstantsValues{ o2::constants::math::TwoPI, o2::constants::math::PIHalf, o2::constants::math::PIThird, - o2::constants::math::PIQuarter -}; + o2::constants::math::PIQuarter}; } // namespace o2::framework #endif // O2_FRAMEWORK_BASICOPS_H_ diff --git a/Framework/Core/include/Framework/Expressions.h b/Framework/Core/include/Framework/Expressions.h index a7c0685640058..6568f5d58c421 100644 --- a/Framework/Core/include/Framework/Expressions.h +++ b/Framework/Core/include/Framework/Expressions.h @@ -114,7 +114,6 @@ struct LiteralNode { : value{-1}, type{atype::INT32} { - } template LiteralNode(T v) : value{v}, type{selectArrowType()} @@ -146,7 +145,7 @@ struct BindingNode { /// An expression tree node corresponding to binary or unary operation struct OpNode { OpNode() : op{BasicOp::Abs} {} - OpNode(BasicOp op_) : op{op_} {} + OpNode(BasicOp op_) : op{op_} {} BasicOp op; }; @@ -352,52 +351,52 @@ concept arithmetic = std::is_arithmetic_v; /// overloaded operators to build the tree from an expression -#define BINARY_OP_NODES(_operator_, _operation_) \ - inline Node operator _operator_(Node&& left, Node&& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, std::forward(left), std::forward(right)}; \ - } \ - template \ - inline Node operator _operator_(Node&& left, T right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, std::forward(left), LiteralNode{right}}; \ - } \ - template \ - inline Node operator _operator_(T left, Node&& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, LiteralNode{left}, std::forward(right)}; \ - } \ - template \ - inline Node operator _operator_(Node&& left, Configurable const& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, std::forward(left), PlaceholderNode{right}}; \ - } \ - template \ - inline Node operator _operator_(Configurable const& left, Node&& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, PlaceholderNode{left}, std::forward(right)}; \ - } \ - inline Node operator _operator_(BindingNode const& left, BindingNode const& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, left, right}; \ - } \ - inline Node operator _operator_(BindingNode const& left, Node&& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, left, std::forward(right)}; \ - } \ - inline Node operator _operator_(Node&& left, BindingNode const& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, std::forward(left), right}; \ - } \ - template \ - inline Node operator _operator_(Configurable const& left, BindingNode const& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, PlaceholderNode{left}, right}; \ - } \ - template \ - inline Node operator _operator_(BindingNode const& left, Configurable const& right) \ - { \ - return Node{OpNode{BasicOp::_operation_}, left, PlaceholderNode{right}}; \ +#define BINARY_OP_NODES(_operator_, _operation_) \ + inline Node operator _operator_(Node&& left, Node&& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, std::forward(left), std::forward(right)}; \ + } \ + template \ + inline Node operator _operator_(Node&& left, T right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, std::forward(left), LiteralNode{right}}; \ + } \ + template \ + inline Node operator _operator_(T left, Node&& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, LiteralNode{left}, std::forward(right)}; \ + } \ + template \ + inline Node operator _operator_(Node&& left, Configurable const& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, std::forward(left), PlaceholderNode{right}}; \ + } \ + template \ + inline Node operator _operator_(Configurable const& left, Node&& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, PlaceholderNode{left}, std::forward(right)}; \ + } \ + inline Node operator _operator_(BindingNode const& left, BindingNode const& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, left, right}; \ + } \ + inline Node operator _operator_(BindingNode const& left, Node&& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, left, std::forward(right)}; \ + } \ + inline Node operator _operator_(Node&& left, BindingNode const& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, std::forward(left), right}; \ + } \ + template \ + inline Node operator _operator_(Configurable const& left, BindingNode const& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, PlaceholderNode{left}, right}; \ + } \ + template \ + inline Node operator _operator_(BindingNode const& left, Configurable const& right) \ + { \ + return Node{OpNode{BasicOp::_operation_}, left, PlaceholderNode{right}}; \ } BINARY_OP_NODES(&, BitwiseAnd); @@ -423,55 +422,55 @@ inline Node npow(Node&& left, T right) return Node{OpNode{BasicOp::Power}, std::forward(left), LiteralNode{right}}; } -#define BINARY_FUNC_NODES(_func_, _node_) \ - template \ - inline Node _node_(L left, R right) \ - { \ - return Node{OpNode{BasicOp::_func_}, LiteralNode{left}, LiteralNode{right}}; \ - } \ - \ - inline Node _node_(Node&& left, Node&& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, std::forward(left), std::forward(right)}; \ - } \ - \ - inline Node _node_(Node&& left, BindingNode const& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, std::forward(left), right}; \ - } \ - \ - inline Node _node_(BindingNode const& left, BindingNode const& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, left, right}; \ - } \ - \ - inline Node _node_(BindingNode const& left, Node&& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, left, std::forward(right)}; \ - } \ - \ - template \ - inline Node _node_(Node&& left, Configurable const& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, std::forward(left), PlaceholderNode{right}}; \ - } \ - \ - template \ - inline Node _node_(Configurable const& left, Node&& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, PlaceholderNode{left}, std::forward(right)}; \ - } \ - \ - template \ - inline Node _node_(BindingNode const& left, Configurable const& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, left, PlaceholderNode{right}}; \ - } \ - \ - template \ - inline Node _node_(Configurable const& left, BindingNode const& right) \ - { \ - return Node{OpNode{BasicOp::_func_}, PlaceholderNode{left}, right}; \ +#define BINARY_FUNC_NODES(_func_, _node_) \ + template \ + inline Node _node_(L left, R right) \ + { \ + return Node{OpNode{BasicOp::_func_}, LiteralNode{left}, LiteralNode{right}}; \ + } \ + \ + inline Node _node_(Node&& left, Node&& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, std::forward(left), std::forward(right)}; \ + } \ + \ + inline Node _node_(Node&& left, BindingNode const& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, std::forward(left), right}; \ + } \ + \ + inline Node _node_(BindingNode const& left, BindingNode const& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, left, right}; \ + } \ + \ + inline Node _node_(BindingNode const& left, Node&& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, left, std::forward(right)}; \ + } \ + \ + template \ + inline Node _node_(Node&& left, Configurable const& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, std::forward(left), PlaceholderNode{right}}; \ + } \ + \ + template \ + inline Node _node_(Configurable const& left, Node&& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, PlaceholderNode{left}, std::forward(right)}; \ + } \ + \ + template \ + inline Node _node_(BindingNode const& left, Configurable const& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, left, PlaceholderNode{right}}; \ + } \ + \ + template \ + inline Node _node_(Configurable const& left, BindingNode const& right) \ + { \ + return Node{OpNode{BasicOp::_func_}, PlaceholderNode{left}, right}; \ } BINARY_FUNC_NODES(Atan2, natan2); @@ -736,10 +735,9 @@ struct Tokenizer { char peek(); }; -struct Parser -{ +struct Parser { static Node parse(std::string const& input); - static std::unique_ptr parsePrimary(Tokenizer & tk); + static std::unique_ptr parsePrimary(Tokenizer& tk); static std::unique_ptr parseTier1(Tokenizer& tk); static std::unique_ptr parseTier2(Tokenizer& tk); static std::unique_ptr parseTier3(Tokenizer& tk); diff --git a/Framework/Core/src/Expressions.cxx b/Framework/Core/src/Expressions.cxx index b588229f6c493..3e52d49dfa4bb 100644 --- a/Framework/Core/src/Expressions.cxx +++ b/Framework/Core/src/Expressions.cxx @@ -1102,7 +1102,7 @@ std::unique_ptr Parser::parseBase(Tokenizer& tk) if (tk.currentToken != '(') { // binding node or a constant std::string binding = id; auto posc = std::find(mathConstants.begin(), mathConstants.end(), id); - if (posc != mathConstants.end()) { //constant + if (posc != mathConstants.end()) { // constant return std::make_unique(LiteralNode{mathConstantsValues[std::distance(mathConstants.begin(), posc)]}); } // binding node @@ -1161,7 +1161,7 @@ std::unique_ptr Parser::parseBase(Tokenizer& tk) // number if (tk.currentToken == Token::FloatNumber) { tk.nextToken(); - switch(tk.FloatValue.index()) { + switch (tk.FloatValue.index()) { case 0: return std::make_unique(LiteralNode{get<0>(tk.FloatValue)}); case 1: @@ -1170,7 +1170,7 @@ std::unique_ptr Parser::parseBase(Tokenizer& tk) } if (tk.currentToken == Token::IntegerNumber) { tk.nextToken(); - switch(tk.IntegerValue.index()) { + switch (tk.IntegerValue.index()) { case 0: return std::make_unique(LiteralNode{get<0>(tk.IntegerValue)}); case 1: