Event structure. More...
#include "eventapi.h"
Data Fields | |
sw_event_type | type |
sw_event_context * | context |
void * | message |
size_t | length |
HqnIdent | id |
Event structure.
This structure is delivered to Event Handlers and contains the type of Event, useful in the unusual case of a single Handler being registered for multiple different Events, the message pointer and length as supplied to SwEvent(), and the opaque Event context used for SwEventTail() calls.
Handlers that wish to call SwEventTail() with differing message contents must modify the original sw_event they are passed, and restore the original contents (if appropriate) before passing on (if it does SW_EVENT_CONTINUE).
sw_event_context* sw_event::context |
An opaque value that must be preserved for SwEventTail() to function correctly. Not for Handler's use. Do not change.
HqnIdent sw_event::id |
Each new Event is given a unique identifier. This allows a Handler which has been registered more than once for the same Event to tell the difference between being called again for the same Event at a different priority, and a new Event. The id eventually wraps around so should not be kept for extended periods.
This value should not be changed by event handlers.
size_t sw_event::length |
The size passed by the Event Issuer. Its interpretation is defined by the Event in question, but will often be the length of the above structure. Alternatively it may be the number of entries in an array, or some other scalar value.
It may be useful during some Events for a Handler to modify this value.
void* sw_event::message |
The pointer passed by the Event Issuer. Its interpretation is defined by the Event in question, but will typically be a pointer to a structure of some kind. Some Events have no message so this pointer may legitimately be NULL.
It may be useful during some Events for a Handler to modify this value.
sw_event_type sw_event::type |
The type of the current Event. One Handler function may be registered for multiple Events - this field allows the type of Event to be detected, which could affect how the message is interpreted. Changing this value does NOT change which remaining Handlers are to be called, so it must not be changed by the current Handler.