CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Subtree Operations

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)
 

Detailed Description

Functions for cloning trees and accessing/creating subtrees.

Macro Definition Documentation

◆ ssdClone

#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.

Parameters
rootThe node to clone
desttreeOptional destination tree to associate cloned nodes with
Returns
A new SSDNode that is a deep copy of root (must be released with objRelease)

Definition at line 104 of file ssdtree.h.

◆ ssdSubtree

#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.

Parameters
rootThe root node to search from
pathThe path to the subtree (e.g., "bucket/paints[2]")
createNode type to create if path doesn't exist (SSD_Create_None to disable creation)
Returns
The subtree node (caller must release with objRelease), or NULL if not found

Example:

SSDNode *subtree = ssdSubtree(root, _S"config/display", SSD_Create_Hashtable);
ssdSet(subtree, _S"width", true, stvar(int32, 1920));
objRelease(&subtree);
#define objRelease(pinst)
Definition objclass.h:223
@ SSD_Create_Hashtable
Create a hashtable (key-value) node.
Definition ssdshared.h:26
#define ssdSet(root, path, createpath, val)
Definition ssdtree.h:415
#define ssdSubtree(root, path, create)
Definition ssdtree.h:128
#define _S
Creates a static ASCII string from a string literal.
Definition strbase.h:392
#define stvar(typen, val)
Definition stvar.h:153

Definition at line 128 of file ssdtree.h.

◆ ssdSubtreeB

#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.

Parameters
rootThe root node to search from
pathThe path to the subtree
Returns
Borrowed pointer to the subtree node (do not release), or NULL if not found

Definition at line 145 of file ssdtree.h.