GATE
Loading...
Searching...
No Matches
objects.h File Reference

C object class definition functions and macros. More...

#include "gate/gate_core_api.h"
#include "gate/gatetypes.h"
#include "gate/memalloc.h"

Macros

#define gate_object_get_interface_name(obj)
 See gate_object_t::get_interface_name.
 
#define gate_object_release(obj)
 See gate_object_t::release.
 
#define gate_object_retain(obj)
 See gate_object_t::retain.
 
#define gate_runnable_run(obj)
 See gate_runnable_t::run.
 
#define gate_cloneable_clone(obj, ptrnewclone)
 See gate_clonable_t::clone.
 
#define gate_startable_start(obj)
 See gate_startable_t::start.
 
#define gate_startable_stop(obj)
 See gate_startable_t::stop.
 
#define gate_startable_get_status(obj)
 See gate_startable_t::get_status.
 
#define GATE_OBJECT_IMPLEMENTS(obj, interface_name)
 Macro that cast any obj pointer into gate_object_t* and invokes gate_object_implements_interface.
 

Typedefs

typedef gate_object_tgate_object_ptr_t
 

Functions

GATE_CORE_API gate_runnable_tgate_runnable_create (gate_entrypoint_t function, void *param, gate_size_t param_length, gate_mem_copyctor_t param_constructor, gate_mem_dtor_t param_destructor)
 Creates a gate_runnable_t interface covering an executable function and a user defined parameter.
 
GATE_CORE_API gate_memoryblock_tgate_memoryblock_create (size_t data_length)
 Creates a new memory block.
 
GATE_CORE_API gate_result_t gate_object_ptr_copyctor (void *dest, void const *src)
 Object-pointer copy constructor function.
 
GATE_CORE_API void gate_object_ptr_dtor (void *dest)
 Object-pointer destructor function.
 
GATE_CORE_API gate_bool_t gate_object_implements_interface (gate_object_t *obj, char const *interface_name)
 Evaluates if an object implements a specific interface.
 

Detailed Description

C object class definition functions and macros.

Typedef Documentation

◆ gate_object_ptr_t

Pointer to gate_object_t interface

Function Documentation

◆ gate_runnable_create()

GATE_CORE_API gate_runnable_t * gate_runnable_create ( gate_entrypoint_t function,
void * param,
gate_size_t param_length,
gate_mem_copyctor_t param_constructor,
gate_mem_dtor_t param_destructor )

Creates a gate_runnable_t interface covering an executable function and a user defined parameter.

Parameters
[in]functionEntrypoint function pointer with code to be executed
[in]paramPointer to user defined parameter for entry point
[in]param_lengthLength of data in param in bytes
[in]param_constructorOptional copy-constructor function to copy user-defined data, NULL uses gate_mem_copy()
[in]param_destructorOptional destructor function to release user-defined data
Returns
New gate_runnable_t instance, or NULL in case of allocation error

◆ gate_object_ptr_copyctor()

GATE_CORE_API gate_result_t gate_object_ptr_copyctor ( void * dest,
void const * src )

Object-pointer copy constructor function.

Creates a copy of an object pointer and increases the object's reference count

Parameters
[out]destPointer to object-pointer (gate_object_t**) that receives the new object reference
[in]srcPointer to object-pointer (gate_object_t* const*) holding the source object reference
Returns
GATE_RESULT_* result code

◆ gate_object_ptr_dtor()

GATE_CORE_API void gate_object_ptr_dtor ( void * dest)

Object-pointer destructor function.

decreases the reference count of the referenced object and sets the pointer to NULL

Parameters
[out]destPointer to object-pointer (gate_object_t**) that will be released

◆ gate_object_implements_interface()

GATE_CORE_API gate_bool_t gate_object_implements_interface ( gate_object_t * obj,
char const * interface_name )

Evaluates if an object implements a specific interface.

Parameters
[in]objPointer to object to be evaluated
[in]interface_namePointer to object interface string name
Returns
true if object implements the interface specified in interface_name