GGUI/Public/NodeStorage.h file

NodeStorage: the UI tree.

Nodes are rows in 64-slot chunks, structure-of-arrays within each chunk (the same shape as the engine's cold entity data). Chunks are allocated on demand and freed when empty. A node never moves, so its index is stable for its lifetime.

NodeIndex    chunk * 64 + slot; what rows and links store
NodeHandle   index + generation; what everything outside the storage holds. A stale handle
             is detected rather than resolving to whatever reused the slot.

Destroying a node destroys its subtree. Handles go stale immediately, but slots are only reused after a recycle window, so a published snapshot still being read never sees a slot change identity.

Single writer (the UI update). Other threads go through MutationQueue.

Namespaces

namespace GGUI

Classes

struct GGUI::NodeHandle
A node, as everything outside the storage holds it: its slot and the generation of the slot, so a stale handle is told apart from whatever reused the slot.
struct GGUI::NodeChunk
64 nodes, structure-of-arrays. One bit per slot in each mask. Defined in the header so node lookups inline.
struct GGUI::NodeStorageListener
Notified of every tree change, whoever makes it. Anything keeping per-node rows beside the storage listens here to reset them.
class GGUI::NodeStorage
The nodes of one document, and how they are joined. See the file description.