libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_instance.h File Reference

Go to the source code of this file.

Data Structures

struct  GblInstance
 

Macros

Instance Root Type

UUID and cast operators

#define GBL_INSTANCE_TYPE
 
#define GBL_INSTANCE(self)
 
#define GBL_INSTANCE_GET_CLASS(self)
 
Instance Operators

Builtin operations for Instance-derived types

Functions

Lifetime Management

Constructors and Destructors

GblInstanceGblInstance_create (GblType type, size_t publicSize, GblClass *pClass)
 
GBL_RESULT GblInstance_construct (GblInstance *pSelf, GblType type, GblClass *pClass)
 
GblRefCount GblInstance_destroy (GblInstance *pSelf)
 
GblRefCount GblInstance_destruct (GblInstance *pSelf)
 

Detailed Description

GblInstance structure and related functions.

This file contains the API for the GblInstance type, which is the most low-level, minimalistic primitive instantiable type within the type-system. It's the root of all other instantiables and contains nothing other than a pointer to its GblClass.

See also
gimbal_type.h, gimbal_class.h
Author
2023 Falco Girgis

Definition in file gimbal_instance.h.

Macro Definition Documentation

◆ GBL_INSTANCE_TYPE

#define GBL_INSTANCE_TYPE

Type UUID for GblInstance.

Definition at line 26 of file gimbal_instance.h.

◆ GBL_INSTANCE

#define GBL_INSTANCE (   self)

Casts GblInstance-compatible to GblInstance.

Definition at line 27 of file gimbal_instance.h.

◆ GBL_INSTANCE_GET_CLASS

#define GBL_INSTANCE_GET_CLASS (   self)

Extracts the class from a GblInstance.

Definition at line 28 of file gimbal_instance.h.

Function Documentation

◆ GblInstance_create()

GblInstance * GblInstance_create ( GblType  type,
size_t  publicSize,
GblClass pClass 
)

Creates and returns an instance, optionally with an extended size and/or non-default class.

◆ GblInstance_construct()

GBL_RESULT GblInstance_construct ( GblInstance pSelf,
GblType  type,
GblClass pClass 
)

Constructs an instance, optionally with a non-default class, returning a result code.

◆ GblInstance_destroy()

GblRefCount GblInstance_destroy ( GblInstance pSelf)
related

Destructs and deallocates an instance. It must have been created with GblInstance_create().

◆ GblInstance_destruct()

GblRefCount GblInstance_destruct ( GblInstance pSelf)

Destructs but doesn't deallocate an instance. It must have been created with GblInstance_construct().

Equivalent to GblInstance_destroy(), except that the allocation is not deallocated.

This is equivalent to a placement delete operation in C++.

Parameters
pSelfexisting allocation
Returns
remaining number of active instances of the associated type
See also
GblInstance_destroy