|
CX Framework
Cross-platform C utility framework
|
Modules | |
| File Operations | |
| Variable Binding | |
| Settings Access | |
Data Structures | |
| struct | SetsBindSpec |
Typedefs | |
| typedef struct SetsBindSpec | SetsBindSpec |
The Settings module extends the SSD tree system to provide persistent configuration storage with automatic background flushing and optional variable binding.
Key Features:
Basic Usage:
Variable Binding:
The settings module can bind specific paths to program variables, allowing automatic two-way synchronization. When a setting is read, the bound variable is updated. When the bound variable changes, the setting is updated at the next flush interval.
Supported Types for Binding:
boolint8, int16, int32, int64, uint8, uint16, uint32 (but not uint64)float32 (float), float64 (double)string (copy-on-write strings)Integration with SSD Tree:
The settings module is built on top of the SSD tree system and uses specialized node classes:
SettingsTree: Extends SSDTree to add file persistence, flush intervals, and background thread managementSettingsHashNode: Extends SSDHashNode to add variable binding capabilitiesAll standard SSD tree operations work on settings trees, including path-based access, subtree operations, and locking. The settings module overrides node factories to ensure hashtable nodes are created as SettingsHashNode instances with binding support.
Thread Safety:
Settings trees inherit the thread-safe locking mechanisms from SSD trees. A dedicated background thread monitors all open settings trees and periodically checks for changes and flushes modified trees to disk.
| typedef struct SetsBindSpec SetsBindSpec |
Binding specification for connecting settings paths to program variables.
Used with setsBind() to establish two-way synchronization between settings and variables. The array must be terminated with a {0} entry (NULL name).