![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Manages single-threaded step-by-step execution of a TaskGraphTemplate. More...
#include <GraphRuntimeInstance.h>
Collaboration diagram for Olympe::GraphRuntimeInstance:Public Member Functions | |
| GraphRuntimeInstance (const TaskGraphTemplate &graph) | |
| Constructs an instance bound to the given graph template. | |
| void | StartExecution () |
| Initialises the execution stack and marks the instance as running. | |
| bool | StepExecution () |
| Advances execution by one node. | |
| bool | IsExecuting () const |
| Returns true while there are nodes left to execute. | |
| void | SetBlackboardVariable (const std::string &key, float value) |
| Sets a Blackboard variable in the runtime environment. | |
| void | SetDynamicPinValue (const std::string &pinID, float value) |
| Sets the runtime value of a dynamic data pin. | |
| void | AddBreakpoint (int32_t nodeID) |
| Registers a breakpoint on a node. | |
| void | RemoveBreakpoint (int32_t nodeID) |
| Removes a previously registered breakpoint. | |
| bool | IsBreakpointHit () const |
| Returns true when execution is paused at a breakpoint. | |
| void | ResumeFromBreakpoint () |
| Resumes execution after a breakpoint. | |
| const std::vector< int32_t > & | GetActiveNodeIDs () const |
| Returns the IDs of all nodes currently on the execution stack. | |
| const std::string & | GetLastError () const |
| Returns the last error message produced during execution. | |
Private Member Functions | |
| bool | EvaluateBranchConditions (const TaskNodeDefinition &node) |
Evaluates all NodeConditionRefs on node and returns the result. | |
Private Attributes | |
| const TaskGraphTemplate & | m_graph |
| Bound graph template (not owned) | |
| RuntimeEnvironment | m_environment |
| Blackboard + pin values. | |
| std::vector< int32_t > | m_executionStack |
| Active node IDs (front = next) | |
| bool | m_isExecuting |
| True while stack is non-empty. | |
| bool | m_breakpointHit |
| True when paused at a breakpoint. | |
| bool | m_skipBreakpointOnce |
| Skip breakpoint check for one step after Resume. | |
| std::set< int32_t > | m_breakpoints |
| Registered breakpoint node IDs. | |
| std::string | m_lastError |
| Last error from condition evaluation. | |
Manages single-threaded step-by-step execution of a TaskGraphTemplate.
Definition at line 41 of file GraphRuntimeInstance.h.
|
explicit |
Constructs an instance bound to the given graph template.
Call StartExecution() to begin.
| graph | Immutable graph template to execute. |
Definition at line 19 of file GraphRuntimeInstance.cpp.
Registers a breakpoint on a node.
When StepExecution() is about to process a node that has a breakpoint the execution pauses (StepExecution returns false without consuming the node) and IsBreakpointHit() returns true.
| nodeID | Node to break on. |
Definition at line 131 of file GraphRuntimeInstance.cpp.
References m_breakpoints.
|
private |
Evaluates all NodeConditionRefs on node and returns the result.
Conditions are combined with their LogicalOp (And / Or) in the order they appear in node.conditionRefs. The LogicalOp of the first entry (LogicalOp::Start) is ignored.
Definition at line 170 of file GraphRuntimeInstance.cpp.
References GetComponentTypeID_Static().
Referenced by StepExecution().
Here is the call graph for this function:
Here is the caller graph for this function:Returns the IDs of all nodes currently on the execution stack.
Definition at line 156 of file GraphRuntimeInstance.cpp.
References m_executionStack.
| const std::string & Olympe::GraphRuntimeInstance::GetLastError | ( | ) | const |
Returns the last error message produced during execution.
Empty when no error has occurred.
Definition at line 161 of file GraphRuntimeInstance.cpp.
References m_lastError.
| bool Olympe::GraphRuntimeInstance::IsBreakpointHit | ( | ) | const |
Returns true when execution is paused at a breakpoint.
Definition at line 141 of file GraphRuntimeInstance.cpp.
References m_breakpointHit.
| bool Olympe::GraphRuntimeInstance::IsExecuting | ( | ) | const |
Returns true while there are nodes left to execute.
Definition at line 108 of file GraphRuntimeInstance.cpp.
References m_isExecuting.
Removes a previously registered breakpoint.
| nodeID | Node whose breakpoint to remove. |
Definition at line 136 of file GraphRuntimeInstance.cpp.
References m_breakpoints.
| void Olympe::GraphRuntimeInstance::ResumeFromBreakpoint | ( | ) |
Resumes execution after a breakpoint.
Clears the breakpoint-hit flag so the next StepExecution() call will process the current node normally.
Definition at line 146 of file GraphRuntimeInstance.cpp.
References m_breakpointHit, and m_skipBreakpointOnce.
Sets a Blackboard variable in the runtime environment.
| key | Variable identifier. |
| value | Float value. |
Definition at line 117 of file GraphRuntimeInstance.cpp.
References GetComponentTypeID_Static(), m_environment, and Olympe::RuntimeEnvironment::SetBlackboardVariable().
Here is the call graph for this function:Sets the runtime value of a dynamic data pin.
| pinID | Pin UUID. |
| value | Float value delivered by the connected node. |
Definition at line 122 of file GraphRuntimeInstance.cpp.
References GetComponentTypeID_Static(), m_environment, and Olympe::RuntimeEnvironment::SetDynamicPinValue().
Here is the call graph for this function:| void Olympe::GraphRuntimeInstance::StartExecution | ( | ) |
Initialises the execution stack and marks the instance as running.
Uses the graph's RootNodeID as the first active node. If RootNodeID is NODE_INDEX_NONE the call is a no-op and IsExecuting() remains false.
Definition at line 31 of file GraphRuntimeInstance.cpp.
References Olympe::TaskGraphTemplate::EntryPointID, GetComponentTypeID_Static(), m_breakpointHit, m_executionStack, m_graph, m_isExecuting, m_lastError, m_skipBreakpointOnce, Olympe::NODE_INDEX_NONE, and Olympe::TaskGraphTemplate::RootNodeID.
Here is the call graph for this function:| bool Olympe::GraphRuntimeInstance::StepExecution | ( | ) |
Advances execution by one node.
Processes the top of the execution stack:
Returns true when execution is still active after this step. Returns false when the stack becomes empty (execution complete or error).
Definition at line 52 of file GraphRuntimeInstance.cpp.
References Olympe::Branch, EvaluateBranchConditions(), GetComponentTypeID_Static(), Olympe::TaskGraphTemplate::GetNode(), m_breakpointHit, m_breakpoints, m_executionStack, m_graph, m_isExecuting, m_lastError, m_skipBreakpointOnce, and Olympe::NODE_INDEX_NONE.
Here is the call graph for this function:
|
private |
True when paused at a breakpoint.
Definition at line 168 of file GraphRuntimeInstance.h.
Referenced by IsBreakpointHit(), ResumeFromBreakpoint(), StartExecution(), and StepExecution().
|
private |
Registered breakpoint node IDs.
Definition at line 170 of file GraphRuntimeInstance.h.
Referenced by AddBreakpoint(), RemoveBreakpoint(), and StepExecution().
|
private |
Blackboard + pin values.
Definition at line 165 of file GraphRuntimeInstance.h.
Referenced by SetBlackboardVariable(), and SetDynamicPinValue().
|
private |
Active node IDs (front = next)
Definition at line 166 of file GraphRuntimeInstance.h.
Referenced by GetActiveNodeIDs(), StartExecution(), and StepExecution().
|
private |
Bound graph template (not owned)
Definition at line 164 of file GraphRuntimeInstance.h.
Referenced by StartExecution(), and StepExecution().
|
private |
True while stack is non-empty.
Definition at line 167 of file GraphRuntimeInstance.h.
Referenced by IsExecuting(), StartExecution(), and StepExecution().
|
private |
Last error from condition evaluation.
Definition at line 171 of file GraphRuntimeInstance.h.
Referenced by GetLastError(), StartExecution(), and StepExecution().
|
private |
Skip breakpoint check for one step after Resume.
Definition at line 169 of file GraphRuntimeInstance.h.
Referenced by ResumeFromBreakpoint(), StartExecution(), and StepExecution().