Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Olympe::GraphExecutionTracer Class Reference

Records execution trace during graph simulation. More...

#include <GraphExecutionTracer.h>

Public Member Functions

 GraphExecutionTracer ()
 
 ~GraphExecutionTracer ()
 
void Reset ()
 Clears all recorded events and resets state.
 
void RecordNodeEntered (int32_t nodeId, const std::string &nodeName, const std::string &nodeType)
 Records that execution entered a node.
 
void RecordNodeExited (int32_t nodeId, int32_t nextNodeId)
 Records that execution exited a node successfully.
 
void RecordConditionEvaluated (int32_t nodeId, const std::string &expression, bool result, const std::string &message="")
 Records a condition evaluation result.
 
void RecordBranchTaken (int32_t nodeId, const std::string &branchName, int32_t nextNodeId)
 Records that a branch was taken based on condition.
 
void RecordError (int32_t nodeId, const std::string &nodeName, const std::string &errorMessage, const std::string &severity="Error")
 Records an execution error.
 
void RecordExecutionBlocked (int32_t nodeId, const std::string &reason)
 Records that execution was blocked (dead-end, etc.).
 
void RecordDataPinResolved (int32_t nodeId, const std::string &pinName, const std::string &value)
 Records data pin resolution.
 
void RecordExecutionCompleted (bool success, const std::string &message)
 Records graph execution completion.
 
const std::vector< ExecutionEvent > & GetEvents () const
 Returns all recorded events.
 
int32_t GetStepCount () const
 Returns the number of steps executed.
 
bool HasErrors () const
 Returns true if any errors were recorded.
 
const std::vector< int32_t > & GetErrorNodes () const
 Returns the set of node IDs that encountered errors.
 
std::string GetTraceLog () const
 Returns a formatted trace log as a multi-line string.
 
std::string GetExecutionSummary () const
 Returns a summary of the execution (steps, errors, etc.).
 

Private Member Functions

void AddEvent (const ExecutionEvent &event)
 

Private Attributes

std::vector< ExecutionEventm_events
 
std::vector< int32_tm_errorNodes
 
int32_t m_stepCount = 0
 
bool m_executionComplete = false
 
bool m_executionSuccess = false
 

Detailed Description

Records execution trace during graph simulation.

Used by GraphExecutionSimulator to capture execution flow. Can be queried to understand why a graph failed or which path was taken.

Definition at line 70 of file GraphExecutionTracer.h.

Constructor & Destructor Documentation

◆ GraphExecutionTracer()

Olympe::GraphExecutionTracer::GraphExecutionTracer ( )

Definition at line 15 of file GraphExecutionTracer.cpp.

◆ ~GraphExecutionTracer()

Olympe::GraphExecutionTracer::~GraphExecutionTracer ( )

Definition at line 20 of file GraphExecutionTracer.cpp.

Member Function Documentation

◆ AddEvent()

void Olympe::GraphExecutionTracer::AddEvent ( const ExecutionEvent event)
private

Definition at line 240 of file GraphExecutionTracer.cpp.

References GetComponentTypeID_Static(), and m_events.

Referenced by RecordBranchTaken(), RecordConditionEvaluated(), RecordDataPinResolved(), RecordError(), RecordExecutionBlocked(), RecordExecutionCompleted(), RecordNodeEntered(), and RecordNodeExited().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetErrorNodes()

const std::vector< int32_t > & Olympe::GraphExecutionTracer::GetErrorNodes ( ) const
inline

Returns the set of node IDs that encountered errors.

Definition at line 164 of file GraphExecutionTracer.h.

References m_errorNodes.

◆ GetEvents()

const std::vector< ExecutionEvent > & Olympe::GraphExecutionTracer::GetEvents ( ) const
inline

Returns all recorded events.

Definition at line 149 of file GraphExecutionTracer.h.

References m_events.

Referenced by Olympe::ExecutionTestPanel::DisplayTrace(), and Olympe::ExecutionTestPanel::RenderTraceLog().

+ Here is the caller graph for this function:

◆ GetExecutionSummary()

std::string Olympe::GraphExecutionTracer::GetExecutionSummary ( ) const

Returns a summary of the execution (steps, errors, etc.).

Definition at line 204 of file GraphExecutionTracer.cpp.

References Olympe::ConditionEvaluated, Olympe::ErrorOccurred, GetComponentTypeID_Static(), m_errorNodes, m_events, m_executionComplete, m_executionSuccess, m_stepCount, and Olympe::NodeEntered.

Referenced by Olympe::ExecutionTestPanel::GetTestSummary(), Olympe::ExecutionTestPanel::RenderSummary(), and Olympe::ExecutionTestPanel::RunExecutionTest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetStepCount()

int32_t Olympe::GraphExecutionTracer::GetStepCount ( ) const
inline

Returns the number of steps executed.

Definition at line 154 of file GraphExecutionTracer.h.

References m_stepCount.

◆ GetTraceLog()

std::string Olympe::GraphExecutionTracer::GetTraceLog ( ) const

◆ HasErrors()

bool Olympe::GraphExecutionTracer::HasErrors ( ) const
inline

Returns true if any errors were recorded.

Definition at line 159 of file GraphExecutionTracer.h.

References m_errorNodes.

◆ RecordBranchTaken()

void Olympe::GraphExecutionTracer::RecordBranchTaken ( int32_t  nodeId,
const std::string &  branchName,
int32_t  nextNodeId 
)

Records that a branch was taken based on condition.

Parameters
nodeIdID of the branch node.
branchNameName of the branch taken ("True", "False", case name, etc.).
nextNodeIdID of the node being branched to.

Definition at line 79 of file GraphExecutionTracer.cpp.

References AddEvent(), Olympe::BranchTaken, GetComponentTypeID_Static(), m_stepCount, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ RecordConditionEvaluated()

void Olympe::GraphExecutionTracer::RecordConditionEvaluated ( int32_t  nodeId,
const std::string &  expression,
bool  result,
const std::string &  message = "" 
)

Records a condition evaluation result.

Parameters
nodeIdID of the node containing the condition.
expressionString representation of the condition.
resultWhether the condition evaluated to true.
messageOptional additional details.

Definition at line 62 of file GraphExecutionTracer.cpp.

References AddEvent(), Olympe::ConditionEvaluated, GetComponentTypeID_Static(), m_stepCount, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ RecordDataPinResolved()

void Olympe::GraphExecutionTracer::RecordDataPinResolved ( int32_t  nodeId,
const std::string &  pinName,
const std::string &  value 
)

Records data pin resolution.

Parameters
nodeIdID of the node.
pinNameName of the pin.
valueResolved value as string.

Definition at line 121 of file GraphExecutionTracer.cpp.

References AddEvent(), Olympe::DataPinResolved, GetComponentTypeID_Static(), m_stepCount, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ RecordError()

void Olympe::GraphExecutionTracer::RecordError ( int32_t  nodeId,
const std::string &  nodeName,
const std::string &  errorMessage,
const std::string &  severity = "Error" 
)

Records an execution error.

Parameters
nodeIdID of the node where error occurred (NODE_INDEX_NONE for graph-level).
nodeNameName of the node (if applicable).
errorMessageDescription of the error.
severity"Error" or "Critical".

Definition at line 89 of file GraphExecutionTracer.cpp.

References AddEvent(), Olympe::ErrorOccurred, GetComponentTypeID_Static(), m_errorNodes, m_stepCount, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ RecordExecutionBlocked()

void Olympe::GraphExecutionTracer::RecordExecutionBlocked ( int32_t  nodeId,
const std::string &  reason 
)

Records that execution was blocked (dead-end, etc.).

Parameters
nodeIdID of the node causing the block.
reasonWhy execution was blocked.

Definition at line 106 of file GraphExecutionTracer.cpp.

References AddEvent(), Olympe::ExecutionBlocked, GetComponentTypeID_Static(), m_errorNodes, m_stepCount, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ RecordExecutionCompleted()

void Olympe::GraphExecutionTracer::RecordExecutionCompleted ( bool  success,
const std::string &  message 
)

Records graph execution completion.

Parameters
successtrue if completed successfully, false if ended with error.
messageSummary message.

Definition at line 131 of file GraphExecutionTracer.cpp.

References AddEvent(), Olympe::ExecutionCompleted, GetComponentTypeID_Static(), m_executionComplete, m_executionSuccess, m_stepCount, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ RecordNodeEntered()

void Olympe::GraphExecutionTracer::RecordNodeEntered ( int32_t  nodeId,
const std::string &  nodeName,
const std::string &  nodeType 
)

Records that execution entered a node.

Parameters
nodeIdID of the node being entered.
nodeNameDisplay name of the node.
nodeTypeType of the node (from TaskNodeType).

Definition at line 33 of file GraphExecutionTracer.cpp.

References AddEvent(), GetComponentTypeID_Static(), m_stepCount, Olympe::NodeEntered, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ RecordNodeExited()

void Olympe::GraphExecutionTracer::RecordNodeExited ( int32_t  nodeId,
int32_t  nextNodeId 
)

Records that execution exited a node successfully.

Parameters
nodeIdID of the node being exited.
nextNodeIdID of the next node in execution (NODE_INDEX_NONE if end).

Definition at line 45 of file GraphExecutionTracer.cpp.

References AddEvent(), GetComponentTypeID_Static(), m_stepCount, Olympe::NodeExited, and Olympe::ExecutionEvent::type.

+ Here is the call graph for this function:

◆ Reset()

void Olympe::GraphExecutionTracer::Reset ( )

Clears all recorded events and resets state.

Definition at line 24 of file GraphExecutionTracer.cpp.

References m_errorNodes, m_events, m_executionComplete, m_executionSuccess, and m_stepCount.

Referenced by Olympe::ExecutionTestPanel::RunExecutionTest().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_errorNodes

std::vector<int32_t> Olympe::GraphExecutionTracer::m_errorNodes
private

◆ m_events

std::vector<ExecutionEvent> Olympe::GraphExecutionTracer::m_events
private

Definition at line 180 of file GraphExecutionTracer.h.

Referenced by AddEvent(), GetEvents(), GetExecutionSummary(), GetTraceLog(), and Reset().

◆ m_executionComplete

bool Olympe::GraphExecutionTracer::m_executionComplete = false
private

◆ m_executionSuccess

bool Olympe::GraphExecutionTracer::m_executionSuccess = false
private

◆ m_stepCount

int32_t Olympe::GraphExecutionTracer::m_stepCount = 0
private

The documentation for this class was generated from the following files: