CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
settingshashnode.h
1#pragma once
2// This header file is auto-generated!
3// Do not make changes to this file or they will be overwritten.
4// clang-format off
5#include <cx/obj.h>
6#include <cx/ssdtree/node/ssdhashnode.h>
7
8typedef struct SettingsHashNode SettingsHashNode;
9typedef struct SettingsHashNode_WeakRef SettingsHashNode_WeakRef;
10saDeclarePtr(SettingsHashNode);
11saDeclarePtr(SettingsHashNode_WeakRef);
12
13typedef struct SettingsBind {
14 stype type; // type of bound variable
15 stgeneric *var; // pointer to bound variable
16 stgeneric cache; // cached copy for change detection
17 stgeneric def; // default value
18
19 bool userset; // explicitly overridden, even if it's the default value
20} SettingsBind;
21
22typedef struct SettingsHashNode_ClassIf {
23 ObjIface* _implements;
24 ObjIface* _parent;
25 size_t _size;
26
27 // This node is an object that contains values or objects by name
28 bool (*isHashtable)(_In_ void* self);
29 // This node is an array that contains values or objects by array index
30 bool (*isArray)(_In_ void* self);
31 // Gets a value. Caller owns the value and must destroy it with stDestroy!
32 bool (*get)(_In_ void* self, int32 idx, _In_opt_ strref name, _When_(return == true, _Out_) stvar* out, _Inout_ SSDLockState* _ssdCurrentLockState);
33 // Gets a pointer to a value. This points to the internal storage within the node
34 // so it is only guaranteed to be valid while the read lock is held.
35 _Ret_opt_valid_ stvar* (*ptr)(_In_ void* self, int32 idx, _In_opt_ strref name, _Inout_ SSDLockState* _ssdCurrentLockState);
36 // Sets the given value
37 bool (*set)(_In_ void* self, int32 idx, _In_opt_ strref name, stvar val, _Inout_ SSDLockState* _ssdCurrentLockState);
38 // Same as setValue but consumes the value
39 // (consumes even on failure)
40 bool (*setC)(_In_ void* self, int32 idx, _In_opt_ strref name, _Inout_ stvar* val, _Inout_ SSDLockState* _ssdCurrentLockState);
41 // Removes a value
42 bool (*remove)(_In_ void* self, int32 idx, _In_opt_ strref name, _Inout_ SSDLockState* _ssdCurrentLockState);
43 // How many values / objects does this node contain?
44 int32 (*count)(_In_ void* self, _Inout_ SSDLockState* _ssdCurrentLockState);
45 // IMPORTANT NOTE: The generic object iterator interface cannot take any parameters;
46 // thus it always acquires a transient read lock and holds it until the iterator is
47 // destroyed. The caller MUST NOT already have an SSDLock held.
48 // If you want to use iterators inside a larger locked transaction or modify the tree,
49 // use iterLocked() instead.
50 _Ret_valid_ SSDIterator* (*iter)(_In_ void* self);
51 SSDIterator* (*_iterLocked)(_In_ void* self, _Inout_ SSDLockState* _ssdCurrentLockState);
52 bool (*bind)(_In_ void* self, _In_opt_ strref name, stype btyp, void* bvar, stgeneric bdef, SSDLockState* _ssdCurrentLockState);
53 // check a single bound variable for changes
54 void (*checkBound)(_In_ void* self, _In_opt_ strref name, SSDLockState* _ssdCurrentLockState);
55 // check for bound variables that have changed
56 void (*checkAll)(_In_ void* self, SSDLockState* _ssdCurrentLockState);
57 void (*unbindAll)(_In_ void* self, SSDLockState* _ssdCurrentLockState);
58} SettingsHashNode_ClassIf;
59extern SettingsHashNode_ClassIf SettingsHashNode_ClassIf_tmpl;
60
61typedef struct SettingsHashNode {
62 union {
63 SettingsHashNode_ClassIf* _;
64 void* _is_SettingsHashNode;
65 void* _is_SSDHashNode;
66 void* _is_SSDNode;
67 void* _is_ObjInst;
68 };
69 ObjClassInfo* _clsinfo;
70 atomic(uintptr) _ref;
71 atomic(ptr) _weakref;
72
73 SSDTree* tree;
74 int64 modified; // The timestamp this node was last modified
75 hashtable storage;
76 hashtable binds;
77} SettingsHashNode;
78extern ObjClassInfo SettingsHashNode_clsinfo;
79#define SettingsHashNode(inst) ((SettingsHashNode*)(unused_noeval((inst) && &((inst)->_is_SettingsHashNode)), (inst)))
80#define SettingsHashNodeNone ((SettingsHashNode*)NULL)
81
82typedef struct SettingsHashNode_WeakRef {
83 union {
84 ObjInst* _inst;
85 void* _is_SettingsHashNode_WeakRef;
86 void* _is_SSDHashNode_WeakRef;
87 void* _is_SSDNode_WeakRef;
88 void* _is_ObjInst_WeakRef;
89 };
90 atomic(uintptr) _ref;
91 RWLock _lock;
92} SettingsHashNode_WeakRef;
93#define SettingsHashNode_WeakRef(inst) ((SettingsHashNode_WeakRef*)(unused_noeval((inst) && &((inst)->_is_SettingsHashNode_WeakRef)), (inst)))
94
95_objfactory_guaranteed SettingsHashNode* SettingsHashNode__create(SSDTree* tree);
96// SettingsHashNode* settingshashnode_create(SSDTree* tree);
97#define settingshashnode_create(tree) SettingsHashNode__create(SSDTree(tree))
98
99// void settingshashnodeUpdateModified(SettingsHashNode* self);
100#define settingshashnodeUpdateModified(self) SSDNode_updateModified(SSDNode(self))
101
102// bool settingshashnodeIsHashtable(SettingsHashNode* self);
103//
104// This node is an object that contains values or objects by name
105#define settingshashnodeIsHashtable(self) (self)->_->isHashtable(SettingsHashNode(self))
106// bool settingshashnodeIsArray(SettingsHashNode* self);
107//
108// This node is an array that contains values or objects by array index
109#define settingshashnodeIsArray(self) (self)->_->isArray(SettingsHashNode(self))
110// bool settingshashnodeGet(SettingsHashNode* self, int32 idx, strref name, stvar* out, SSDLockState* _ssdCurrentLockState);
111//
112// Gets a value. Caller owns the value and must destroy it with stDestroy!
113#define settingshashnodeGet(self, idx, name, out, _ssdCurrentLockState) (self)->_->get(SettingsHashNode(self), idx, name, out, _ssdCurrentLockState)
114// stvar* settingshashnodePtr(SettingsHashNode* self, int32 idx, strref name, SSDLockState* _ssdCurrentLockState);
115//
116// Gets a pointer to a value. This points to the internal storage within the node
117// so it is only guaranteed to be valid while the read lock is held.
118#define settingshashnodePtr(self, idx, name, _ssdCurrentLockState) (self)->_->ptr(SettingsHashNode(self), idx, name, _ssdCurrentLockState)
119// bool settingshashnodeSet(SettingsHashNode* self, int32 idx, strref name, stvar val, SSDLockState* _ssdCurrentLockState);
120//
121// Sets the given value
122#define settingshashnodeSet(self, idx, name, val, _ssdCurrentLockState) (self)->_->set(SettingsHashNode(self), idx, name, val, _ssdCurrentLockState)
123// bool settingshashnodeSetC(SettingsHashNode* self, int32 idx, strref name, stvar* val, SSDLockState* _ssdCurrentLockState);
124//
125// Same as setValue but consumes the value
126// (consumes even on failure)
127#define settingshashnodeSetC(self, idx, name, val, _ssdCurrentLockState) (self)->_->setC(SettingsHashNode(self), idx, name, val, _ssdCurrentLockState)
128// bool settingshashnodeRemove(SettingsHashNode* self, int32 idx, strref name, SSDLockState* _ssdCurrentLockState);
129//
130// Removes a value
131#define settingshashnodeRemove(self, idx, name, _ssdCurrentLockState) (self)->_->remove(SettingsHashNode(self), idx, name, _ssdCurrentLockState)
132// int32 settingshashnodeCount(SettingsHashNode* self, SSDLockState* _ssdCurrentLockState);
133//
134// How many values / objects does this node contain?
135#define settingshashnodeCount(self, _ssdCurrentLockState) (self)->_->count(SettingsHashNode(self), _ssdCurrentLockState)
136// SSDIterator* settingshashnodeIter(SettingsHashNode* self);
137//
138// IMPORTANT NOTE: The generic object iterator interface cannot take any parameters;
139// thus it always acquires a transient read lock and holds it until the iterator is
140// destroyed. The caller MUST NOT already have an SSDLock held.
141// If you want to use iterators inside a larger locked transaction or modify the tree,
142// use iterLocked() instead.
143#define settingshashnodeIter(self) (self)->_->iter(SettingsHashNode(self))
144// SSDIterator* settingshashnode_iterLocked(SettingsHashNode* self, SSDLockState* _ssdCurrentLockState);
145#define settingshashnode_iterLocked(self, _ssdCurrentLockState) (self)->_->_iterLocked(SettingsHashNode(self), _ssdCurrentLockState)
146// bool settingshashnodeBind(SettingsHashNode* self, strref name, stype btyp, void* bvar, stgeneric bdef, SSDLockState* _ssdCurrentLockState);
147#define settingshashnodeBind(self, name, btyp, bvar, bdef, _ssdCurrentLockState) (self)->_->bind(SettingsHashNode(self), name, btyp, bvar, bdef, _ssdCurrentLockState)
148// void settingshashnodeCheckBound(SettingsHashNode* self, strref name, SSDLockState* _ssdCurrentLockState);
149//
150// check a single bound variable for changes
151#define settingshashnodeCheckBound(self, name, _ssdCurrentLockState) (self)->_->checkBound(SettingsHashNode(self), name, _ssdCurrentLockState)
152// void settingshashnodeCheckAll(SettingsHashNode* self, SSDLockState* _ssdCurrentLockState);
153//
154// check for bound variables that have changed
155#define settingshashnodeCheckAll(self, _ssdCurrentLockState) (self)->_->checkAll(SettingsHashNode(self), _ssdCurrentLockState)
156// void settingshashnodeUnbindAll(SettingsHashNode* self, SSDLockState* _ssdCurrentLockState);
157#define settingshashnodeUnbindAll(self, _ssdCurrentLockState) (self)->_->unbindAll(SettingsHashNode(self), _ssdCurrentLockState)
158
#define saDeclarePtr(name)
Definition sarray.h:98
#define _objfactory_guaranteed
Definition objimpl.h:104
#define stvar(typen, val)
Definition stvar.h:153
CX Object System - Object-oriented programming in C.