libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
#include <gimbal_class.h>
Data Fields | ||
struct { | ||
uintptr_t metaClassInfo | ||
} | private_ | |
Related Symbols | |
(Note that these are not member symbols.) | |
GBL_CLASS_SUPER (klass) | |
GBL_CLASS_DEFAULT (klass) | |
#define | GBL_CLASS_PRIVATE(cType, klass) |
#define | GBL_CLASS_PUBLIC(cType, priv) |
#define | GBL_CLASS_TYPECHECK(cType, klass) |
GBL_CLASS_TYPECHECK_PREFIX (klass, typePrefix) | |
#define | GBL_CLASS_CAST(cType, klass) |
GBL_CLASS_CAST_PREFIX (klass, typePrefix) | |
GBL_CLASS_TRY (klass, toType, cType) | |
GBL_CLASS_TRY_PREFIX (klass, typePrefix) | |
GblClass * | GblClass_refDefault (GblType type) |
GblRefCount | GblClass_unrefDefault (GblClass *pSelf) |
GblClass * | GblClass_weakRefDefault (GblType type) |
GblClass * | GblClass_createFloating (GblType type) |
GBL_RESULT | GblClass_destroyFloating (GblClass *pSelf) |
GBL_RESULT | GblClass_constructFloating (GblClass *pSelf, GblType type) |
GBL_RESULT | GblClass_destructFloating (GblClass *pSelf) |
Class Operators | |
Builtin operations for class structures | |
#define | GBL_CLASS(klass) |
#define | GBL_CLASS_TYPEOF(klass) |
#define | GBL_CLASS_PRIVATE(cType, klass) |
#define | GBL_CLASS_PUBLIC(cType, priv) |
#define | GBL_CLASS_TYPECHECK(cType, klass) |
#define | GBL_CLASS_CAST(cType, klass) |
#define | GBL_CLASS_AS(cType, klass) |
Static Class Type UUID and cast operators | |
UUID and cast operators for builtin static root class type | |
#define | GBL_STATIC_CLASS_TYPE |
#define | GBL_STATIC_CLASS(klass) |
Type Conversions | |
Methods for type casting and checking | |
GblBool | GblClass_check (const GblClass *pSelf, GblType toType) |
GblClass * | GblClass_cast (GblClass *pSelf, GblType toType) |
GblClass * | GblClass_as (GblClass *pSelf, GblType toType) |
Public and Private Data | |
Methods for accessing public and private segments | |
void * | GblClass_private (const GblClass *pSelf, GblType base) |
GblClass * | GblClass_public (const void *pPrivate, GblType base) |
Static Type Info | |
Methods for getting static class information | |
GblType | GblClass_typeOf (const GblClass *pSelf) |
size_t | GblClass_size (const GblClass *pSelf) |
size_t | GblClass_privateSize (const GblClass *pSelf) |
size_t | GblClass_totalSize (const GblClass *pSelf) |
Dynamic Flags | |
Methods for checking dyanmic runtime flags | |
GblBool | GblClass_isDefault (const GblClass *pSelf) |
GblBool | GblClass_isOverridden (const GblClass *pSelf) |
GblBool | GblClass_isInterface (const GblClass *pSelf) |
GblBool | GblClass_isInterfaceImpl (const GblClass *pSelf) |
GblBool | GblClass_isFloating (const GblClass *pSelf) |
GblBool | GblClass_isOwned (const GblClass *pSelf) |
GblBool | GblClass_isInPlace (const GblClass *pSelf) |
Related Classes | |
Methods for fetching associated classes | |
GblClass * | GblClass_super (const GblClass *pSelf) |
GblClass * | GblClass_default (const GblClass *pSelf) |
Base struct for all type classes.
A class represents a collection of data that is shared among all instances of a given type. This data is typically in the form of function pointers for modeling overridable methods or regular data for modeling static member variables.
GblClass is the base structure which is to be inherited by all class structures within the meta type system. This means placing it or a type "inheriting" from it as the first member of a class struct, when using C.
Definition at line 76 of file gimbal_class.h.
|
related |
Function-style cast to GblClass*: will always pass, here for consistence with other operators.
klass | pointer to a GblClass-compatible |
Convenience function-style casting macro.
Definition at line 34 of file gimbal_class.h.
|
related |
Wraps GblClass_typeOf(), returning the type associated with the given class.
klass | pointer to a GblClass-compatible |
Definition at line 36 of file gimbal_class.h.
|
related |
Wraps GblClass_private(), returning the private structure on the class associated with the given type.
Definition at line 38 of file gimbal_class.h.
|
related |
Wraps GblClass_public(), returning the public class structure from the given type's private structure.
Definition at line 40 of file gimbal_class.h.
|
related |
Returns GBL_TRUE if the given class is type-compatible with and can be safely casted to the given type.
Definition at line 42 of file gimbal_class.h.
|
related |
Wraps GblClass_cast(), casting the given class to another type, returning NULL and raising an error upon failure.
Definition at line 44 of file gimbal_class.h.
|
related |
Wraps GblClass_as(), returning the given class as another type or gracefully returning NULL upon failure.
Definition at line 46 of file gimbal_class.h.
|
related |
GblType UUID for builtin static class primitive.
Definition at line 53 of file gimbal_class.h.
|
related |
Casts a class to a static class.
Definition at line 54 of file gimbal_class.h.
Returns GBL_TRUE if the given class can be casted to toType
.
Returns true if the given class can be casted to the given class type.
pSelf | class pointer |
toType | desired destination type |
Casts the given class to a toType
class, or returns NULL and emits an error if unsuccessful.
Casts the given class to a class of the given type, raising errors and returning NULL upon failure.
pSelf | source class pointer |
toType | desired destination type |
Casts the given class to a toType
class, or gracefully returns NULL without erroring.
Equivalent to GblClass_cast(), except gracefully returning NULL with no errors getting raised if the given class could not be casted to toType.
pSelf | source class |
toType | desired destination type |
Returns the private structure associated with the given base
type of the class.
Retrieves the private data pointer associated with the given base type or NULL if there isn't one.
pSelf | class pointer |
type | type owning the private data |
Casts back to the class structure from a base type's private data segment structure.
Retrieves the public GblClass corresponding to the given private data pointer for the given type or base type or NULL upon failure.
pPrivate | pointer to private data |
base | type or base type that registered the private data |
|
related |
|
related |
Returns the combined size of the class's private data segments.
Returns the TOTAL size of the private data structure associated with the type of the given class and all of its base types.
pSelf | pointer to a GblClass |
|
related |
Returns the class's combined DEFAULT size (not extended allocation size)
Returns the total combined size of the public and private class structures for the class type and all of its inherited bases.
pSelf | pointer to a GblClass |
Returns GBL_TRUE if the class is the internally-managed default for its type.
Returns true if the given GblClass pointer points to the internally-managed default class for its type or false if it not the default.
pSelf | pointer to a GblClass |
Returns GBL_TRUE if the class differs from the default class for its type.
Inspects the internal memory of the given GblClass pointer and compares it to that of the internally managed default class, returning true if they differ or false if they are the same.
pSelf | pointer to a GblClass |
Returns GBL_TRUE if the class is an interfaced type.
Returns true if the given GblClass is actually of or derived from GBL_INTERFACE_TYPE, false otherwise.
pSelf | pointer to a GblClass |
Returns GBL_TRUE if the class is another class's implementation of an interface.
Returns true if the given GblClass an interface implementation wihch has been mapped onto another GblClass, false otherwise.
pSelf | pointer to a GblClass |
Returns GBL_TRUE if the class is a non-default floating class and is unowned by an instance.
Returns true if the given GblClass is an unowned, floating class which must be manually managed, or false if it is either the default class or has been sunk by a GblInstance.
pSelf | pointer to a GblClass |
Returns GBL_TRUE if the class is a non-default floating class is uowned by an instance.
Returns true if the given GblClass is a previously floating, nondefault class which has been sunk and is now owned by a GblInstance.
pSelf | pointer to a GblClass |
Returns GBL_TRUE if the class was constructed in-place with an existing allocation.
Returns true if the given GblClass was constructed from an existing, user-managed allocation, using GblClass_constructFloating().
pSelf | pointer to a GblClass |
Returns the default class of the class's parent type or NULL if it's a root class.
Returns the default class for the parent type of the given class type.
This is typically used in the implementation of overridden methods to allow you to call into the base class's implementations.
pSelf | pointer to a GblClass |
Returns the default implementation of the given class.
Returns a weak reference to the internally-managed default class corresonding to the given class's type.
This will only be different than the given argument if the class has been created either as a floating class, or if it is a pointer to the implementation of an interface. In the case of an interface, this is how you access the interface's default implementation as well.
pSelf | pointer to a GblClass |
|
related |
klass | pointer to a GblClass-compatible |
|
related |
klass | pointer to a GblClass-compatible |
|
related |
klass | pointer to a GblClass-compatible |
type | supertype owning the private data |
|
related |
klassPrivate | void* pointer to private class data |
type | supertype owning the private data |
|
related |
klass | pointer to a GblClass-compatible |
toType | the desired destination type |
|
related |
klass | pointer to a GblClass-compatible |
typePrefix | prefix of the given type (type name macro identifier minus _TYPE postfix) |
Convenience wrapper around GBL_CLASS_TYPECHECK() which automatically appends _TYPE suffix.
|
related |
klass | pointer to a GblClass-compatible |
toType | desination type for resulting class |
cType | C structure for the given type's class |
Convenience wrapper around GblClass_cast() which automatically performs casting.
|
related |
klass | pointer to a GblClass-compatible |
typePrefix | prefix of destination type (NAME macro minus the _TYPE suffix) |
Convenience wrapper around GBL_CLASS_CAST() which automatically deduces class structure and type identifier.
|
related |
klass | pointer to a GblClass-compatible |
toType | desination type for resulting class |
cType | C structure for the given type's class |
Convenience wrapper around GblClass_as() which automatically performs casting.
|
related |
klass | pointer to a GblClass-compatible |
typePrefix | prefix of destination type (NAME macro minus the _TYPE suffix) |
Convenience wrapper around GBL_CLASS_TRY() which automatically deduces class structure and type identifier.
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 |
|
related |
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 pointer to the default class for the given type without incrementing refCount.
type | type of desired class |
Creates a new, unowned class for the given type on the heap.
type | classed type ID |
|
related |
Destructs then frees the given heap-allocated, floating class.
pSelf | GblClass pointer |
|
related |
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 |
|
related |
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 |
uintptr_t GblClass::metaClassInfo |
PRIVATE: Pointer-sized opaque member.
Definition at line 78 of file gimbal_class.h.