Events


Defines

#define IX_EV_DEFAULT   0x00
 default event type, automatically reset and not cumulative
#define IX_EV_MANUAL   0x01
 event has to be reset manually
#define IX_EV_CUMULATIVE   0x02
 triggering of event is counted
#define IX_EV_INIT   0x04
 new event is immediately triggred after creation
#define IX_EV(id)   ix_event_get((id))
 an abrevation to get the event by id
#define IX_ID(pev)   ix_event_id((pev))
 an abrevation to get the id of an event

Typedefs

typedef ix_event_s ix_event_t
 handle of event structure
typedef ix_evl_s ix_evl_t
 handle of event listener
typedef int(*) IX_EVENT_HOOK_FCT (ix_event_t *pev)

Functions

ix_event_tix_event_new (int id, int flag, void *userdata)
ix_event_tix_event_i_new (int flags, void *userdata)
int ix_event_set_hook (IX_EVENT_HOOK_FCT hook)
int ix_event_free (ix_event_t *pe)
ix_event_tix_event_get (int id)
int ix_event_id (ix_event_t *pev)
int ix_event_set (ix_event_t *pe)
int ix_event_check (ix_event_t *pe)
int ix_event_isset (ix_event_t *pe)
int ix_event_reset (ix_event_t *pe)
int ix_event_add_evl (ix_event_t *pe, struct ix_evl_s *pevl)
int ix_event_del_evl (ix_event_t *pe, struct ix_evl_s *pevl)
void * ix_event_data (ix_event_t *pe)
void * ix_event_set_data (ix_event_t *pe, void *userdata)
int ix_event_getnewid (void)

Detailed Description

This module describes the methods to create and handle ix-events. Events are used application wide to be triggered and to be received. They are used internally by ixtools to provide functionality for network communication and timer.

Events have to be created with ix_event_new(), released with ix_event_free().

During creation you can relate an event-id to the event (number between 0 and 127). You can always get the event-handle by the macro IX_EV() or vice versa with IX_ID(). With ix_event_i_new() you can create an event with automatically assigned a free id outside the range of user-supplied-event-ids.

See Set of events for more information dealing with receiving and waiting for events.


Define Documentation

#define IX_EV_DEFAULT   0x00

default event type, automatically reset and not cumulative

types of events, or-ing is possible


Typedef Documentation

typedef int( * ) IX_EVENT_HOOK_FCT(ix_event_t *pev)

this is a hook function: if set it is called whenever an user event is triggered externally or internally see ix_event_set_hook()


Function Documentation

int ix_event_check ( ix_event_t pe  ) 

checks event and reset event due to type (manual,default,...)

Parameters:
pe event handle
Returns:
  • 0: event not valid or not set
  • 1: event was set

void* ix_event_data ( ix_event_t pe  ) 

return the userdata of an event

Parameters:
pe event handle
Returns:
userdata of event NULL: error

int ix_event_free ( ix_event_t pe  ) 

frees event, destructor

Parameters:
pe event handle
Returns:
  • 0: OK
  • <0: error

ix_event_t* ix_event_get ( int  id  ) 

returns event handle for some event-id

Parameters:
id event-id
Returns:
  • event handle
  • NULL: error

int ix_event_getnewid ( void   ) 

get a new free event id from pool

Returns:
  • free event-id
  • <0: error

ix_event_t* ix_event_i_new ( int  flags,
void *  userdata 
)

allocates a new event of type flag, with userdata The id is supplied by the system internally (e.g. to be used in libraries for not to disturb the range of user ids)

Parameters:
flag event type
userdata some arbitrary user data
Returns:
  • handle for event
  • NULL: error

int ix_event_id ( ix_event_t pev  ) 

return the event id

Parameters:
pe event handle
Returns:
  • id of event
  • <0: error

int ix_event_isset ( ix_event_t pe  ) 

checks if event is set

Parameters:
pe event handle
Returns:
  • 1: event is set
  • 0: event is not set

ix_event_t* ix_event_new ( int  id,
int  flag,
void *  userdata 
)

allocates a new event with id, of type flag, with userdata

Parameters:
id ranged from 0 to 127
flag event type
userdata some arbitrary user data
Returns:
  • handle for event
  • NULL: error

int ix_event_reset ( ix_event_t pe  ) 

resets event to 0

Parameters:
pe event handle
Returns:
  • 1: ok, event was set before
  • 0: ok, event was not set before
  • <0: error

int ix_event_set ( ix_event_t pe  ) 

triggers event

Parameters:
pe event handle
Returns:
  • 0: OK
  • <0: error

void* ix_event_set_data ( ix_event_t pe,
void *  userdata 
)

set the userdata of an event

Parameters:
pe event handle
Returns:
old userdata of event NULL: error

int ix_event_set_hook ( IX_EVENT_HOOK_FCT  hook  ) 

set a hook function for user events

Parameters:
hook the hook function to set
Returns:
  • 0: OK
  • <0: error


Generated on 4 Mar 2014 for ixtools by  doxygen 1.4.7