Belle II Software development
AbstractNodes.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10#include <variant>
11#include <iostream>
12
13namespace Belle2 {
29 template<class AVariableManager>
31 public:
35 typedef typename AVariableManager::Object Object;
39 typedef typename AVariableManager::Var Var;
40
44 virtual bool check(const Object* p) const = 0;
48 virtual void print() const = 0;
52 virtual std::string decompile() const = 0;
57 };
58
65 template<class AVariableManager>
67 public:
71 typedef typename AVariableManager::Object Object;
75 typedef typename AVariableManager::Var Var;
76
80 virtual typename AVariableManager::VarVariant evaluate(const Object* p) const = 0;
84 virtual void print() const = 0;
88 virtual std::string decompile() const = 0;
93
94 };
95
100 enum class NodeType : int {
110 DoubleNode,
111 IntegerNode,
112 BooleanNode
113 };
114
119 enum class BooleanOperator : int {
120 AND,
121 OR
122 };
123
128 enum class ComparisonOperator : int {
129 EQUALEQUAL,
130 GREATEREQUAL,
131 LESSEQUAL,
132 GREATER,
133 LESS,
134 NOTEQUAL
135 };
136
141 enum class ArithmeticOperation : int {
142 PLUS,
143 MINUS,
144 PRODUCT,
145 DIVISION,
146 POWER
147 };
148
157 void injectBooleanOperatorToStream(std::ostream& stream, const BooleanOperator& boperator);
158
167 void injectComparisonOperatorToStream(std::ostream& stream, const ComparisonOperator& coperator);
168
177 void injectArithmeticOperatorToStream(std::ostream& stream, const ArithmeticOperation& aoperation);
178
180}
A parsed cut-string naturally has a tree shape which incorporates the infomation of operator preceden...
Definition: AbstractNodes.h:30
AVariableManager::Var Var
Template argument dependent Variable type definition.
Definition: AbstractNodes.h:39
virtual bool check(const Object *p) const =0
pure virtual check function, has to be overridden in derived class
virtual void print() const =0
pure virtual print function, has to be overridden in derived class
virtual ~AbstractBooleanNode()
Virtual destructor.
Definition: AbstractNodes.h:56
virtual std::string decompile() const =0
pure virtual decompile function, has to be overridden in derived class
AVariableManager::Object Object
Template argument dependent Particle type definition.
Definition: AbstractNodes.h:35
AbstractExpressionNode Superclass for all nodes which host expressions.
Definition: AbstractNodes.h:66
virtual ~AbstractExpressionNode()
Virtual destructor.
Definition: AbstractNodes.h:92
AVariableManager::Var Var
Template argument dependent Variable type definition.
Definition: AbstractNodes.h:75
virtual AVariableManager::VarVariant evaluate(const Object *p) const =0
pure virtual evaluate function, has to be overridden in derived class
virtual void print() const =0
pure virtual print function, has to be overridden in derived class
virtual std::string decompile() const =0
pure virtual decompile function, has to be overridden in derived class
AVariableManager::Object Object
Template argument dependent Particle type definition.
Definition: AbstractNodes.h:71
Nodeclass with two AbstractBooleanNode as children and a Boolean Operator (AND, OR) Check() method ev...
Definition: CutNodes.h:274
BinaryExpressionNode Node which connects two expression nodes with an arithemtic operation.
Definition: CutNodes.h:726
BooleanNode which has two AbstractExpressionNodes nodes and a ComparisonOperator.
Definition: CutNodes.h:427
FunctionNode Node class for handling MetaVariables in cuts.
Definition: CutNodes.h:1013
Class which stores the name of a variable.
Definition: CutNodes.h:941
BooleanNode which has three AbstractExpressionNodes nodes and two ComparisonOperator.
Definition: CutNodes.h:523
Nodeclass with a single AbstractBooleanNode as child.
Definition: CutNodes.h:198
UnaryExpressionNode Node class with a single expression node as child.
Definition: CutNodes.h:653
Nodeclass with a single AbstractExpressioNode as child.
Definition: CutNodes.h:351
void injectArithmeticOperatorToStream(std::ostream &stream, const ArithmeticOperation &aoperation)
Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members S...
NodeType
Enum of possible Nodes in parsing tree.
void injectComparisonOperatorToStream(std::ostream &stream, const ComparisonOperator &coperator)
Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members S...
void injectBooleanOperatorToStream(std::ostream &stream, const BooleanOperator &boperator)
Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members S...
ComparisonOperator
Enum for decoding the comparison operator type.
BooleanOperator
Enum for decoding the boolean operator type.
ArithmeticOperation
Enum for decoding the comparison operator type.
Abstract base class for different kinds of events.