Isle
|
[AI] Represents an N-ary tree of LegoTreeNode objects, with support for recursive reading and writing of tree structures. More...
#include <legotree.h>
Public Member Functions | |
LegoTree () | |
[AI] Constructs an empty tree (root not allocated). [AI] More... | |
virtual | ~LegoTree () |
[AI] Recursively destroys all tree nodes and their payloads. [AI] More... | |
LegoTreeNode * | GetRoot () |
[AI] Returns a pointer to the root node of the tree. [AI] More... | |
void | SetRoot (LegoTreeNode *p_root) |
[AI] Assigns the root node pointer for the tree (takes ownership). More... | |
virtual LegoResult | Read (LegoStorage *p_storage) |
[AI] Loads the tree structure recursively from the given storage. More... | |
virtual LegoResult | Write (LegoStorage *p_storage) |
[AI] Serializes the tree structure recursively to the given storage. More... | |
Protected Member Functions | |
LegoResult | Read (LegoStorage *p_storage, LegoTreeNode *&p_node) |
[AI] Reads a subtree recursively from storage, creating a new node and reading its data/children. More... | |
LegoResult | Write (LegoStorage *p_storage, LegoTreeNode *p_node) |
[AI] Writes a subtree recursively to storage from the given node. More... | |
void | Delete (LegoTreeNode *p_node) |
[AI] Recursively deletes an entire subtree starting at the given node. More... | |
virtual LegoTreeNodeData * | CreateData () |
[AI] Virtual function to instantiate node payload objects for the tree structure. More... | |
Protected Attributes | |
LegoTreeNode * | m_root |
[AI] Root node of the tree. nullptr if tree is empty. Owned by the tree instance. [AI] More... | |
[AI] Represents an N-ary tree of LegoTreeNode objects, with support for recursive reading and writing of tree structures.
[AI]
[AI] This class owns its root node and manages serialization/deserialization of the entire tree to a LegoStorage stream via virtual node data creation. [AI] Size: 0x08 bytes [AI]
Definition at line 102 of file legotree.h.
LegoTree::LegoTree | ( | ) |
[AI] Constructs an empty tree (root not allocated). [AI]
Definition at line 32 of file legotree.cpp.
|
virtual |
[AI] Recursively destroys all tree nodes and their payloads. [AI]
Definition at line 38 of file legotree.cpp.
|
inlineprotectedvirtual |
[AI] Virtual function to instantiate node payload objects for the tree structure.
[AI]
[AI] Intended for overriding in derived tree classes to allocate node data of specific subclass types; default returns new LegoTreeNodeData().
Reimplemented in LegoAnim.
Definition at line 151 of file legotree.h.
|
protected |
[AI] Recursively deletes an entire subtree starting at the given node.
[AI]
p_node | Node at which to begin deletion (includes all children). [AI] |
Definition at line 106 of file legotree.cpp.
|
inline |
[AI] Returns a pointer to the root node of the tree. [AI]
Definition at line 112 of file legotree.h.
|
virtual |
[AI] Loads the tree structure recursively from the given storage.
[AI]
p_storage | Storage stream to read from. [AI] |
[AI] Recursively constructs tree structure and node payloads using CreateData() and each node's Read(). [AI]
Definition at line 46 of file legotree.cpp.
|
protected |
[AI] Reads a subtree recursively from storage, creating a new node and reading its data/children.
[AI]
p_storage | Reading source. [AI] |
p_node | Reference to pointer which will be assigned to the created node. [AI] |
[AI] Called internally for recursive loading; constructs nodes and their payloads and child pointers. [AI]
Definition at line 58 of file legotree.cpp.
|
inline |
[AI] Assigns the root node pointer for the tree (takes ownership).
[AI]
p_root | Pointer to a LegoTreeNode heap object. [AI] |
Definition at line 117 of file legotree.h.
|
virtual |
[AI] Serializes the tree structure recursively to the given storage.
[AI]
p_storage | Storage stream to write to. [AI] |
[AI] Recursively traverses all nodes and their children, writing data and structure. [AI]
Reimplemented in LegoAnim.
Definition at line 52 of file legotree.cpp.
|
protected |
[AI] Writes a subtree recursively to storage from the given node.
[AI]
p_storage | Target for writing. [AI] |
p_node | Node from which to begin recursive writing. [AI] |
Definition at line 85 of file legotree.cpp.
|
protected |
[AI] Root node of the tree. nullptr if tree is empty. Owned by the tree instance. [AI]
Definition at line 153 of file legotree.h.