CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Semi-Structured Data

Modules

 Locking
 
 Tree Creation
 
 Subtree Operations
 
 Path Syntax
 
 Value Access
 
 Value Modification
 
 Pointer Access (Lock Required)
 
 Array Operations
 
 Advanced Operations
 

Detailed Description

The Semi-Structured Data (SSD) module provides a flexible tree structure for storing hierarchical data similar to JSON. It supports hashtables (objects), arrays, and single values as nodes. The tree is fully thread-safe with reader-writer locks and supports complex operations like path-based traversal, cloning, and grafting subtrees.

Key Features:

Basic Usage:

// Create a hashtable tree
SSDNode *root = ssdCreateHashtable();
// Set values using paths
ssdSet(root, _S"user/name", true, stvar(string, _S"Alice"));
ssdSet(root, _S"user/age", true, stvar(int32, 30));
// Get values
int32 age = ssdVal(int32, root, _S"user/age", 0);
// Use within locked transactions for thread safety
strref name = ssdStrRef(root, _S"user/name");
// ... use name while lock is held
}
// Clean up
objRelease(&root);
#define objRelease(pinst)
Definition objclass.h:223
#define ssdVal(type, root, path, def)
Definition ssdtree.h:343
#define ssdCreateHashtable(...)
Definition ssdtree.h:34
#define ssdLockedTransaction(root)
Definition ssdshared.h:186
#define ssdSet(root, path, createpath, val)
Definition ssdtree.h:415
#define ssdStrRef(root, path)
Definition ssdtree.h:499
#define _S
Creates a static ASCII string from a string literal.
Definition strbase.h:392
#define stvar(typen, val)
Definition stvar.h:153

Path Syntax: Paths use '/' separators and array indices in brackets:

Locking: Most operations automatically manage locks, but pointer-returning functions like ssdPtr() and ssdStrRef() require explicit lock management via ssdLockedTransaction() or manual locking with ssdLockRead()/ssdLockWrite().