libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
Go to the source code of this file.
Data Structures | |
struct | GblClass |
Functions | |
Default Class Management | |
Methods for managing references to internally-managed default class instances | |
GblClass * | GblClass_refDefault (GblType type) |
GblRefCount | GblClass_unrefDefault (GblClass *pSelf) |
GblClass * | GblClass_weakRefDefault (GblType type) |
Floating Class Mangement | |
Methods for managing lifetime of dynamic override class instances | |
GblClass * | GblClass_createFloating (GblType type, size_t size) |
GBL_RESULT | GblClass_constructFloating (GblClass *pSelf, GblType type) |
GBL_RESULT | GblClass_destroyFloating (GblClass *pSelf) |
GBL_RESULT | GblClass_destructFloating (GblClass *pSelf) |
GblClass virtual-table structure and APIE.
This file contains the GblClass structure, which is the inherited base type and first data member of all derievd class structures.
While GblClass itself is empty other than its basic type info, a derived class typically contains data which is shared by all instances of a type, for deduplication and efficiency.
This data is typically in the form of:
Definition in file gimbal_class.h.
Returns a reference to the default class for type
, instantiating it if necessary.
Returns a new reference to the existing internally managed default class for the given type or lazily allocates a new one with an initial refCount of 1.
type | classed type ID |
GblRefCount GblClass_unrefDefault | ( | GblClass * | pSelf | ) |
Releases a reference to the default version of the given class, possibly freeing it.
Release a reference to the default class associated with pSelf, destroying the class if it's reference count hits 0.
pSelf | reference to class |
Returns a reference to the default class for type
or NULL if it hasn't been created.
Returns a pointer to the default class for the given type without incrementing refCount.
type | type of desired class |
Creates a standalone, unowned, "floating" class for the given type, which can override defaults.
GBL_RESULT GblClass_constructFloating | ( | GblClass * | pSelf, |
GblType | type | ||
) |
Constructs a standalone, unowned, overridable, "floating" class for the given type in-place.
Placement constructs an unowned class for the given type using an existing user-provided allocation.
pSelf | pointer to instance allocation |
type | type of instance to construct |
GBL_RESULT GblClass_destroyFloating | ( | GblClass * | pSelf | ) |
Destroys the standalone, "floating" class, releasing its memory allocation.
Destructs then frees the given heap-allocated, floating class.
pSelf | GblClass pointer |
GBL_RESULT GblClass_destructFloating | ( | GblClass * | pSelf | ) |
Destructs the standalone, "floating" class, without releasing any allocated resources.
Calls placement delete on the given floating class which was constructed in-place, using GblClass_constructFloating.
It is safe to call this function with a NULL class, as libGimbal tries to be consistent with free() semantics.
pSelf | class pointer |