|
CX Framework
Cross-platform C utility framework
|
Macros | |
| #define | ssdClone(root, desttree) _ssdClone(root, desttree, (SSDLockState*)_ssdCurrentLockState) |
| #define | ssdSubtree(root, path, create) _ssdSubtree(root, path, create, (SSDLockState*)_ssdCurrentLockState) |
| #define | ssdSubtreeB(root, path) _ssdSubtreeB(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState) |
Functions for cloning trees and accessing/creating subtrees.
| #define ssdClone | ( | root, | |
| desttree | |||
| ) | _ssdClone(root, desttree, (SSDLockState*)_ssdCurrentLockState) |
SSDNode *ssdClone(SSDNode *root, SSDTree *desttree)
Creates a deep clone of the entire tree rooted at the given node.
If desttree is provided, the cloned nodes are associated with that tree, creating an isolated branch that can later be grafted onto the destination tree. If desttree is NULL, a new independent tree is created.
| root | The node to clone |
| desttree | Optional destination tree to associate cloned nodes with |
| #define ssdSubtree | ( | root, | |
| path, | |||
| create | |||
| ) | _ssdSubtree(root, path, create, (SSDLockState*)_ssdCurrentLockState) |
SSDNode *ssdSubtree(SSDNode *root, strref path, SSDCreateType create)
Returns a node representing a subtree at the given path, optionally creating it.
This function traverses the path and returns the node at that location. If the node does not exist and create is not SSD_Create_None, a new node of the specified type is created at that path.
| root | The root node to search from |
| path | The path to the subtree (e.g., "bucket/paints[2]") |
| create | Node type to create if path doesn't exist (SSD_Create_None to disable creation) |
Example:
| #define ssdSubtreeB | ( | root, | |
| path | |||
| ) | _ssdSubtreeB(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState) |
SSDNode *ssdSubtreeB(SSDNode *root, strref path)
Borrowed version of ssdSubtree that does not acquire an object reference.
IMPORTANT: This function must only be used within a locked transaction via ssdLockedTransaction(). The returned pointer is only valid while the lock is held. This version cannot create nodes and is intended for read-only access.
| root | The root node to search from |
| path | The path to the subtree |