Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | Related Pages

MqOptionS API

the MqOptionS API is used to manage -???? like items as options More...

Classes

union  MqOptionU
 space for all supported option items More...
struct  MqOptionS
 object to define an option More...

Typedefs

typedef MqOptionSMqOptionSP
 pointer to a MqOptionS object
typedef MqOptionU MqOptionU
 space for all supported option items
typedef MqOptionS MqOptionS
 object to define an option

Functions

MQ_EXTERN MqErrorE MqOptGet (MqSP const msgque, const MqOptionS *const pFlag, const MQ_SIZE Len, MqOptionUP const pDef, MqOptionUP *out)
 create a MqOptionU array with either default or Msgque packet items
MQ_EXTERN MqOptionUP MqOptDefault (MqErrorSP const error, const MqOptionS *pFlag, const MQ_SIZE Len)
 create an MqOptionU array with default values
MQ_EXTERN void MqOptFree (MqErrorSP const error, const MqOptionS optionS[], const MQ_SIZE optlen, MqOptionUP *optionPtr)
 cleanup a MqOptionU array

Detailed Description

the MqOptionS API is used to manage -???? like items as options

an array of MqOptionS objects is used to define options. every option is defined as a MqOptionS object using the Default member (e.g. MqOptionU) to store the default data in 4 different types. the types supported are S=string, D=MQ_FLT8, I=MQ_INT4 and B=boolean. the options itself is an array of MqOptionU values which are either default values or values provided by the current Msgque packet.

Example:
processing option in a service handle
MqOptionUP option;  // this have to be filled with the values
enum {BOOL, DBLE, INT, STR};  // index of the options
// the array have to be sorted in the Name member (e.g. "--bool", ...)
const static MqOptionS Flag[OPTT_LEN] = {
    {   "--bool",  BOOL, B,  {.B 0}   } , 
    {   "--dble",  DBLE, D,  {.D 0.0} } , 
    {   "--int",   INT,  I,  {.I 0}   } , 
    {   "--str",   STR,  S,  {.S MqBufferInitFromString("hallo")}} , 
};
static MqOptionUP  defopt = NULL; // first time, build 'default'
    if (!defopt) defopt = MqOptDefault(msgque->error, Flag, OPTT_LEN);
// parse the current Msgque packet for options and fill
// the option array. if no options are available option = defopt.
MqErrorCheck(MqOptGet(msgque, Flag, OPTT_LEN, defopt, &option));
...
MqSendSTART(send);
    MqSend2(send, option[BOOL].B);      // get the 'boolean' option
    MqSend4(send, option[INT].I);       // get the 'MQ_INT4' option
    MqSendD(send, option[DBLE].D);      // get the 'MQ_FLT8' option
    MqSendC(send, option[STR].S.data);  // get the string option
MqSend_RET_OK(send);
// if options were parsed ... free the option array
if (option!=defopt) MqOptFree(msgque->error, Flag, OPTT_LEN, &option);
return MqSendEND_RETR(send,NULL);

Typedef Documentation

typedef struct MqOptionS MqOptionS
 

object to define an option

an MqOptionS object is using a MqOptionU union and a {B, I, D, S} enum to define an item.

typedef union MqOptionU MqOptionU
 

space for all supported option items

an MqOptionS object is using a MqOptionU union and a {B, I, D, S} enum to define an item.


Generated on Tue Nov 23 16:13:06 2004 for libFreiburg by  doxygen 1.3.8-20040928