2
3
4
5
6
7
8
9
10
11
12
13
14
15
20#include "../ifaces/gimbal_ivariant.h"
21#include "../../containers/gimbal_array_map.h"
24
25
26
33#define GBL_REF(box) (GblBox_ref(GBL_BOX(box)))
34#define GBL_UNREF(box) (GblBox_unref(GBL_AS(GblBox, box)))
36#define GBL_SELF_TYPE GblBox
43
44
45
46
47
48
49
50
51
52
53
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
94
95
96
110
111
112
113
124
125
126
127
147
148
149
154 GblArrayMapDtorFn pFnUdDtor,
160 GblArrayMapDtorFn pFnUdDtor,
165
166
167
168
178
179
180
181
192
193
194
195
212#define GblBoxClass_createFloating(...)
213 GblBoxClass_createFloatingDefault_
(__VA_ARGS__)
214#define GblBoxClass_createFloatingDefault_(...)
216#define GblBoxClass_createFloatingDefault__(type, size, ud, dtor, ...)
217 (GblBoxClass_createFloating
)(type, size, ud, dtor)
219#define GblBoxClass_constructFloating(...)
220 GblBoxClass_constructFloatingDefault_
(__VA_ARGS__)
221#define GblBoxClass_constructFloatingDefault_(...)
223#define GblBoxClass_constructFloatingDefault__(klass, type, ud, dtor, ...)
224 (GblBoxClass_constructFloating
)(klass, type, ud, dtor)
226#define GblBoxClass_setField(...)
227 GblBoxClass_setFieldDefault_
(__VA_ARGS__)
228#define GblBoxClass_setFieldDefault_(...)
229 GblBoxClass_setFieldDefault__
(__VA_ARGS__, GBL_NULL)
230#define GblBoxClass_setFieldDefault__(klass, key, value, dtor, ...)
231 (GblBoxClass_setField
)(klass, key, value, dtor)
233#define GblBox_create(...)
234 GblBox_createDefault_
(__VA_ARGS__)
235#define GblBox_createDefault_(...)
237#define GblBox_createDefault__(type, size, ud, dtor, klass, ...)
238 (GblBox_create
)(type, size, ud, dtor, klass)
240#define GblBox_construct(...)
241 GblBox_constructDefault_
(__VA_ARGS__)
242#define GblBox_constructDefault_(...)
244#define GblBox_constructDefault__(self, type, ud, dtor, klass, ...)
245 (GblBox_construct
)(self, type, ud, dtor, klass)
247#define GblBox_setField(...)
248 GblBox_setFieldDefault_
(__VA_ARGS__)
249#define GblBox_setFieldDefault_(...)
250 GblBox_setFieldDefault__
(__VA_ARGS__, GBL_NULL)
251#define GblBox_setFieldDefault__(self, key, value, dtor, ...)
252 (GblBox_setField
)(self, key, value, dtor)
GblBox * GblBox_create(GblType derived, size_t size, void *pUserdata, GblArrayMapDtorFn pFnUdDtor, GblBoxClass *pClass)
Creates a GblBox instance of the derived type and returns a pointer to it. Has default arguments.
GBL_RESULT GblBox_construct(GblBox *pSelf, GblType derived, void *pUserdata, GblArrayMapDtorFn pFnUdDtor, GblBoxClass *pClass)
Constructs a GblBox instance of the derived type in-place, returning a result status code.
#define GBL_BOX(self)
Casts a GblInstance to GblBox.
GBL_RESULT GblBoxClass_constructFloating(GblBoxClass *pSelf, GblType derivedType, void *pUserdata, GblArrayMapDtorFn pFnUdDtor)
Constructs an extended floating class in-place, setting its properties to the given values....
GblBoxClass * GblBoxClass_createFloating(GblType derivedType, size_t size, void *pUserdata, GblArrayMapDtorFn pFnUdDtor)
Creates an extended floating class, setting its properties to the given values. Has default values.
#define GBL_CLASS_CAST(cType, klass)
#define GBL_FORWARD_DECLARE_STRUCT(S)
#define GBL_INSTANCE_BASE(instance)
#define GBL_TYPEID(instanceStruct)
#define GBL_CLASS_BASE(...)
#define GBL_PRIVATE_BEGIN
#define GBL_PRIVATE_END
Private data structure.
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)
#define GBL_AS(cType, self)
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
uint16_t GblRefCount
Type able to hold a reference counter across the codebase.
uintptr_t GblQuark
Uniquely identifiable interned string type.
GblBool GblBoxClass_clearField(GblBoxClass *pSelf, GblQuark key)
Destroys the generic userdata field value associated with the given key on the class,...
GblArrayMap * pFields
PRIVATE: Internal storage for userdata fields.
uintptr_t GblBoxClass_field(const GblBoxClass *pSelf, GblQuark key)
Returns the generic userdata field value associated with the given key on the class,...
GblType GblBox_type(void)
Returns the GblType UUID associated with GblBox.
void * GblBoxClass_userdata(const GblBoxClass *pSelf)
Returns the void* userdata pointer that has been associated with the given GblBoxClass.
GBL_RESULT GblBoxClass_setUserDestructor(GblBoxClass *pSelf, GblArrayMapDtorFn pFnUdDtor)
Adds an extra destructor callback to the field list, passing the given class back as the destructed v...
GBL_RESULT GblBoxClass_setField(GblBoxClass *pSelf, GblQuark key, uintptr_t ud, GblArrayMapDtorFn pFnDtor)
Sets the generic userdata value and its optional destructor for the given key on the class,...
GblBool GblBoxClass_hasField(const GblBoxClass *pSelf, GblQuark key)
Returns GBL_TRUE if the given class has generic userdata field value associated with the given key.
GBL_RESULT GblBoxClass_setUserdata(GblBoxClass *pSelf, void *pUserdata)
Sets the void* userdata pointer, associating it with the given GblBoxClass.
uintptr_t GblBoxClass_takeField(GblBoxClass *pSelf, GblQuark key)
Extracts the generic userdata field value associated with the given key on the class,...
Minimally bindable GblInstance with reference semantics and opaque userdata.
uintptr_t GblBox_takeField(GblBox *pSelf, GblQuark key)
Extracts the generic userdata field value for the given key, without destroying it.
GBL_RESULT GblBox_setField(GblBox *pSelf, GblQuark key, uintptr_t ud, GblArrayMapDtorFn pFnDtor)
Inserts ud into the the GblBox with the given key and optional destructor, destroying any overwritten...
uintptr_t GblBox_field(const GblBox *pSelf, GblQuark key)
Returns the generic userdata field value for the given GblBox associated with the key.
uint16_t contextType
PRIVATE: GblContext type flag.
GblBool GblBox_hasField(const GblBox *pSelf, GblQuark key)
Returns GBL_TRUE if there is a field value on the given GblBox corresponding to the key.
GBL_RESULT GblBox_setUserdata(GblBox *pSelf, void *pUserdata)
Stores the untyped userdata pointer within the GblBox.
volatile uint16_t refCounter
PRIVATE: Atomic reference counter.
GblBool GblBox_clearField(GblBox *pSelf, GblQuark key)
Clears the field value for the given key, if it exists, calling its destructor (if it has one) and re...
uint16_t constructedInPlace
PRIVATE: Flag for whether memory is deallocated upon destruction.
GblRefCount GblBox_unref(GblBox *pSelf)
Decrements the given GblBox's reference count by 1, destructing it when it hits 0.
uint16_t derivedFlags
PRIVATE: Extra flags for use in derived classes.
void * GblBox_userdata(const GblBox *pSelf)
Returns the userdata pointer stored within the given GblBox.
GblRefCount GblBox_refCount(const GblBox *pSelf)
Returns the number of active references held to the given GblBox.
GblBox * GblBox_ref(GblBox *pSelf)
Increments the given GblBox's reference count by 1, returning a pointer to it.
GBL_RESULT GblBox_setUserDestructor(GblBox *pSelf, GblArrayMapDtorFn pFnUdDtor)
Sets an additional user destructor to be invoked with the GblBox passed back to it when its being des...
GblArrayMap * pFields
PRIVATE: Storage for extended userdata fields.