Belle II Software light-2406-ragdoll
ModuleCondition.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#pragma once
9
10#include <memory>
11#include <string>
12
13namespace Belle2 {
18 class Path;
30 public:
38 c_NE
39 };
40
43 c_End,
45 };
46
48 ModuleCondition(std::string expression, std::shared_ptr<Path> conditionPath, EAfterConditionPath afterConditionPath);
50 ~ModuleCondition() = default;
52 ModuleCondition(const ModuleCondition& other) = default;
54 ModuleCondition& operator=(const ModuleCondition& other) = default;
55
57 bool evaluate(int value) const;
58
60 const std::shared_ptr<Path>& getPath() const {return m_conditionPath; }
61
63 int getConditionValue() const {return m_conditionValue; }
64
67
70
72 std::string getString() const;
73
77 static void exposePythonAPI();
78
79 private:
81 ModuleCondition() = delete;
82
83 std::shared_ptr<Path> m_conditionPath;
87 };
89}
Wraps a condition set on a Module instance.
bool evaluate(int value) const
evaluate the condition using the given value.
ModuleCondition(std::string expression, std::shared_ptr< Path > conditionPath, EAfterConditionPath afterConditionPath)
initialize from string expression (see class doc).
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).
EConditionOperators
The supported condition operators.
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">"
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "=="
@ c_ST
Smaller than: "<"
std::string getString() const
A string representation of this condition.
EAfterConditionPath
Different options for behaviour after a conditional path was executed.
@ c_End
End current event after the conditional path.
@ c_Continue
After the conditional path, resume execution after this module.
EAfterConditionPath m_afterConditionPath
What to do after a conditional path is finished.
EConditionOperators getConditionOperator() const
Returns the value of the condition.
int m_conditionValue
Numeric value used in the condition (set by parsing the condition expression).
const std::shared_ptr< Path > & getPath() const
Returns the path of the condition.
~ModuleCondition()=default
Destructor, nothing to see here.
int getConditionValue() const
Returns the value of the condition.
EAfterConditionPath getAfterConditionPath() const
What to do after a conditional path is finished.
static void exposePythonAPI()
Exposes methods of the ModuleCondition class to Python.
ModuleCondition & operator=(const ModuleCondition &other)=default
and default assignment operator
ModuleCondition(const ModuleCondition &other)=default
default copy constructor.
ModuleCondition()=delete
no default constructed objects.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24