Honeycomb
0.1
Component-Model Framework
|
Clone and track changes to an entire tree. More...
#include <TreeClone.h>
Public Member Functions | |
TreeClone () | |
~TreeClone () | |
TreeNode & | regNode (const TreeNode &rootNode) |
Register a node to clone. Returns clone. Clone's state is invalid (not equal to original) until update() is called. More... | |
TreeNode * | unregNode (const TreeNode &rootNode) |
Stop tracking changes to a node and its entire subtree. Returns clone of first node unregistered (or null if none found). More... | |
const TreeNode * | unregClone (const TreeNode &rootClone) |
Stop a clone and its entire subtree from tracking changes to their original nodes. Returns original node of first clone unregistered (or null if none found). More... | |
void | update () |
Update clones to make them mirror the current data and hierarchy of registered nodes. More... | |
void | clear () |
Reset the state of the tree clone structure, unregister all nodes and destroy all clones. More... | |
TreeNode * | getClone (const TreeNode &node) const |
Get the cloned version of a node (node may be registered or unregistered). Returns null if not found. More... | |
const TreeNode * | getOrigNode (const TreeNode &clone) const |
Get the original node of a clone. Returns null if not found. More... | |
bool | isRegNode (const TreeNode &node) const |
Check if a node is registered. More... | |
bool | isRegClone (const TreeNode &clone) const |
Check if a clone is registered. More... | |
szt | cloneCount () const |
Get total number of clones being handled by this tree. More... | |
szt | regNodeCount () const |
Get total number of registered nodes. More... | |
Clone and track changes to an entire tree.
|
inline |
|
inline |
|
inline |
Reset the state of the tree clone structure, unregister all nodes and destroy all clones.
|
inline |
Get total number of clones being handled by this tree.
|
inline |
Get the cloned version of a node (node may be registered or unregistered). Returns null if not found.
|
inline |
Get the original node of a clone. Returns null if not found.
|
inline |
Check if a clone is registered.
|
inline |
Check if a node is registered.
|
inline |
Register a node to clone. Returns clone. Clone's state is invalid (not equal to original) until update() is called.
Cloned nodes will track changes to the data and hierarchy of the original node. Any subtrees formed under the original node are automatically tracked and mirrored in the clone.
While registered, the only type of clone safe to be tampered with is a "root clone". A root clone is a clone whose parent is not registered. A root clone is special because it can be attached as a child to any other tree. Do not perform any other operations to registered clones.
Warning: if an original node is destroyed while still registered, then its clone will also be destroyed on the next update() call.
|
inline |
Get total number of registered nodes.
|
inline |
Stop a clone and its entire subtree from tracking changes to their original nodes. Returns original node of first clone unregistered (or null if none found).
This function will fail if rootClone's parent is registered.
|
inline |
Stop tracking changes to a node and its entire subtree. Returns clone of first node unregistered (or null if none found).
This function will fail if rootNode's parent is registered (branches of registered trees can't be detached).
Clone and its subtree are free to be used like normal nodes. Resources for clone and its subtree are held by this class.
Warning: If the original node is re-registered or attached to a registered tree then it will automatically use the same clone resource again. Clones in use are not to be tampered with (check isRegClone).
|
inline |
Update clones to make them mirror the current data and hierarchy of registered nodes.