2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
27#include "../../strings/gimbal_quark.h"
31#define GBL_INVALID_TYPE ((GblType)0
)
33#define GBL_SELF_TYPE GblType
42
43
44
45
46
47
48
49
50
53typedef GBL_RESULT (*GblClassInitFn) (GblClass*,
const void*);
54typedef GBL_RESULT (*GblClassFinalFn) (GblClass*,
const void*);
55typedef GBL_RESULT (*GblInstanceInitFn)(GblInstance*);
94
95
96
100 const GblTypeInfo* pInfo,
111
112
113
121
122
123
137
138
139
147
148
149
161
162
163
#define GBL_FORWARD_DECLARE_STRUCT(S)
GblBool GblType_conforms(GblType self, GblType dependent)
Returns true if the given type meets all type dependencies for the dependent type.
GblType GblType_ancestor(GblType self, size_t level)
Similar to GblType_base(), but in the reverse direction. level 0 is identity.
GblType GblType_common(GblType self, GblType other)
Returns the most-derived, deepest common-type between the given type and other.
GblType GblType_findQuark(GblQuark quark)
Queries the registry for a GblType using a GblQuark of its type name (faster)
GblRefCount GblType_classRefCount(GblType self)
Returns the reference counter for the given GblType's internally-managed default GblClass.
GblBool GblType_maps(GblType self, GblType iface)
Returns true if the given type's class contains an implementation of the iface interface.
GblBool GblType_derives(GblType self, GblType superType)
Returns GBL_TRUE if the given type is a subtype, inheriting from superType.
GBL_RESULT GblType_unregister(GblType type)
Unregisters a type from the type system. Typically not done, better not be used.
GblType GblType_parent(GblType self)
Returns the given type's parent's GblType or GBL_INVALID_TYPE if it's a root type.
size_t GblType_count(void)
Returns the total number of types registered to the type system.
GblBool GblType_depends(GblType self, GblType dependency)
Returns GBL_TRUE if the given type depends on the dependency type.
GblBool GblType_implements(GblType self, GblType ifaceType)
Returns GBL_TRUE if the given type has implemented ifaceType.
GblType GblType_base(GblType self, size_t depth)
Returns the base GblType of the given GblType, where a depth of 0 is its root.
GblQuark GblType_nameQuark(GblType self)
Returns the type name quark associated with the given GblType.
GblType GblType_find(const char *pName)
Queries the internal type registry for a GblType by its type name.
GblBool GblType_check(GblType self, GblType other)
Returns GBL_TRUE if the given type can be safely cast to the other type.
GblFlags GblType_flags(GblType self)
Returns the combined flags for a given type, including flags it has inherited.
size_t GblType_depth(GblType self)
Returns the depth of the given GblType, where a depth of 0 means it's a root type.
GblTypeFlags
Flags controlling behavior of GblTypes. These can be set at any level in a type heirarchy.
@ GBL_TYPE_FLAG_TYPEINFO_STATIC
Type's GblTypeInfo specified upon registration is static, so no internal storage has to be allocated ...
@ GBL_TYPE_FLAGS_MASK
Mask of all user type flags.
@ GBL_TYPE_FLAG_CLASS_PREINIT
Type's GblClass should be constructed immediately, rather than lazily upon use by default.
@ GBL_TYPE_FLAG_FINAL
Type cannot be derived from.
@ GBL_TYPE_FLAGS_NONE
Type which adds no additional flags beyond what's inherited.
@ GBL_TYPE_FLAG_CLASS_PINNED
Type's GblClass is never destroyed and remains persistent upon construction.
@ GBL_TYPE_FLAG_ABSTRACT
Type cannot be instantiated without being derived.
@ GBL_TYPE_FLAG_BUILTIN
Type was automatically registered as a builtin type (do not use on a new type)
@ GBL_TYPE_FLAG_UNMAPPABLE
Cannot obtain Type's associated GblInterface from a GblClass it has been mapped to.
@ GBL_TYPE_FLAG_INCOMPLETE
Incomplete/partial type missing some type dependency.
const GblTypeInfo * GblType_info(GblType self)
Returns the GblTypeInfo struct for the given type, containing its meta information.
GblRefCount GblType_instanceCount(GblType self)
Returns the number of active instances of the given GblType.
const char * GblType_name(GblType self)
Returns the type name string associated with the given GblType.
GblType GblType_next(GblType previousType)
Iterates over the registry by passing a previously returned type or GBL_TYPE_INVALID initially.
GblBool GblType_verify(GblType self)
Returns GBL_TRUE if the given type is a valid, registred type.
GblType GblType_register(const char *pName, GblType baseType, const GblTypeInfo *pInfo, GblFlags flags)
Registers a new type with the given information, returning a unique identifier for it.
GblType GblType_root(GblType self)
Returns the root parent GblType of the given GblType.
uint32_t GblFlags
Standard-sized flags type, 32-bits across platforms.
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.
Provides implementation details of a GblInterface for a type.
size_t classOffset
offset of the GblInterface into GblClass (using offsetof())
GblType interfaceType
GblType of the implemented GblInterface.
Provides type information when registering a new GblType.
size_t classPrivateSize
Size of extra private storage to be associated with a GblType's GblClass.
uint8_t dependencyCount
Number of dependent GblTypes in pDependencies array.
const GblInterfaceImpl * pInterfaceImpls
Array providing information for each interface implemented by the type.
GblClassInitFn pFnClassInit
Function used to initialize the values a GblType's associated GblClass.
GblInstanceInitFn pFnInstanceInit
Function used to initialize the values a GblType's associated GblInstance.
const void * pClassData
Size of extra private storage to be associated with a GblType's GblClass.
GblClassFinalFn pFnClassFinal
Function used to finalize the values of a GblType's associated GblClass.
size_t classSize
Size of a GblType's associated GblClass structure.
uint8_t interfaceCount
Number of GblInterface mappings in pInterfaceImpls array.
size_t instanceSize
Size of a GblType's associated GblInstance structure.
size_t instancePrivateSize
Size of extra private storage to be associated with a GblType's GblInstance.
const GblType * pDependencies
Array providing a list of type dependencies that must be implemented a GblType.