Abstract base class that defines the interface for all rule evaluation strategies.
More...
#include <Strategy.hpp>
|
| virtual std::string | whoAmI ()=0 |
| | Returns the rule type name (e.g. "SimpleRule").
|
| |
| virtual int | getConsecutive () const |
| |
| virtual double | getLastValue () |
| |
| virtual void | setConsecutive (int) |
| |
| virtual void | setLastValue (double) |
| |
| virtual bool | hasPrevious () const |
| |
| virtual int | evaluate (const std::variant< double, std::string > &v) |
| | Evaluates the rule based on a sensor measurement or error state.
|
| |
| virtual int | evaluate (const ResultMap &results) |
| | Evaluates correlation rules based on the results of other primary rules.
|
| |
| virtual | ~RuleStrategy ()=default |
| | Virtual destructor for safe polymorphic deletion.
|
| |
| const std::string & | id () const |
| | Gets the unique identifier of the rule.
|
| |
| const std::string & | priority () const |
| | Gets the priority level of the rule.
|
| |
|
| static bool | compare (double left, double right, const std::string &op) |
| | A static helper function to perform logical comparisons.
|
| |
|
| std::string | rule_id |
| | The unique identifier for this rule instance.
|
| |
| std::string | rule_priority |
| | The execution priority of this rule.
|
| |
Abstract base class that defines the interface for all rule evaluation strategies.
◆ ~RuleStrategy()
| virtual RuleStrategy::~RuleStrategy |
( |
| ) |
|
|
virtualdefault |
Virtual destructor for safe polymorphic deletion.
◆ compare()
| static bool RuleStrategy::compare |
( |
double |
left, |
|
|
double |
right, |
|
|
const std::string & |
op |
|
) |
| |
|
inlinestaticprotected |
A static helper function to perform logical comparisons.
Uses a static map shared by all rule instances for operator lookup.
- Parameters
-
| left | The left operand (e.g., the sensor measurement). |
| right | The right operand (e.g., the threshold value). |
| op | The comparison operator as a string (e.g., ">", "<", "=="). |
- Returns
- true if the comparison evaluates to true, false otherwise (or if operator is unknown).
◆ evaluate() [1/2]
| virtual int RuleStrategy::evaluate |
( |
const ResultMap & |
results | ) |
|
|
inlinevirtual |
Evaluates correlation rules based on the results of other primary rules.
- Parameters
-
| results | A map containing the boolean results of other evaluated rules. |
- Returns
- int 1 if the correlation rule is satisfied, 0 otherwise.
Reimplemented in CorrelationRule.
◆ evaluate() [2/2]
| virtual int RuleStrategy::evaluate |
( |
const std::variant< double, std::string > & |
v | ) |
|
|
inlinevirtual |
Evaluates the rule based on a sensor measurement or error state.
- Parameters
-
| v | A variant containing either a valid double reading or a string representing an error state. |
- Returns
- int 1 if the rule is satisfied, 0 otherwise.
Reimplemented in SimpleRule, StatefulRule, and StepDifferenceRule.
◆ getConsecutive()
| virtual int RuleStrategy::getConsecutive |
( |
| ) |
const |
|
inlinevirtual |
◆ getLastValue()
| virtual double RuleStrategy::getLastValue |
( |
| ) |
|
|
inlinevirtual |
◆ hasPrevious()
| virtual bool RuleStrategy::hasPrevious |
( |
| ) |
const |
|
inlinevirtual |
◆ id()
| const std::string & RuleStrategy::id |
( |
| ) |
const |
|
inline |
Gets the unique identifier of the rule.
- Returns
- const std::string& The rule ID.
◆ priority()
| const std::string & RuleStrategy::priority |
( |
| ) |
const |
|
inline |
Gets the priority level of the rule.
- Returns
- const std::string& The rule priority (e.g., "HIGH", "MEDIUM", "LOW").
◆ setConsecutive()
| virtual void RuleStrategy::setConsecutive |
( |
int |
| ) |
|
|
inlinevirtual |
◆ setLastValue()
| virtual void RuleStrategy::setLastValue |
( |
double |
| ) |
|
|
inlinevirtual |
◆ whoAmI()
| virtual std::string RuleStrategy::whoAmI |
( |
| ) |
|
|
pure virtual |
◆ rule_id
| std::string RuleStrategy::rule_id |
|
protected |
The unique identifier for this rule instance.
◆ rule_priority
| std::string RuleStrategy::rule_priority |
|
protected |
The execution priority of this rule.
The documentation for this class was generated from the following file: