Belle II Software light-2406-ragdoll
|
Wraps a condition set on a Module instance. More...
#include <ModuleCondition.h>
Public Types | |
enum | EConditionOperators { c_GT , c_ST , c_GE , c_SE , c_EQ , c_NE } |
The supported condition operators. More... | |
enum class | EAfterConditionPath { c_End , c_Continue } |
Different options for behaviour after a conditional path was executed. More... | |
Public Member Functions | |
ModuleCondition (std::string expression, std::shared_ptr< Path > conditionPath, EAfterConditionPath afterConditionPath) | |
initialize from string expression (see class doc). | |
~ModuleCondition ()=default | |
Destructor, nothing to see here. | |
ModuleCondition (const ModuleCondition &other)=default | |
default copy constructor. | |
ModuleCondition & | operator= (const ModuleCondition &other)=default |
and default assignment operator | |
bool | evaluate (int value) const |
evaluate the condition using the given value. | |
const std::shared_ptr< Path > & | getPath () const |
Returns the path of the condition. | |
int | getConditionValue () const |
Returns the value of the condition. | |
EConditionOperators | getConditionOperator () const |
Returns the value of the condition. | |
EAfterConditionPath | getAfterConditionPath () const |
What to do after a conditional path is finished. | |
std::string | getString () const |
A string representation of this condition. | |
Static Public Member Functions | |
static void | exposePythonAPI () |
Exposes methods of the ModuleCondition class to Python. | |
Private Member Functions | |
ModuleCondition ()=delete | |
no default constructed objects. | |
Private Attributes | |
std::shared_ptr< Path > | m_conditionPath |
The path which which will be executed if the condition is evaluated to true. | |
EConditionOperators | m_conditionOperator |
The operator of the condition (set by parsing the condition expression). | |
int | m_conditionValue |
Numeric value used in the condition (set by parsing the condition expression). | |
EAfterConditionPath | m_afterConditionPath |
What to do after a conditional path is finished. | |
Wraps a condition set on a Module instance.
It supports conditions of the form [comparison operator][integer] e.g. ">5", "=7", "!= 0"
Additional spaces in front of the operator, between operator and integer number and after the integer number are allowed.
Supported operators are: "> , < , = , == , >= , <= , !="
Definition at line 29 of file ModuleCondition.h.
|
strong |
Different options for behaviour after a conditional path was executed.
Enumerator | |
---|---|
c_End | End current event after the conditional path. |
c_Continue | After the conditional path, resume execution after this module. |
Definition at line 42 of file ModuleCondition.h.
enum EConditionOperators |
The supported condition operators.
Enumerator | |
---|---|
c_GT | Greater than: ">" |
c_ST | Smaller than: "<" |
c_GE | Greater or equal than: ">=". |
c_SE | Smaller or equal than: "<=". |
c_EQ | Equal: "=" or "==" |
c_NE | Not equal: "!=". |
Definition at line 32 of file ModuleCondition.h.
ModuleCondition | ( | std::string | expression, |
std::shared_ptr< Path > | conditionPath, | ||
EAfterConditionPath | afterConditionPath | ||
) |
initialize from string expression (see class doc).
Throws runtime_error if expression is invalid.
bool evaluate | ( | int | value | ) | const |
evaluate the condition using the given value.
E.g. for a condition ">5", this would return "value>5"
Definition at line 57 of file ModuleCondition.cc.
|
static |
Exposes methods of the ModuleCondition class to Python.
Definition at line 93 of file ModuleCondition.cc.
|
inline |
What to do after a conditional path is finished.
Definition at line 69 of file ModuleCondition.h.
|
inline |
|
inline |
|
inline |
Returns the path of the condition.
Definition at line 60 of file ModuleCondition.h.
std::string getString | ( | ) | const |
A string representation of this condition.
Definition at line 70 of file ModuleCondition.cc.
|
private |
What to do after a conditional path is finished.
Definition at line 86 of file ModuleCondition.h.
|
private |
The operator of the condition (set by parsing the condition expression).
Definition at line 84 of file ModuleCondition.h.
|
private |
The path which which will be executed if the condition is evaluated to true.
Definition at line 83 of file ModuleCondition.h.
|
private |
Numeric value used in the condition (set by parsing the condition expression).
Definition at line 85 of file ModuleCondition.h.