CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Pointer Access (Lock Required)

Macros

#define ssdPtr(root, path)    _ssdPtr(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState)
 
#define ssdStrRef(root, path)    _ssdStrRef(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState)
 
#define ssdObjInstPtr(root, path)    _ssdObjInstPtr(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState)
 
#define ssdObjPtr(root, path, clsname)   objDynCast(clsname, ssdObjInstPtr(root, path))
 

Detailed Description

Functions that return pointers to internal storage. These require explicit locking via ssdLockedTransaction() and are only valid while the lock is held.

Macro Definition Documentation

◆ ssdObjInstPtr

#define ssdObjInstPtr (   root,
  path 
)     _ssdObjInstPtr(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState)

ObjInst *ssdObjInstPtr(SSDNode *root, strref path)

Returns an object instance pointer directly from internal storage.

CRITICAL: This function MUST be used within a ssdLockedTransaction(). The pointer is only valid while the lock is held.

Parameters
rootThe root node
pathPath to the object value
Returns
Object instance pointer, or NULL if not found or wrong type

Definition at line 519 of file ssdtree.h.

◆ ssdObjPtr

#define ssdObjPtr (   root,
  path,
  clsname 
)    objDynCast(clsname, ssdObjInstPtr(root, path))

ClassName *ssdObjPtr(SSDNode *root, strref path, ClassName)

Returns a typed object pointer with runtime type checking.

This is a convenience wrapper around ssdObjInstPtr() that performs a dynamic cast to the specified class type.

Parameters
rootThe root node
pathPath to the object value
clsnameThe class name to cast to
Returns
Typed object pointer, or NULL if not found, wrong type, or cast fails

Definition at line 533 of file ssdtree.h.

◆ ssdPtr

#define ssdPtr (   root,
  path 
)     _ssdPtr(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState)

stvar *ssdPtr(SSDNode *root, strref path)

Returns a pointer to the internal stvar storage at the specified path.

CRITICAL: This function MUST be used within a ssdLockedTransaction() or manual lock. The pointer is only valid while the lock is held. Accessing it after the lock is released results in undefined behavior.

Parameters
rootThe root node
pathPath to the value
Returns
Pointer to internal stvar, or NULL if not found

Example:

stvar *val = ssdPtr(root, _S"config/timeout");
if (val && stvarIs(val, int32)) {
// use val->data.st_int32
}
}
#define ssdLockedTransaction(root)
Definition ssdshared.h:186
#define ssdPtr(root, path)
Definition ssdtree.h:479
#define _S
Creates a static ASCII string from a string literal.
Definition strbase.h:392
#define stvarIs(svar, type)
Definition stvar.h:267
#define stvar(typen, val)
Definition stvar.h:153

Definition at line 479 of file ssdtree.h.

◆ ssdStrRef

#define ssdStrRef (   root,
  path 
)     _ssdStrRef(root, path, (SSDLockState*)&_ssdCurrentLockState->_is_SSDLockState)

strref ssdStrRef(SSDNode *root, strref path)

Returns a string reference directly from internal storage.

CRITICAL: This function MUST be used within a ssdLockedTransaction(). The string reference is only valid while the lock is held.

Parameters
rootThe root node
pathPath to the string value
Returns
String reference, or NULL if not found or wrong type

Definition at line 499 of file ssdtree.h.