libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
#include <gimbal_instance.h>
Data Fields | |
GblClass * | pClass |
Related Symbols | |
(Note that these are not member symbols.) | |
GblRefCount | GblInstance_destroy (GblInstance *pSelf) |
Instance Operators | |
Builtin operations for Instance-derived types | |
#define | GBL_TYPEOF(self) |
#define | GBL_PRIVATE(cType, self) |
#define | GBL_PUBLIC(cType, selfPriv) |
#define | GBL_TYPECHECK(cType, self) |
#define | GBL_CAST(cType, self) |
#define | GBL_AS(cType, self) |
#define | GBL_CLASSOF(cType, self) |
#define | GBL_CLASSOF_AS(cType, self) |
#define | GBL_VCALL(cType, method, ...) |
#define | GBL_VCALL_DEFAULT(cType, method, ...) |
Type Conversions | |
Methods for type casting and checking | |
GblBool | GblInstance_check (const GblInstance *pSelf, GblType toType) |
GblInstance * | GblInstance_cast (GblInstance *pSelf, GblType toType) |
GblInstance * | GblInstance_as (GblInstance *pSelf, GblType toType) |
Public and Private Data | |
Methods for accessing public and private segments | |
void * | GblInstance_private (const GblInstance *pSelf, GblType base) |
GblInstance * | GblInstance_public (const void *pPriv, GblType base) |
Type Info | |
Methods for getting instance information | |
GblType | GblInstance_typeOf (const GblInstance *pSelf) |
size_t | GblInstance_size (const GblInstance *pSelf) |
size_t | GblInstance_privateSize (const GblInstance *pSelf) |
size_t | GblInstance_totalSize (const GblInstance *pSelf) |
Classes | |
Methods for managing classes | |
GblClass * | GblInstance_class (const GblInstance *pSelf) |
GBL_RESULT | GblInstance_swizzleClass (GblInstance *pSelf, GblClass *pClass) |
GBL_RESULT | GblInstance_sinkClass (GblInstance *pSelf) |
GBL_RESULT | GblInstance_floatClass (GblInstance *pSelf) |
Base struct for all instantiable meta types.
An Instance simply represents an object that can be created from a given GblType which shares some data with other instances of the same type, located within their class.
GblInstance is the base structure which is to be inherited by instances of all instantiable types. This means placing it or a type inheriting from it as the first member of an instance struct.
Definition at line 79 of file gimbal_instance.h.
|
related |
Returns the type UUID for a GblInstance.
Definition at line 37 of file gimbal_instance.h.
|
related |
Wraps GblInstance_private(), passing the given type and returning its private structure.
Definition at line 39 of file gimbal_instance.h.
|
related |
Wraps GblInstance_public(), passing the given type, and returning its public struct.
Definition at line 41 of file gimbal_instance.h.
|
related |
Returns GBL_TRUE if the instance can be casted to the given type safely.
Definition at line 43 of file gimbal_instance.h.
|
related |
Wraps GblInstance_cast() for the given type, implementing a convenient cast operator.
Definition at line 45 of file gimbal_instance.h.
|
related |
Wraps GblInstance_as() for the given type, providing a gracefully-failing case.
Definition at line 47 of file gimbal_instance.h.
|
related |
Casts to the given instance type, then returns its class, returning NULL and raising an error upon failure.
Definition at line 49 of file gimbal_instance.h.
|
related |
Uses GblInstance_as(), then gets its class (if successful) or returns NULL without raising an error.
Definition at line 51 of file gimbal_instance.h.
|
related |
Invokes a virtual method on the given type's class, passing the variadic arguments directly through to it as method arguments.
Definition at line 53 of file gimbal_instance.h.
|
related |
Invokes a virtual method on the default class for a given type, used for calling into parent or default methods.
Definition at line 55 of file gimbal_instance.h.
|
related |
Returns GBL_TRUE if the given instance's type is compatible with toType
.
Returns true if the given instance can be casted to an instance of the given type.
pSelf | source instance |
toType | casted result type |
|
related |
Attempts to cast the given instance to toType
, raising an error and returning NULL upon failure.
Casts the given instance to the given type, erroring-out upon failure.
pSelf | source instance |
toType | casted result type |
|
related |
Attempts to cast the given instance to toType
, gracefully returning NULL upon failure.
Equivalent to GblInstance_cast(), except gracefully returning NULL with no errors upon failure.
This is analogous to a dynamic_cast<> operation in C++.
pSelf | source instance |
toType | casted result type |
|
related |
Returns the private structure associated with the given base
type of the instance.
Returns the private instance data associated with the base or actual type of the given public instance structure.
pSelf | source instance |
base | type ID to fetch private data for |
|
related |
Casts back to the instance type from a base type's private data segment structure.
Returns the public GblInstance structure for the given private data and its associated base or actual type.
pPrivate | private data pointer |
base | type corresponding to the private data |
|
related |
Returns the GblType associated with the given GblInstance.
Returns the type ID associated with the given instance.
pSelf | instance pointer |
|
related |
Returns the size of the given GblInstance's public data segment.
Returns the size of the public instance struct for the given instance.
pSelf | instance pointer |
|
related |
Returns the size of the given GblInstance's private data segment.
Returns the size of the private instance struct for the given instance.
pSelf | instance pointer |
|
related |
Returns the instance's combined DEFAULT size (not extended allocation size)
Returns the total size for both public and private instance data for the given instance.
pSelf | instance pointer |
|
related |
Returns the GblClass associated with the given GblInstance.
Returns the public class structure associated with the given instance.
pSelf | instance pointer |
|
related |
Swaps out the class associated with the instance, without taking ownership of it.
Releases ownership of the instance's current class, replacing it with a type-compatible class.
This is analogous to Objective-C's "is-a swizzling."
pSelf | instance |
pClass | replacement GblClass of compatible type |
|
related |
Takes ownership of the class associated with the instance, deallocating it with the instance.
Claims ownership of the previously floating class contained by the instance, binding the lifetime of the two, so that the class will be finalized when the instance is finalized.
pSelf | instance |
|
related |
Relinquishes ownership of the class assosciated with the instance, but maintaining their association.
Releases ownership of the owned class contained by the instance.
The class will no longer be finalized along with the given instance.
pSelf | instance |
|
related |
Finalizes then deletes an instance that was created on the heap, either unreferencing.
its class if using the default or destroying it if using a sunk floating class.
pSelf | heap-callocated instance |
GblClass* GblInstance::pClass |
READ-ONLY Pointer to Instance's Class, do not modify directly.
Definition at line 80 of file gimbal_instance.h.