Belle II Software  release-05-02-19
ModuleCondition.h
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
6 namespace Belle2 {
11  class Path;
23  public:
26  c_GT,
27  c_ST,
28  c_GE,
29  c_SE,
30  c_EQ,
32  };
33 
35  enum class EAfterConditionPath {
36  c_End,
37  c_Continue,
38  };
39 
41  ModuleCondition(std::string expression, std::shared_ptr<Path> conditionPath, EAfterConditionPath afterConditionPath);
43  ~ModuleCondition() = default;
45  ModuleCondition(const ModuleCondition& other) = default;
47  ModuleCondition& operator=(const ModuleCondition& other) = default;
48 
50  bool evaluate(int value) const;
51 
53  const std::shared_ptr<Path>& getPath() const {return m_conditionPath; }
54 
56  int getConditionValue() const {return m_conditionValue; }
57 
60 
63 
65  std::string getString() const;
66 
70  static void exposePythonAPI();
71 
72  private:
74  ModuleCondition() = delete;
75 
76  std::shared_ptr<Path> m_conditionPath;
80  };
82 }
Belle2::ModuleCondition::c_SE
@ c_SE
Smaller or equal than: "<=".
Definition: ModuleCondition.h:29
Belle2::ModuleCondition::getAfterConditionPath
EAfterConditionPath getAfterConditionPath() const
What to do after a conditional path is finished.
Definition: ModuleCondition.h:62
Belle2::ModuleCondition::c_EQ
@ c_EQ
Equal: "=" or "=="
Definition: ModuleCondition.h:30
Belle2::ModuleCondition::getString
std::string getString() const
A string representation of this condition.
Definition: ModuleCondition.cc:63
Belle2::ModuleCondition::EConditionOperators
EConditionOperators
The supported condition operators.
Definition: ModuleCondition.h:25
Belle2::ModuleCondition::getConditionOperator
EConditionOperators getConditionOperator() const
Returns the value of the condition.
Definition: ModuleCondition.h:59
Belle2::ModuleCondition::EAfterConditionPath::c_End
@ c_End
End current event after the conditional path.
Belle2::ModuleCondition::m_conditionOperator
EConditionOperators m_conditionOperator
The operator of the condition (set by parsing the condition expression).
Definition: ModuleCondition.h:77
Belle2::ModuleCondition::m_conditionPath
std::shared_ptr< Path > m_conditionPath
The path which which will be executed if the condition is evaluated to true.
Definition: ModuleCondition.h:76
Belle2::ModuleCondition::c_NE
@ c_NE
Not equal: "!=".
Definition: ModuleCondition.h:31
Belle2::ModuleCondition::exposePythonAPI
static void exposePythonAPI()
Exposes methods of the ModuleCondition class to Python.
Definition: ModuleCondition.cc:86
Belle2::ModuleCondition::c_GE
@ c_GE
Greater or equal than: ">=".
Definition: ModuleCondition.h:28
Belle2::ModuleCondition::EAfterConditionPath::c_Continue
@ c_Continue
After the conditional path, resume execution after this module.
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ModuleCondition::operator=
ModuleCondition & operator=(const ModuleCondition &other)=default
and default assignment operator
Belle2::ModuleCondition::evaluate
bool evaluate(int value) const
evaluate the condition using the given value.
Definition: ModuleCondition.cc:50
Belle2::ModuleCondition::ModuleCondition
ModuleCondition()=delete
no default constructed objects.
Belle2::ModuleCondition::getConditionValue
int getConditionValue() const
Returns the value of the condition.
Definition: ModuleCondition.h:56
Belle2::ModuleCondition::EAfterConditionPath
EAfterConditionPath
Different options for behaviour after a conditional path was executed.
Definition: ModuleCondition.h:35
Belle2::ModuleCondition::getPath
const std::shared_ptr< Path > & getPath() const
Returns the path of the condition.
Definition: ModuleCondition.h:53
Belle2::ModuleCondition::m_afterConditionPath
EAfterConditionPath m_afterConditionPath
What to do after a conditional path is finished.
Definition: ModuleCondition.h:79
Belle2::ModuleCondition::c_GT
@ c_GT
Greater than: ">"
Definition: ModuleCondition.h:26
Belle2::ModuleCondition
Wraps a condition set on a Module instance.
Definition: ModuleCondition.h:22
Belle2::ModuleCondition::m_conditionValue
int m_conditionValue
Numeric value used in the condition (set by parsing the condition expression).
Definition: ModuleCondition.h:78
Belle2::ModuleCondition::~ModuleCondition
~ModuleCondition()=default
Destructor, nothing to see here.
Belle2::ModuleCondition::c_ST
@ c_ST
Smaller than: "<"
Definition: ModuleCondition.h:27