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

Singleton that validates a TaskGraphTemplate and tracks selected node. More...

#include <GraphValidationPanel.h>

Public Member Functions

void Validate (const TaskGraphTemplate &graph)
 Clears previous results and validates graph.
 
const std::vector< GraphValidationError > & GetErrors () const
 Returns the current list of validation findings.
 
bool HasErrors () const
 Returns true if there are any findings of any severity.
 
bool HasCriticalErrors () const
 Returns true if any finding has severity Critical.
 
void Clear ()
 Clears all findings and resets the selected node.
 
void OnErrorClick (int nodeId)
 Records nodeId as the currently selected node.
 
int GetSelectedNodeId () const
 Returns the node ID set by the most recent OnErrorClick() call (-1 if none).
 

Static Public Member Functions

static GraphValidationPanelGet ()
 Returns the single shared instance.
 

Private Member Functions

 GraphValidationPanel ()
 
void CheckDeadEnds (const TaskGraphTemplate &graph)
 Flags nodes whose exec-output pins have no outgoing connection.
 
void CheckMissingConnections (const TaskGraphTemplate &graph)
 Flags SubGraph nodes that have no SubGraphPath set.
 
void CheckCycles (const TaskGraphTemplate &graph)
 Flags cycles detected by DFS over ExecConnections.
 
void AddError (int nodeId, const std::string &message, ValidationSeverity severity)
 

Private Attributes

std::vector< GraphValidationErrorm_Errors
 
int m_SelectedNodeId
 

Detailed Description

Singleton that validates a TaskGraphTemplate and tracks selected node.

Typical usage:

panel.Validate(myGraph);
if (panel.HasErrors())
{
for (const auto& err : panel.GetErrors())
SYSTEM_LOG << err.message << std::endl;
}
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
const std::vector< GraphValidationError > & GetErrors() const
Returns the current list of validation findings.
static GraphValidationPanel & Get()
Returns the single shared instance.
#define SYSTEM_LOG

Definition at line 72 of file GraphValidationPanel.h.

Constructor & Destructor Documentation

◆ GraphValidationPanel()

Olympe::GraphValidationPanel::GraphValidationPanel ( )
private

Definition at line 32 of file GraphValidationPanel.cpp.

Member Function Documentation

◆ AddError()

void Olympe::GraphValidationPanel::AddError ( int  nodeId,
const std::string &  message,
ValidationSeverity  severity 
)
private

Definition at line 41 of file GraphValidationPanel.cpp.

References GetComponentTypeID_Static(), m_Errors, and Olympe::GraphValidationError::nodeId.

Referenced by CheckCycles(), CheckDeadEnds(), CheckMissingConnections(), and Validate().

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

◆ CheckCycles()

void Olympe::GraphValidationPanel::CheckCycles ( const TaskGraphTemplate graph)
private

Flags cycles detected by DFS over ExecConnections.

Definition at line 142 of file GraphValidationPanel.cpp.

References AddError(), Olympe::Critical, and GetComponentTypeID_Static().

Referenced by Validate().

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

◆ CheckDeadEnds()

void Olympe::GraphValidationPanel::CheckDeadEnds ( const TaskGraphTemplate graph)
private

Flags nodes whose exec-output pins have no outgoing connection.

Definition at line 79 of file GraphValidationPanel.cpp.

References AddError(), Olympe::Critical, Olympe::EntryPoint, Olympe::Error, Olympe::GetBBValue, GetComponentTypeID_Static(), Olympe::MathOp, and Olympe::SetBBValue.

Referenced by Validate().

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

◆ CheckMissingConnections()

void Olympe::GraphValidationPanel::CheckMissingConnections ( const TaskGraphTemplate graph)
private

Flags SubGraph nodes that have no SubGraphPath set.

Definition at line 116 of file GraphValidationPanel.cpp.

References AddError(), Olympe::Critical, Olympe::Error, GetComponentTypeID_Static(), Olympe::NODE_INDEX_NONE, and Olympe::SubGraph.

Referenced by Validate().

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

◆ Clear()

void Olympe::GraphValidationPanel::Clear ( )

Clears all findings and resets the selected node.

Definition at line 243 of file GraphValidationPanel.cpp.

References m_Errors, and m_SelectedNodeId.

Referenced by Validate().

+ Here is the caller graph for this function:

◆ Get()

GraphValidationPanel & Olympe::GraphValidationPanel::Get ( )
static

Returns the single shared instance.

Definition at line 22 of file GraphValidationPanel.cpp.

◆ GetErrors()

const std::vector< GraphValidationError > & Olympe::GraphValidationPanel::GetErrors ( ) const

Returns the current list of validation findings.

Definition at line 223 of file GraphValidationPanel.cpp.

References m_Errors.

◆ GetSelectedNodeId()

int Olympe::GraphValidationPanel::GetSelectedNodeId ( ) const

Returns the node ID set by the most recent OnErrorClick() call (-1 if none).

Definition at line 254 of file GraphValidationPanel.cpp.

References m_SelectedNodeId.

◆ HasCriticalErrors()

bool Olympe::GraphValidationPanel::HasCriticalErrors ( ) const

Returns true if any finding has severity Critical.

Definition at line 233 of file GraphValidationPanel.cpp.

References Olympe::Critical, GetComponentTypeID_Static(), and m_Errors.

+ Here is the call graph for this function:

◆ HasErrors()

bool Olympe::GraphValidationPanel::HasErrors ( ) const

Returns true if there are any findings of any severity.

Definition at line 228 of file GraphValidationPanel.cpp.

References m_Errors.

◆ OnErrorClick()

void Olympe::GraphValidationPanel::OnErrorClick ( int  nodeId)

Records nodeId as the currently selected node.

UI can read this to pan the canvas to the offending node.

Definition at line 249 of file GraphValidationPanel.cpp.

References m_SelectedNodeId.

◆ Validate()

void Olympe::GraphValidationPanel::Validate ( const TaskGraphTemplate graph)

Clears previous results and validates graph.

Definition at line 56 of file GraphValidationPanel.cpp.

References AddError(), CheckCycles(), CheckDeadEnds(), CheckMissingConnections(), Clear(), Olympe::Critical, GetComponentTypeID_Static(), m_Errors, and SYSTEM_LOG.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_Errors

std::vector<GraphValidationError> Olympe::GraphValidationPanel::m_Errors
private

◆ m_SelectedNodeId

int Olympe::GraphValidationPanel::m_SelectedNodeId
private

Definition at line 155 of file GraphValidationPanel.h.

Referenced by Clear(), GetSelectedNodeId(), and OnErrorClick().


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