ICELib  1
Classes
iceEvent
ICECore - IndieCity Extras integration interfaces

Event callback class. More...

Classes

class  iceEvent
 Callback registration structure. More...

TypeDefs

typedef iceDWord iceEventId
 An application defined value used to identify a particular event Different events belonging to different objects may be created with the same id.
typedef void(* iceEventHandler )(const iceEvent *pEvent, const void *eventArgs, void *userContext)
 An EventHandler is a c-style function with following signature: void callback(const iceEvent* pEvent, const void* eventArgs, void* userContext)

Reference Counting

void iceEventAddReference (iceEvent *pEvent)
 Add reference.
void iceEventRelease (iceEvent *pEvent)
 Dec reference.

Event Registration

iceDWord iceEventRegisterHandler (iceEvent *pEvent, iceEventHandler eventHandler, void *userContext)
 Register a callback with the event object.
IceCoreResult iceEventRegisterHandlerUnregisterHandlerByCookie (iceEvent *pEvent, iceDWord cookie)
 Unregister a registered callback function This function will unregister only the callback that matches the given cookie. If the callback was register multiple times then only the matching instance is unregistered.
IceCoreResult iceEventRegisterHandlerUnregisterHandlerByPointer (iceEvent *pEvent, iceEventHandler eventHandler)
 Unregister a registered callback function This function will unregister all instances of the given callback regardless of cookie value or context.

Event Properties

const char * iceEventGetName (const iceEvent *pEvent)
 get (possibly) helpful string saying what the Event is called May return NULL
iceEventId iceEventGetId (const iceEvent *pEvent)
 Get the application defined Event Id.
iceDWord iceEventGetCategoryFlags (const iceEvent *pEvent)
 Get the application defined Event Category flags.

Detailed Description

Event callback class.

Some ICELib structures contain events. These allow the programmer to register callback functions in order to be notified when a particular event has occurred. Multiple callbacks can be registered. and a single callback can be registered multiple times. When an event is triggered all the registered callbacks will be called in the order they were registered.


Typedef Documentation

An EventHandler is a c-style function with following signature: void callback(const iceEvent* pEvent, const void* eventArgs, void* userContext)

Parameters:
[in]pEventThe iceEvent* that it is registered with. Dont release this pointer in the callback unless you addreffed it yourself and really are releasing it.
[in]eventArgsA pointer to an arg struct which is dependent on the event. Can be NULL
[in]pointerto the userContext that the callback was registered with

Function Documentation

void iceEventAddReference ( iceEvent pEvent) [related]

Add reference.

Parameters:
[in]pEventpointer to iceEvent to increase the refcount on
iceDWord iceEventGetCategoryFlags ( const iceEvent pEvent) [related]

Get the application defined Event Category flags.

Parameters:
[in]pEventpointer to event
iceEventId iceEventGetId ( const iceEvent pEvent) [related]

Get the application defined Event Id.

Parameters:
[in]pEventpointer to event
const char * iceEventGetName ( const iceEvent pEvent) [related]

get (possibly) helpful string saying what the Event is called May return NULL

Parameters:
[in]pEventpointer to event
iceDWord iceEventRegisterHandler ( iceEvent pEvent,
iceEventHandler  eventHandler,
void *  userContext 
) [related]

Register a callback with the event object.

Parameters:
[in]pEventpointer to event
[in]eventHandlerpointer to callback function to register
[in]userContextuser defined pointer that will be passed to callback when event is triggered. Can be NULL
Returns:
iceDWord an integer cookie value that can be used to unregister a particular callback from the event
IceCoreResult iceEventRegisterHandlerUnregisterHandlerByCookie ( iceEvent pEvent,
iceDWord  cookie 
) [related]

Unregister a registered callback function This function will unregister only the callback that matches the given cookie. If the callback was register multiple times then only the matching instance is unregistered.

Parameters:
[in]pEventpointer to event
[in]cookievalue returned when callback was registered
Returns:
result value indicating success of call. negative if successful
IceCoreResult iceEventRegisterHandlerUnregisterHandlerByPointer ( iceEvent pEvent,
iceEventHandler  eventHandler 
) [related]

Unregister a registered callback function This function will unregister all instances of the given callback regardless of cookie value or context.

Parameters:
[in]pEventpointer to event
[in]cookievalue returned when callback was registered
Returns:
result value indicating success of call. negative if successful
void iceEventRelease ( iceEvent pEvent) [related]

Dec reference.

Parameters:
[in]pEventpointer to iceEvent to be released
 All Classes Functions