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 | GblInterfaceImpl |
struct | GblTypeInfo |
Macros | |
#define | GBL_INVALID_TYPE |
Typedefs | |
typedef uintptr_t | GblType |
typedef GBL_RESULT(* | GblClassInitFn) (GblClass *, const void *) |
typedef GBL_RESULT(* | GblClassFinalFn) (GblClass *, const void *) |
typedef GBL_RESULT(* | GblInstanceInitFn) (GblInstance *) |
Enumerations | |
enum | GblTypeFlags |
Functions | |
Registry | |
Methods for managing the type registry | |
GblType | GblType_register (const char *pName, GblType baseType, const GblTypeInfo *pInfo, GblFlags flags) |
GBL_RESULT | GblType_unregister (GblType type) |
size_t | GblType_count (void) |
GblType | GblType_next (GblType previousType) |
Querying | |
Methods for looking up or querying types | |
GblType | GblType_find (const char *pName) |
GblType | GblType_findQuark (GblQuark quark) |
Attributes | |
Accessor methods for getting a type's information | |
const char * | GblType_name (GblType self) |
GblQuark | GblType_nameQuark (GblType self) |
GblType | GblType_parent (GblType self) |
const GblTypeInfo * | GblType_info (GblType self) |
GblFlags | GblType_flags (GblType self) |
Resource Tracking | |
Methods for querying a type's active resource counters | |
GblRefCount | GblType_classRefCount (GblType self) |
GblRefCount | GblType_instanceCount (GblType self) |
Hierarchy | |
Methods for querying a type's hierarchy | |
GblType | GblType_root (GblType self) |
GblType | GblType_base (GblType self, size_t depth) |
GblType | GblType_ancestor (GblType self, size_t level) |
size_t | GblType_depth (GblType self) |
Type Checking | |
Methods performing type system queries on a type | |
GblBool | GblType_verify (GblType self) |
GblBool | GblType_check (GblType self, GblType other) |
GblBool | GblType_depends (GblType self, GblType dependency) |
GblBool | GblType_derives (GblType self, GblType superType) |
GblBool | GblType_implements (GblType self, GblType ifaceType) |
GblType | GblType_common (GblType self, GblType other) |
GblBool | GblType_maps (GblType self, GblType iface) |
GblBool | GblType_conforms (GblType self, GblType dependent) |
GblType UUID, meta type registration, and API.
This file provides the lowest-level entry-point and API into the meta type system, built around GblType, a UUID which is returned after registering a type.
To register a type with the type system and get a UUID for it, simply use GblType_register().
UUIDs are automatically made available for all builtin types.
Definition in file gimbal_type.h.
#define GBL_INVALID_TYPE |
GblType UUID of the invalid type.
Definition at line 31 of file gimbal_type.h.
typedef GBL_RESULT(* GblClassInitFn) (GblClass *, const void *) |
Function type used as a GblType's GblClass initializer.
Definition at line 53 of file gimbal_type.h.
typedef GBL_RESULT(* GblClassFinalFn) (GblClass *, const void *) |
Function type used as a GblType's GblClass finalizer.
Definition at line 54 of file gimbal_type.h.
typedef GBL_RESULT(* GblInstanceInitFn) (GblInstance *) |
Function type used as a GblType's GblInstance initializer.
Definition at line 55 of file gimbal_type.h.
enum GblTypeFlags |
Flags controlling behavior of GblTypes. These can be set at any level in a type heirarchy.
Enumerator | |
---|---|
GBL_TYPE_FLAGS_NONE | Type which adds no additional flags beyond what's inherited. |
GBL_TYPE_FLAG_BUILTIN | Type was automatically registered as a builtin type (do not use on a new type) |
GBL_TYPE_FLAG_TYPEINFO_STATIC | Type's GblTypeInfo specified upon registration is static, so no internal storage has to be allocated for storing a copy. |
GBL_TYPE_FLAG_CLASS_PINNED | Type's GblClass is never destroyed and remains persistent upon construction. The default behavior is to create/destroy as referenced. |
GBL_TYPE_FLAG_CLASS_PREINIT | Type's GblClass should be constructed immediately, rather than lazily upon use by default. Also implies class pinning. |
GBL_TYPE_FLAG_UNMAPPABLE | Cannot obtain Type's associated GblInterface from a GblClass it has been mapped to. Disambiguates casting with common interface base classes. |
GBL_TYPE_FLAG_INCOMPLETE | Incomplete/partial type missing some type dependency. |
GBL_TYPE_FLAG_ABSTRACT | Type cannot be instantiated without being derived. |
GBL_TYPE_FLAG_FINAL | Type cannot be derived from. |
GBL_TYPE_FLAGS_MASK | Mask of all user type flags. |
Definition at line 58 of file gimbal_type.h.
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.
GBL_RESULT GblType_unregister | ( | GblType | type | ) |
Unregisters a type from the type system. Typically not done, better not be used.
size_t GblType_count | ( | void | ) |
Returns the total number of types registered to the type system.
Iterates over the registry by passing a previously returned type or GBL_TYPE_INVALID initially.
GblType GblType_find | ( | const char * | pName | ) |
Queries the internal type registry for a GblType by its type name.
Queries the registry for a GblType using a GblQuark of its type name (faster)
const char * GblType_name | ( | GblType | self | ) |
Returns the type name string associated with the given GblType.
Returns the type name quark associated with the given GblType.
Returns the given type's parent's GblType or GBL_INVALID_TYPE if it's a root type.
const GblTypeInfo * GblType_info | ( | GblType | self | ) |
Returns the GblTypeInfo struct for the given type, containing its meta information.
Returns the combined flags for a given type, including flags it has inherited.
GblRefCount GblType_classRefCount | ( | GblType | self | ) |
Returns the reference counter for the given GblType's internally-managed default GblClass.
GblRefCount GblType_instanceCount | ( | GblType | self | ) |
Returns the number of active instances of the given GblType.
Returns the base GblType of the given GblType, where a depth
of 0 is its root.
Similar to GblType_base(), but in the reverse direction. level
0 is identity.
size_t GblType_depth | ( | GblType | self | ) |
Returns the depth of the given GblType, where a depth of 0 means it's a root type.
Returns GBL_TRUE if the given type is a valid, registred type.
Returns GBL_TRUE if the given type can be safely cast to the other
type.
Returns GBL_TRUE if the given type depends on the dependency
type.
Returns GBL_TRUE if the given type is a subtype, inheriting from superType
.
Returns GBL_TRUE if the given type has implemented ifaceType
.
Returns the most-derived, deepest common-type between the given type and other
.
Returns true if the given type's class contains an implementation of the iface
interface.