![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Stateless evaluator for structured Condition expressions. More...
#include <ConditionEvaluator.h>
Static Public Member Functions | |
| static bool | EvaluateAll (const std::vector< Condition > &conditions, const LocalBlackboard &localBB, const std::unordered_map< std::string, TaskValue > &dataPinCache, int32_t nodeID) |
| Evaluates all conditions (implicit AND) on a Branch/While node. | |
| static bool | EvaluateCondition (const Condition &cond, const LocalBlackboard &localBB, const std::unordered_map< std::string, TaskValue > &dataPinCache, int32_t nodeID) |
| Evaluates a single Condition. | |
| static bool | GetConditionValue (const std::string &mode, const std::string &pin, const std::string &variable, const TaskValue &constValue, const LocalBlackboard &localBB, const std::unordered_map< std::string, TaskValue > &dataPinCache, int32_t nodeID, TaskValue &outValue) |
| Resolves the TaskValue for one side of a condition. | |
| static bool | CompareValues (const TaskValue &left, const TaskValue &right, const std::string &op, int32_t nodeID) |
| Compares two TaskValues using the given operator. | |
Private Member Functions | |
| ConditionEvaluator ()=delete | |
Static Private Member Functions | |
| static bool | ParsePinRef (const std::string &pinRef, int32_t &outNodeID, std::string &outPinName) |
| Parses "Node#42.Out" -> nodeID=42, pinName="Out". | |
Stateless evaluator for structured Condition expressions.
All methods are static. Call EvaluateAll() with the full conditions list from a TaskNodeDefinition to compute the implicit-AND result.
Pin values are looked up in the DataPinCache map (keyed as "nodeID:pinName"). The pin field format is "Node#<id>.<pinName>", e.g. "Node#42.Out".
Definition at line 45 of file ConditionEvaluator.h.
|
privatedelete |
|
static |
Compares two TaskValues using the given operator.
Supported operators: "==", "!=", "<", ">", "<=", ">=". If types differ, attempts Int->Float promotion. On unresolvable mismatch logs WARNING and returns false.
| left | Left-hand value. |
| right | Right-hand value. |
| op | Operator string. |
| nodeID | Node ID for logging. |
Definition at line 170 of file ConditionEvaluator.cpp.
References Olympe::TaskValue::AsBool(), Olympe::TaskValue::AsFloat(), Olympe::TaskValue::AsInt(), Olympe::TaskValue::AsString(), Olympe::TaskValue::AsVector(), Olympe::Bool, Olympe::Float, GetComponentTypeID_Static(), Olympe::TaskValue::GetType(), Olympe::Int, Olympe::String, SYSTEM_LOG, and Olympe::Vector.
Referenced by EvaluateCondition().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Evaluates all conditions (implicit AND) on a Branch/While node.
| conditions | The conditions list from the node definition. |
| localBB | The entity's local blackboard (for Variable mode). |
| dataPinCache | Frame-local data pin cache (for Pin mode). |
| nodeID | Node ID used in log messages. |
Definition at line 24 of file ConditionEvaluator.cpp.
References EvaluateCondition(), and GetComponentTypeID_Static().
Referenced by Olympe::VSGraphExecutor::HandleBranch().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Evaluates a single Condition.
| cond | The condition to evaluate. |
| localBB | The entity's local blackboard. |
| dataPinCache | Frame-local data pin cache. |
| nodeID | Node ID for log context. |
Definition at line 46 of file ConditionEvaluator.cpp.
References CompareValues(), GetComponentTypeID_Static(), GetConditionValue(), and SYSTEM_LOG.
Referenced by EvaluateAll().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Resolves the TaskValue for one side of a condition.
| mode | "Pin", "Variable", or "Const". |
| pin | Pin reference string (mode == "Pin"). |
| variable | Variable name (mode == "Variable"). |
| constValue | Literal value (mode == "Const"). |
| localBB | Local blackboard. |
| dataPinCache | Data pin cache. |
| nodeID | Node ID for logging. |
| outValue | Output value (only valid when return is true). |
Definition at line 81 of file ConditionEvaluator.cpp.
References GetComponentTypeID_Static(), ParsePinRef(), and SYSTEM_LOG.
Referenced by EvaluateCondition().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Parses "Node#42.Out" -> nodeID=42, pinName="Out".
Returns false if the format is not recognised.
Definition at line 265 of file ConditionEvaluator.cpp.
References GetComponentTypeID_Static().
Referenced by GetConditionValue().
Here is the call graph for this function:
Here is the caller graph for this function: