EzC
Typedefs | Functions
ezc_callback.h File Reference

Callback/Observer interface. More...

Go to the source code of this file.

Typedefs

typedef struct ezc_callback ezc_callback
 Callback object. More...
 

Functions

ezc_callbackezc_callback_new (void(*fn)(void *), void *arg)
 Create a new callback object. More...
 
void ezc_callback_delete (ezc_callback *self)
 Free given callback object. More...
 
void ezc_callback_call (ezc_callback const *self)
 Perform a callback. More...
 

Detailed Description

Callback/Observer interface.

Can be made into the observer design pattern when coupled with ezc_list.

Typedef Documentation

◆ ezc_callback

typedef struct ezc_callback ezc_callback

Callback object.

This is an opaque struct. Please use the provided interface to interact with it.

Function Documentation

◆ ezc_callback_call()

void ezc_callback_call ( ezc_callback const *  self)

Perform a callback.

Parameters
selfezc_callback const * Pointer to a callback object.

◆ ezc_callback_delete()

void ezc_callback_delete ( ezc_callback self)

Free given callback object.

Parameters
selfezc_callback * Pointer to a callback object.

◆ ezc_callback_new()

ezc_callback* ezc_callback_new ( void(*)(void *)  fn,
void *  arg 
)

Create a new callback object.

As of now there are no "setter" methods that allow you to change this object's values later. (Instead, delete and recreate the object instead.)

Parameters
fnPointer to a function. This function must accept one argument, a pointer to the same type as arg.
argvoid * Pointer to data that you want passed to fn.
Returns
Pointer to newly allocated callback object.