ET System  16.4
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Single event

These routines handle the elements of a single event. More...

Functions

int et_event_getgroup (et_event *pe, int *grp)
 This routine gets the group number that the event is associated with. More...
 
int et_event_setpriority (et_event *pe, int pri)
 This routine sets the priority of an event to either ET_LOW which is the default or ET_HIGH. More...
 
int et_event_getpriority (et_event *pe, int *pri)
 This routine gets the priority of an event, either ET_LOW or ET_HIGH. More...
 
int et_event_setlength (et_event *pe, size_t len)
 This routine sets the length of an event's data in bytes. More...
 
int et_event_getlength (et_event *pe, size_t *len)
 This routine gets the length of an event's data in bytes. More...
 
int et_event_getdata (et_event *pe, void **data)
 This routine gets the pointer to an event's data. More...
 
int et_event_setcontrol (et_event *pe, int con[], int num)
 This routine sets the control array of an event. More...
 
int et_event_getcontrol (et_event *pe, int con[])
 This routine gets the control array of an event. More...
 
int et_event_setdatastatus (et_event *pe, int datastatus)
 This routine sets an event's data status. More...
 
int et_event_getdatastatus (et_event *pe, int *datastatus)
 This routine gets an event's data status. More...
 
int et_event_setendian (et_event *pe, int endian)
 This routine sets an event's data endian value. More...
 
int et_event_getendian (et_event *pe, int *endian)
 This routine gets an event's data endian value. More...
 
int et_event_needtoswap (et_event *pe, int *swap)
 This routine indicates whether an event's data needs to be swapped or not. More...
 
int et_event_setdatabuffer (et_sys_id id, et_event *pe, void *data)
 This routine set an event's data buffer for a remote user. More...
 

Detailed Description

These routines handle the elements of a single event.

Function Documentation

int et_event_getcontrol ( et_event pe,
int  con[] 
)

This routine gets the control array of an event.

Parameters
pepointer to event.
concontrol array.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL.

References et_event_t::control, ET_ERROR, ET_OK, and ET_STATION_SELECT_INTS.

int et_event_getdata ( et_event pe,
void **  data 
)

This routine gets the pointer to an event's data.

Parameters
pepointer to event.
dataaddress of data pointer which gets filled with event's data pointer.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL.

References ET_ERROR, ET_OK, and et_event_t::pdata.

int et_event_getdatastatus ( et_event pe,
int *  datastatus 
)

This routine gets an event's data status.

The status can be ET_DATA_OK, ET_DATA_CORRUPT, or ET_DATA_POSSIBLY_CORRUPT. Currently all data is ET_DATA_OK unless a user's process exits or crashes while having events obtained from the ET system but not put back. In that case, the ET system recovers the events and places them in either ET_GRANDCENTRAL station, the attachment's station's input list, or its output list depending on the station's configuration (see et_station_config_setrestore()). If the events are NOT put back into Grand Central station to be recycled but are placed in the station's input or output list, the data status will become ET_DATA_POSSIBLY_CORRUPT. This simply warns the user that a process previously crashed with the event and may have corrupted its data.

Parameters
pepointer to event.
datastatusint pointer which gets filled with the event's data status.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL.

References et_event_t::datastatus, ET_ERROR, and ET_OK.

int et_event_getendian ( et_event pe,
int *  endian 
)

This routine gets an event's data endian value.

The endian value will be either ET_ENDIAN_BIG or ET_ENDIAN_LITTLE.

Parameters
pepointer to event.
endianint pointer which gets filled with endian value of event's data.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL.

References et_event_t::byteorder, ET_ENDIAN_BIG, ET_ENDIAN_LITTLE, ET_ERROR, and ET_OK.

int et_event_getgroup ( et_event pe,
int *  grp 
)

This routine gets the group number that the event is associated with.

Each event in an ET system belongs to a group which is numbered starting at 1. By default an ET system only has 1 group of value 1. This group number can be used when getting new events from the system and helps to evenly distribute events between multiple producers.

Parameters
pepointer to event.
prievent's group (starts at 1)..
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL,

References ET_ERROR, ET_OK, and et_event_t::group.

int et_event_getlength ( et_event pe,
size_t *  len 
)

This routine gets the length of an event's data in bytes.

Parameters
pepointer to event.
lenint pointer which gets filled with the length of data in bytes.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL.

References ET_ERROR, ET_OK, and et_event_t::length.

int et_event_getpriority ( et_event pe,
int *  pri 
)

This routine gets the priority of an event, either ET_LOW or ET_HIGH.

Parameters
pepointer to event.
priint pointer which get filled with priority, either ET_LOW or ET_HIGH.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL.

References ET_ERROR, ET_OK, and et_event_t::priority.

int et_event_needtoswap ( et_event pe,
int *  swap 
)

This routine indicates whether an event's data needs to be swapped or not.

If the data's endian is opposite of the local host's then swapping of the data is required and ET_SWAP is returned. Otherwise ET_NOSWAP is returned.

Parameters
pepointer to event.
swapint pointer which gets filled with ET_SWAP or ET_NOSWAP.
Returns
ET_OK if successful.
ET_ERROR if either arg is NULL.

References et_event_t::byteorder, ET_ERROR, ET_NOSWAP, ET_OK, and ET_SWAP.

int et_event_setcontrol ( et_event pe,
int  con[],
int  num 
)

This routine sets the control array of an event.

The maximum number of control ints is ET_STATION_SELECT_INTS.

Parameters
pepointer to event.
concontrol array.
numnumber of elements in control array.
Returns
ET_OK if successful.
ET_ERROR if pe is NULL, con is NULL, num < 1, or num > ET_STATION_SELECT_INTS.

References et_event_t::control, ET_ERROR, ET_OK, and ET_STATION_SELECT_INTS.

int et_event_setdatabuffer ( et_sys_id  id,
et_event pe,
void *  data 
)

This routine set an event's data buffer for a remote user.

This routine is a little different than other et_event_get/set routines as it must only be used in a remote application. Use this in conjunction with the mode flag of ET_NOALLOC in et_events_new. This allows the user to avoid allocating event data memory, but instead to supply a buffer. This buffer is given by the "data" argument of this routine. If the user does a "put" of an event having called this routine to set its buffer, that user-supplied buffer is not freed.

Parameters
id
pedata
Returns
ET_OK if successful.
ET_ERROR if user is not remote or data arg is NULL.

References et_id_t::debug, ET_DEBUG_ERROR, ET_ERROR, et_logmsg(), ET_OK, ET_REMOTE, et_id_t::locality, and et_event_t::pdata.

int et_event_setdatastatus ( et_event pe,
int  datastatus 
)

This routine sets an event's data status.

The status can be ET_DATA_OK, ET_DATA_CORRUPT, or ET_DATA_POSSIBLY_CORRUPT. Currently all data is ET_DATA_OK unless a user's process exits or crashes while having events obtained from the ET system but not put back. In that case, the ET system recovers the events and places them in either ET_GRANDCENTRAL station, the attachment's station's input list, or its output list depending on the station's configuration (see et_station_config_setrestore()). If the events are NOT put back into Grand Central station to be recycled but are placed in the station's input or output list, the data status will become ET_DATA_POSSIBLY_CORRUPT. This simply warns the user that a process previously crashed with the event and may have corrupted its data.

Parameters
pepointer to event.
datastatusstatus of an event's data.
Returns
ET_OK if successful.
ET_ERROR if pe is NULL or datastatus is not ET_DATA_OK, ET_DATA_CORRUPT, or ET_DATA_POSSIBLY_CORRUPT

References et_event_t::datastatus, ET_DATA_CORRUPT, ET_DATA_OK, ET_DATA_POSSIBLY_CORRUPT, ET_ERROR, and ET_OK.

int et_event_setendian ( et_event pe,
int  endian 
)

This routine sets an event's data endian value.

The endian value can be ET_ENDIAN_BIG, ET_ENDIAN_LITTLE, ET_ENDIAN_LOCAL, ET_ENDIAN_NOTLOCAL, or ET_ENDIAN_SWITCH. ET_ENDIAN_BIG and ET_ENDIAN_LITTL are self-explanatory. ET_ENDIAN_LOCAL sets the endianness to be the same as the local host. ET_ENDIAN_NOTLOCAL sets the endianness to be the opposite of the local host. ET_ENDIAN_SWITCH switches the endianness from its current value to the opposite.

Parameters
pepointer to event.
endianendian value of event's data.
Returns
ET_OK if successful.
ET_ERROR if pe is NULL or endian is not ET_ENDIAN_BIG, ET_ENDIAN_LITTLE, ET_ENDIAN_LOCAL, ET_ENDIAN_NOTLOCAL, or ET_ENDIAN_SWITCH.

References et_event_t::byteorder, ET_ENDIAN_BIG, ET_ENDIAN_LITTLE, ET_ENDIAN_LOCAL, ET_ENDIAN_NOTLOCAL, ET_ENDIAN_SWITCH, ET_ERROR, ET_OK, and ET_SWAP32.

int et_event_setlength ( et_event pe,
size_t  len 
)

This routine sets the length of an event's data in bytes.

Parameters
pepointer to event.
lenlength of data in bytes.
Returns
ET_OK if successful.
ET_ERROR if pe is NULL, len is negative, or len is bigger than event memory.

References ET_ERROR, ET_OK, et_event_t::length, and et_event_t::memsize.

int et_event_setpriority ( et_event pe,
int  pri 
)

This routine sets the priority of an event to either ET_LOW which is the default or ET_HIGH.

Parameters
pepointer to event.
prievent priority, either ET_LOW or ET_HIGH.
Returns
ET_OK if successful.
ET_ERROR if pe is NULL, pri arg is neither ET_LOW or ET_HIGH.

References ET_ERROR, ET_HIGH, ET_LOW, ET_OK, and et_event_t::priority.