Isle
Loading...
Searching...
No Matches
LegoTreeNode Class Reference

[AI] Represents a node within a general, N-ary tree structure. More...

#include <legotree.h>

Collaboration diagram for LegoTreeNode:

Public Member Functions

 LegoTreeNode ()
 [AI] Constructs an empty tree node with no children or data. [AI] More...
 
virtual ~LegoTreeNode ()
 [AI] Destructor cleans up node data and children recursively. [AI] More...
 
LegoTreeNodeDataGetData ()
 [AI] Returns the data payload stored at this node (may be nullptr). [AI] More...
 
void SetData (LegoTreeNodeData *p_data)
 [AI] Associates a data payload with this node. More...
 
LegoU32 GetNumChildren ()
 [AI] Returns the number of direct children of this node. [AI] More...
 
void SetNumChildren (LegoU32 p_numChildren)
 [AI] Sets the number of children for this node (does not resize pointer array). More...
 
LegoTreeNodeGetChild (LegoU32 p_i)
 [AI] Gets the child node at the specified index (no bounds checking). More...
 
void SetChild (LegoU32 p_i, LegoTreeNode *p_child)
 [AI] Assigns a child node pointer at the specified index in this node's children array. More...
 
LegoTreeNode ** GetChildren ()
 [AI] Returns the pointer to the children array. [AI] More...
 
void SetChildren (LegoTreeNode **p_children)
 [AI] Assigns the entire children pointer array. More...
 

Protected Attributes

LegoTreeNodeDatam_data
 [AI] Pointer to node data payload, owned by node. nullptr indicates no data present. [AI] More...
 
LegoU32 m_numChildren
 [AI] Number of valid child pointers in m_children. [AI] More...
 
LegoTreeNode ** m_children
 [AI] Pointer to array of tree node children (size = m_numChildren). nullptr if no children allocated. [AI] More...
 

Detailed Description

[AI] Represents a node within a general, N-ary tree structure.

[AI]

[AI] Each node holds a pointer to a data object, a list of child nodes, and tracks the number of children. Intended for constructing arbitrarily nested tree data structures, loaded/saved recursively. [AI] Size: 0x10 bytes [AI]

Definition at line 44 of file legotree.h.

Constructor & Destructor Documentation

◆ LegoTreeNode()

LegoTreeNode::LegoTreeNode ( )

[AI] Constructs an empty tree node with no children or data. [AI]

Definition at line 12 of file legotree.cpp.

◆ ~LegoTreeNode()

LegoTreeNode::~LegoTreeNode ( )
virtual

[AI] Destructor cleans up node data and children recursively. [AI]

Definition at line 21 of file legotree.cpp.

Member Function Documentation

◆ GetChild()

LegoTreeNode * LegoTreeNode::GetChild ( LegoU32  p_i)
inline

[AI] Gets the child node at the specified index (no bounds checking).

[AI]

Parameters
p_iChild index. [AI]

Definition at line 72 of file legotree.h.

◆ GetChildren()

LegoTreeNode ** LegoTreeNode::GetChildren ( )
inline

[AI] Returns the pointer to the children array. [AI]

Definition at line 81 of file legotree.h.

◆ GetData()

LegoTreeNodeData * LegoTreeNode::GetData ( )
inline

[AI] Returns the data payload stored at this node (may be nullptr). [AI]

Definition at line 54 of file legotree.h.

◆ GetNumChildren()

LegoU32 LegoTreeNode::GetNumChildren ( )
inline

[AI] Returns the number of direct children of this node. [AI]

Definition at line 63 of file legotree.h.

◆ SetChild()

void LegoTreeNode::SetChild ( LegoU32  p_i,
LegoTreeNode p_child 
)
inline

[AI] Assigns a child node pointer at the specified index in this node's children array.

[AI]

Parameters
p_iArray index to set. [AI]
p_childPointer to child tree node. [AI]

Definition at line 77 of file legotree.h.

◆ SetChildren()

void LegoTreeNode::SetChildren ( LegoTreeNode **  p_children)
inline

[AI] Assigns the entire children pointer array.

[AI]

Parameters
p_childrenPointer to an array of LegoTreeNode* (must be heap-allocated). [AI]

Definition at line 86 of file legotree.h.

◆ SetData()

void LegoTreeNode::SetData ( LegoTreeNodeData p_data)
inline

[AI] Associates a data payload with this node.

[AI]

Parameters
p_dataPointer to heap-allocated payload data, takes ownership. [AI]

Definition at line 59 of file legotree.h.

◆ SetNumChildren()

void LegoTreeNode::SetNumChildren ( LegoU32  p_numChildren)
inline

[AI] Sets the number of children for this node (does not resize pointer array).

[AI]

Parameters
p_numChildrenNew number of children. [AI]

Definition at line 68 of file legotree.h.

Member Data Documentation

◆ m_children

LegoTreeNode** LegoTreeNode::m_children
protected

[AI] Pointer to array of tree node children (size = m_numChildren). nullptr if no children allocated. [AI]

Definition at line 95 of file legotree.h.

◆ m_data

LegoTreeNodeData* LegoTreeNode::m_data
protected

[AI] Pointer to node data payload, owned by node. nullptr indicates no data present. [AI]

Definition at line 93 of file legotree.h.

◆ m_numChildren

LegoU32 LegoTreeNode::m_numChildren
protected

[AI] Number of valid child pointers in m_children. [AI]

Definition at line 94 of file legotree.h.


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