|
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 | GblOpaqueVTable |
| struct | GblOpaqueClass |
Macros | |
Type System | |
Type UUID and cast macros | |
| #define | GBL_OPAQUE_TYPE |
| #define | GBL_OPAQUE_CLASS(klass) |
Typedefs | |
| typedef GBL_RESULT(* | GblOpaqueCopyFn) (void *pOpaque, void **ppNewOpaque) |
| typedef GBL_RESULT(* | GblOpaqueFreeFn) (void *pOpaque) |
Functions | |
Static Methods | |
Miscellaenous and Utility methods | |
| GblType | GblOpaque_type (void) |
| GblType | GblOpaque_register (const char *pName, const GblOpaqueVTable *pVTable) |
| GblType | GblOpaque_registerRef (const char *pName) |
Instance Methods | |
Methods for dealing with opaque instances (usually handled internally) | |
| GBL_RESULT | GblOpaque_copy (void *pOpaque, GblType type, void **ppNewOpaque) |
| GBL_RESULT | GblOpaque_free (void *pOpaque, GblType type) |
GblOpaqueClass and API for managing Opaque types.
This file contains the API for registering and managing the lifetime of "opaque" user data types. This is an intermediate libGimbal type, which inherits from GBL_POINTER_TYPE, adding additional functionality. Rather than simple pointer assignments for copy semantics with no lifetime management, a type which derives from GBL_OPAQUE_TYPE adds the bare minimum virtual functions required to implement lifetime management.
When assigning the value of a GBL_OPAQUE_TYPE to another, the "copy" virtual method is called, which may implement value-based copying via something like memcpy(), or reference-based copying via something like incrementing a reference counter.
When the GBL_OPAQUE_TYPE is destroyed, the "free" virtual method is called, which may opt to actually deallocate the object for value-based copied objects OR it may simply decrement a reference counter for reference-based semantics.
Definition in file gimbal_opaque.h.
| #define GBL_OPAQUE_TYPE |
Type UUID for GblOpaque.
Definition at line 32 of file gimbal_opaque.h.
| #define GBL_OPAQUE_CLASS | ( | klass | ) |
Function-style GblOpaqueClass cast from GblClass.
Definition at line 33 of file gimbal_opaque.h.
| typedef GBL_RESULT(* GblOpaqueCopyFn) (void *pOpaque, void **ppNewOpaque) |
Function signature for for an opaque copy operation, see GblOpaqueVTable::pFnCopy.
Definition at line 39 of file gimbal_opaque.h.
| typedef GBL_RESULT(* GblOpaqueFreeFn) (void *pOpaque) |
Function signature for an opaque free operation, see GblOpaqueVTable::pFnFree.
Definition at line 41 of file gimbal_opaque.h.
| GblType GblOpaque_register | ( | const char * | pName, |
| const GblOpaqueVTable * | pVTable ) |
Registers a new opaque subtype with the virtual table given by pVTable.
| GblType GblOpaque_registerRef | ( | const char * | pName | ) |
Convenience function which registers a new type meta type which is used with GblRef to manage its lifetime.
| GBL_RESULT GblOpaque_copy | ( | void * | pOpaque, |
| GblType | type, | ||
| void ** | ppNewOpaque ) |
Copies an opaque structure with the given type into ppNewOpaque, using its vtable.
| GBL_RESULT GblOpaque_free | ( | void * | pOpaque, |
| GblType | type ) |
Frees an opaque structure with the given type using its vtable.