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, _SL("user/name"), true, stvar(string, _SL("Alice")));
ssdSet(root, _SL("user/age"), true, stvar(int32, 30));
// Get values
int32 age = ssdVal(int32, root, _SL("user/age"), 0);
// Use within locked transactions for thread safety
strref name = ssdStrRef(root, _SL("user/name"));
// ... use name while lock is held
}
// Clean up
objRelease(&root);
#define objRelease(pinst)
Definition objclass.h:257
#define ssdVal(type, root, path, def)
Definition ssdtree.h:345
#define ssdCreateHashtable(...)
Definition ssdtree.h:36
#define ssdLockedTransaction(root)
Definition ssdshared.h:197
#define ssdSet(root, path, createpath, val)
Definition ssdtree.h:417
#define ssdStrRef(root, path)
Definition ssdtree.h:501
#define _SL(s)
Inline ASCII string literal with compile-time embedded length (STR_LEN8). Content must be < 200 bytes...
Definition strliteral.h:207
#define stvar(typen, val)
Definition stvar.h:162

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().