Abstract base class providing an interface for file-like storage with binary and text read/write oper...
[AI] Abstract base class for storing data payloads inside nodes of a tree structure,...
LegoTreeNodeData()
[AI] Default constructor.
virtual LegoResult Read(LegoStorage *p_storage)
[AI] Virtual function for deserializing node data from a generic LegoStorage device.
virtual LegoResult Write(LegoStorage *p_storage)
[AI] Virtual function for serializing node data to a generic LegoStorage device.
virtual ~LegoTreeNodeData()
[AI] Virtual destructor for safe polymorphic deletion of derived classes.
[AI] Represents a node within a general, N-ary tree structure.
void SetData(LegoTreeNodeData *p_data)
[AI] Associates a data payload with this node.
LegoTreeNode()
[AI] Constructs an empty tree node with no children or data. [AI]
void SetChild(LegoU32 p_i, LegoTreeNode *p_child)
[AI] Assigns a child node pointer at the specified index in this node's children array.
LegoTreeNodeData * GetData()
[AI] Returns the data payload stored at this node (may be nullptr). [AI]
LegoTreeNode ** m_children
[AI] Pointer to array of tree node children (size = m_numChildren). nullptr if no children allocated....
LegoU32 GetNumChildren()
[AI] Returns the number of direct children of this node. [AI]
void SetChildren(LegoTreeNode **p_children)
[AI] Assigns the entire children pointer array.
LegoTreeNode * GetChild(LegoU32 p_i)
[AI] Gets the child node at the specified index (no bounds checking).
void SetNumChildren(LegoU32 p_numChildren)
[AI] Sets the number of children for this node (does not resize pointer array).
virtual ~LegoTreeNode()
[AI] Destructor cleans up node data and children recursively. [AI]
LegoU32 m_numChildren
[AI] Number of valid child pointers in m_children. [AI]
LegoTreeNodeData * m_data
[AI] Pointer to node data payload, owned by node. nullptr indicates no data present....
LegoTreeNode ** GetChildren()
[AI] Returns the pointer to the children array. [AI]
[AI] Represents an N-ary tree of LegoTreeNode objects, with support for recursive reading and writing...
LegoTreeNode * m_root
[AI] Root node of the tree. nullptr if tree is empty. Owned by the tree instance. [AI]
LegoTreeNode * GetRoot()
[AI] Returns a pointer to the root node of the tree. [AI]
virtual LegoResult Write(LegoStorage *p_storage)
[AI] Serializes the tree structure recursively to the given storage.
virtual LegoTreeNodeData * CreateData()
[AI] Virtual function to instantiate node payload objects for the tree structure.
LegoTree()
[AI] Constructs an empty tree (root not allocated). [AI]
void Delete(LegoTreeNode *p_node)
[AI] Recursively deletes an entire subtree starting at the given node.
virtual ~LegoTree()
[AI] Recursively destroys all tree nodes and their payloads. [AI]
void SetRoot(LegoTreeNode *p_root)
[AI] Assigns the root node pointer for the tree (takes ownership).
virtual LegoResult Read(LegoStorage *p_storage)
[AI] Loads the tree structure recursively from the given storage.
[AI] Defines basic fixed-width data types and platform-neutral constants for LEGO Island codebase.
unsigned long LegoU32
[AI] Unsigned 32-bit integer type for cross-platform compatibility.
LegoS32 LegoResult
[AI] Function result type (return code): typically SUCCESS (0) or FAILURE (-1).
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.