Class ConditionEvaluator

Inheritance Relationships

Derived Types

Class Documentation

class ConditionEvaluator

Abstract base class for trigger condition evaluators.

Each evaluator implements a single condition type (e.g., OnChange, EnterRange). The evaluate() method determines whether a trigger should fire based on the previous and current values of a monitored resource.

SOVD defines 4 standard condition types. Plugins can register custom evaluators via the ConditionRegistry using vendor-specific “x-” prefixed names.

Subclassed by ros2_medkit_gateway::EnterRangeEvaluator, ros2_medkit_gateway::LeaveRangeEvaluator, ros2_medkit_gateway::OnChangeEvaluator, ros2_medkit_gateway::OnChangeToEvaluator

Public Functions

virtual ~ConditionEvaluator() = default
virtual bool evaluate(const std::optional<nlohmann::json> &previous, const nlohmann::json &current, const nlohmann::json &params) const = 0

Evaluate whether the condition is met.

Parameters:
  • previous – The previous value (nullopt on first evaluation)

  • current – The current value

  • params – Condition-specific parameters (e.g., target_value, bounds)

Pre:

validate_params(params) must have returned success before calling evaluate.

Returns:

true if the condition is met and the trigger should fire

virtual tl::expected<void, std::string> validate_params(const nlohmann::json &params) const = 0

Validate condition parameters before a trigger is created.

Parameters:

params – The parameters to validate

Returns:

void on success, error string on failure