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

Go to the source code of this file.

Data Structures

struct  GblClosureClass
 
struct  GblClosure
 

Macros

#define GBL_CALLBACK(fn)
 
#define GblClosure_createDefault_(...)
 
#define GblClosure_createDefault__(type, size, ud, dtor, ...)
 
Type System

Type UUID and cast operators

#define GBL_CLOSURE_TYPE
 
#define GBL_CLOSURE(self)
 
#define GBL_CLOSURE_CLASS(klass)
 
#define GBL_CLOSURE_GET_CLASS(self)
 

Functions

GblType GblClosure_type (void)
 
GblClosureGblClosure_create (GblType derivedType, size_t size, void *pUserdata, GblArrayMapDtorFn pFnDtor)
 
GblClosureGblClosure_ref (GblClosure *pSelf)
 
GblRefCount GblClosure_unref (GblClosure *pSelf)
 
Current Closure

Methods for querying the active GblClosure

GblClosureGblClosure_current (void)
 
void * GblClosure_currentUserdata (void)
 

Detailed Description

GblClosure, generic callable instance, and API.

This file contains the type declaration of GblClosure and its associated API. A GblClosure repersents the base type for all callable objects, providing:

  • A uniform, generic invocation method (GblMarshal)
  • Any state data that the closure captures
Author
2023 Falco Girgis

Definition in file gimbal_closure.h.

Macro Definition Documentation

◆ GBL_CLOSURE_TYPE

#define GBL_CLOSURE_TYPE

Type UUID for GblClosure.

Definition at line 24 of file gimbal_closure.h.

◆ GBL_CLOSURE

#define GBL_CLOSURE (   self)

Casts a GblInstance to GblClosure.

Definition at line 25 of file gimbal_closure.h.

◆ GBL_CLOSURE_CLASS

#define GBL_CLOSURE_CLASS (   klass)

Casts a GblClass to GblClosureClass.

Definition at line 26 of file gimbal_closure.h.

◆ GBL_CLOSURE_GET_CLASS

#define GBL_CLOSURE_GET_CLASS (   self)

Gets a GblClosureClass from GblInstance.

Definition at line 27 of file gimbal_closure.h.

◆ GBL_CALLBACK

#define GBL_CALLBACK (   fn)

Casts a C function pointer to a generic callback type.

Definition at line 32 of file gimbal_closure.h.

◆ GblClosure_createDefault_

#define GblClosure_createDefault_ (   ...)

Definition at line 149 of file gimbal_closure.h.

◆ GblClosure_createDefault__

#define GblClosure_createDefault__ (   type,
  size,
  ud,
  dtor,
  ... 
)

Definition at line 151 of file gimbal_closure.h.

Function Documentation

◆ GblClosure_type()

GblType GblClosure_type ( void  )

Returns the GblType UUID for GblClosure.

◆ GblClosure_current()

GblClosure * GblClosure_current ( void  )

Returns a pointer to the inner-most currently executing GblClosure instance.

◆ GblClosure_currentUserdata()

void * GblClosure_currentUserdata ( void  )

Returns a pointer to the userdatea of the inner-most currently executing GblClosure instance.

◆ GblClosure_create()

GblClosure * GblClosure_create ( GblType  derivedType,
size_t  size,
void *  pUserdata,
GblArrayMapDtorFn  pFnDtor 
)

Creates a GblClosure-derived instance with the given attributes, returning a pointer to it.

◆ GblClosure_ref()

GblClosure * GblClosure_ref ( GblClosure pSelf)

Returns a new reference to the given GblClosure instance, increasing its reference count.

◆ GblClosure_unref()

GblRefCount GblClosure_unref ( GblClosure pSelf)

Removes a reference to the given GblClosure, destroying it upon reaching zero.