13#include "../system/system_utils.h"
26 SYSTEM_LOG <<
"[TaskGraphTemplate] Validate failed: Nodes is empty" << std::endl;
31 std::unordered_map<int32_t, bool>
validIds;
32 for (
size_t i = 0;
i <
Nodes.size(); ++
i)
43 <<
" does not reference a known node" << std::endl;
48 for (
size_t i = 0;
i <
Nodes.size(); ++
i)
51 for (
size_t c = 0;
c <
node.ChildrenIDs.size(); ++
c)
56 SYSTEM_LOG <<
"[TaskGraphTemplate] Validate failed: Node " <<
node.NodeID
57 <<
" references unknown child " << childId << std::endl;
63 SYSTEM_LOG <<
"[TaskGraphTemplate] Validate passed for template '" <<
Name <<
"'" << std::endl;
85 for (
size_t i = 0;
i <
Nodes.size(); ++
i)
91 <<
" entries for template '" <<
Name <<
"'" << std::endl;
110 for (
size_t i = 0;
i <
Nodes.size(); ++
i)
112 if (
Nodes[
i].NodeID == nodeID)
131 SYSTEM_LOG <<
"[TaskGraphTemplate] SanitizeExecConnections: Removing connection with invalid source node #"
132 <<
conn.SourceNodeID <<
"\n";
140 SYSTEM_LOG <<
"[TaskGraphTemplate] SanitizeExecConnections: Removing connection with invalid destination node #"
141 <<
conn.TargetNodeID <<
"\n";
149 SYSTEM_LOG <<
"[TaskGraphTemplate] SanitizeExecConnections: Removing exec-out connection from data-pure node #"
150 <<
conn.SourceNodeID <<
" (type=" <<
static_cast<int>(
srcNode->Type)
151 <<
"." <<
conn.SourcePinName <<
" -> node #" <<
conn.TargetNodeID <<
")\n";
159 SYSTEM_LOG <<
"[TaskGraphTemplate] SanitizeExecConnections: Removing exec-in connection to data-pure node #"
160 <<
conn.TargetNodeID <<
" (type=" <<
static_cast<int>(
dstNode->Type)
161 <<
" <- node #" <<
conn.SourceNodeID <<
"." <<
conn.SourcePinName <<
")\n";
176 <<
" invalid exec connection(s) - graph is now clean\n";
ComponentTypeID GetComponentTypeID_Static()
Immutable asset structure shared by all task graph runners.
std::vector< TaskNodeDefinition > Nodes
All graph nodes.
std::vector< ExecPinConnection > ExecConnections
Explicit exec connections (ATS VS only)
std::string Name
Friendly name of this template (e.g. "PatrolBehaviour")
int32_t RootNodeID
ID of the root node (must exist in Nodes)
int SanitizeExecConnections()
Phase 24.3 - Poka-Yoke: Sanitizes exec connections to remove invalid links.
void BuildLookupCache()
Rebuilds the internal ID-to-node lookup map from the Nodes vector.
const TaskNodeDefinition * GetNode(int32_t nodeId) const
Returns a pointer to the node with the given ID, or nullptr.
bool Validate() const
Validates the structural integrity of the template.
std::unordered_map< int32_t, const TaskNodeDefinition * > m_nodeLookup
Fast lookup: node ID -> pointer into Nodes vector.
< Provides AssetID and INVALID_ASSET_ID
TaskNodeType
Identifies the role of a node in the task graph.
@ GetBBValue
Data node – reads a Blackboard key.
@ MathOp
Data node – arithmetic operation (+, -, *, /)
Explicit connection between a named exec-out pin of a source node and the exec-in pin of a target nod...
Full description of a single node in the task graph.
std::vector< int32_t > ChildrenIDs
Child node IDs (control-flow nodes only; empty for AtomicTask/Decorator leaf)