![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Simulates blueprint graph execution for validation purposes. More...
#include <GraphExecutionSimulator.h>
Public Member Functions | |
| GraphExecutionSimulator () | |
| ~GraphExecutionSimulator () | |
| std::vector< ValidationError > | SimulateExecution (const TaskGraphTemplate &tmpl, const SimulationOptions &options, GraphExecutionTracer &outTracer) |
| Simulates execution of a graph template. | |
| bool | ValidateAllBranches (const TaskGraphTemplate &tmpl, std::vector< ValidationError > &outErrors) |
| Validates all branch nodes in a graph. | |
| bool | ValidateDataConnections (const TaskGraphTemplate &tmpl, std::vector< ValidationError > &outErrors) |
| Validates all data connections in a graph. | |
| std::vector< int32_t > | FindUnreachableNodes (const TaskGraphTemplate &tmpl, std::vector< ValidationError > &outErrors) |
| Checks for unreachable nodes. | |
| bool | DetectPotentialInfiniteLoops (const TaskGraphTemplate &tmpl, std::vector< ValidationError > &outErrors) |
| Checks for potential infinite loops or cycles. | |
Private Attributes | |
| std::map< int32_t, int32_t > | m_visitCount |
| Track visits per node to detect loops. | |
| std::vector< int32_t > | m_pathStack |
| Current execution path. | |
| std::set< int32_t > | m_tracedDataNodes |
| Track data nodes already traced to prevent infinite recursion. | |
Simulates blueprint graph execution for validation purposes.
Simulates graph execution to detect:
The simulator does NOT execute actual AtomicTasks or modify runtime state.
Definition at line 61 of file GraphExecutionSimulator.h.
| Olympe::GraphExecutionSimulator::GraphExecutionSimulator | ( | ) |
Definition at line 17 of file GraphExecutionSimulator.cpp.
| Olympe::GraphExecutionSimulator::~GraphExecutionSimulator | ( | ) |
Definition at line 21 of file GraphExecutionSimulator.cpp.
|
private |
Definition at line 470 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), and MarkReachableNodes().
Here is the call graph for this function:| bool Olympe::GraphExecutionSimulator::DetectPotentialInfiniteLoops | ( | const TaskGraphTemplate & | tmpl, |
| std::vector< ValidationError > & | outErrors | ||
| ) |
Checks for potential infinite loops or cycles.
| tmpl | The TaskGraphTemplate to check. |
| outErrors | [out] Vector to append validation errors to. |
Definition at line 435 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), GetNextNodeId(), Olympe::NODE_INDEX_NONE, Olympe::Warning, and Olympe::While.
Here is the call graph for this function:| std::vector< int32_t > Olympe::GraphExecutionSimulator::FindUnreachableNodes | ( | const TaskGraphTemplate & | tmpl, |
| std::vector< ValidationError > & | outErrors | ||
| ) |
Checks for unreachable nodes.
| tmpl | The TaskGraphTemplate to check. |
| outErrors | [out] Vector to append validation errors to. |
Definition at line 381 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), MarkReachableNodes(), and Olympe::Warning.
Referenced by SimulateExecution().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Gets the next node ID from an execution link.
| tmpl | The template. |
| nodeId | Source node ID. |
| pinName | Execution output pin name. |
Definition at line 305 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), and Olympe::NODE_INDEX_NONE.
Referenced by DetectPotentialInfiniteLoops(), HandleBranchSimulation(), HandleSequenceSimulation(), HandleSwitchSimulation(), HandleWhileSimulation(), SimulateExecution(), and ValidateAllBranches().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Simulates a Branch node execution.
Definition at line 234 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), GetNextNodeId(), and Olympe::NODE_INDEX_NONE.
Referenced by SimulateExecution().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Simulates a Sequence node execution.
Definition at line 277 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), GetNextNodeId(), and Olympe::NODE_INDEX_NONE.
Referenced by SimulateExecution().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Simulates a Switch node execution.
Definition at line 262 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), GetNextNodeId(), and Olympe::NODE_INDEX_NONE.
Referenced by SimulateExecution().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Simulates a While loop execution.
Definition at line 290 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), GetNextNodeId(), and Olympe::NODE_INDEX_NONE.
Referenced by SimulateExecution().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 416 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), and MarkReachableNodes().
Referenced by BuildNodeReachabilityMap(), FindUnreachableNodes(), and MarkReachableNodes().
Here is the call graph for this function:
Here is the caller graph for this function:| std::vector< ValidationError > Olympe::GraphExecutionSimulator::SimulateExecution | ( | const TaskGraphTemplate & | tmpl, |
| const SimulationOptions & | options, | ||
| GraphExecutionTracer & | outTracer | ||
| ) |
Simulates execution of a graph template.
| tmpl | The TaskGraphTemplate to simulate. |
| options | Simulation configuration options. |
| outTracer | [out] The execution tracer containing results. |
Definition at line 25 of file GraphExecutionSimulator.cpp.
References Olympe::AtomicTask, Olympe::Branch, Olympe::Critical, Olympe::Delay, Olympe::DoOnce, Olympe::EntryPoint, Olympe::Error, FindUnreachableNodes(), Olympe::GetBBValue, GetComponentTypeID_Static(), GetNextNodeId(), HandleBranchSimulation(), HandleSequenceSimulation(), HandleSwitchSimulation(), HandleWhileSimulation(), Olympe::Literal, m_pathStack, m_tracedDataNodes, m_visitCount, Olympe::MathOp, Olympe::NODE_INDEX_NONE, Olympe::SetBBValue, Olympe::SubGraph, Olympe::Switch, TraceDataPinEvaluation(), ValidateAllBranches(), ValidateDataConnections(), Olympe::VSSequence, Olympe::Warning, and Olympe::While.
Referenced by Olympe::ExecutionTestPanel::RunExecutionTest().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 220 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), and Olympe::NODE_INDEX_NONE.
Here is the call graph for this function:
|
private |
Traces evaluation of a single data connection.
| sourceNodeId | Node providing the data. |
| sourcePinName | Name of the output pin. |
| targetNodeId | Node receiving the data. |
| targetPinName | Name of the input pin. |
| tmpl | The task graph template. |
| tracer | Execution tracer to record events. |
| depth | Current recursion depth. |
Definition at line 593 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static(), and TraceDataPinEvaluation().
Referenced by TraceDataPinEvaluation().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Recursively traces data pin evaluation for pure data nodes.
Evaluates and traces all incoming data pins of a node, and recursively traces their source nodes.
| nodeId | Node to trace data pins for. |
| tmpl | The task graph template. |
| tracer | Execution tracer to record events. |
| depth | Current recursion depth. |
Definition at line 484 of file GraphExecutionSimulator.cpp.
References Olympe::GetBBValue, GetComponentTypeID_Static(), m_tracedDataNodes, Olympe::MathOp, Olympe::NODE_INDEX_NONE, Olympe::SetBBValue, and TraceDataConnection().
Referenced by SimulateExecution(), and TraceDataConnection().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Olympe::GraphExecutionSimulator::ValidateAllBranches | ( | const TaskGraphTemplate & | tmpl, |
| std::vector< ValidationError > & | outErrors | ||
| ) |
Validates all branch nodes in a graph.
| tmpl | The TaskGraphTemplate to validate. |
| outErrors | [out] Vector to append validation errors to. |
Definition at line 325 of file GraphExecutionSimulator.cpp.
References Olympe::Branch, Olympe::Error, GetComponentTypeID_Static(), GetNextNodeId(), and Olympe::NODE_INDEX_NONE.
Referenced by SimulateExecution().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Validates a condition expression.
| nodeId | Node containing the condition. |
| expression | Condition text to validate. |
Definition at line 460 of file GraphExecutionSimulator.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:| bool Olympe::GraphExecutionSimulator::ValidateDataConnections | ( | const TaskGraphTemplate & | tmpl, |
| std::vector< ValidationError > & | outErrors | ||
| ) |
Validates all data connections in a graph.
| tmpl | The TaskGraphTemplate to validate. |
| outErrors | [out] Vector to append validation errors to. |
Definition at line 359 of file GraphExecutionSimulator.cpp.
References Olympe::Error, and GetComponentTypeID_Static().
Referenced by SimulateExecution().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Current execution path.
Definition at line 218 of file GraphExecutionSimulator.h.
Referenced by SimulateExecution().
|
private |
Track data nodes already traced to prevent infinite recursion.
Definition at line 219 of file GraphExecutionSimulator.h.
Referenced by SimulateExecution(), and TraceDataPinEvaluation().
Track visits per node to detect loops.
Definition at line 217 of file GraphExecutionSimulator.h.
Referenced by SimulateExecution().