Data types

The data type used by the liburbi are described below:

UMessage

 class UMessage {
  public:

   UAbstractClient    &client;   // connection from which originated the message
   int                timestamp;     // server-side timestamp
   char               *tag;          // associated tag

   UMessageType       type;          // type of the message
   UBinaryMessageType binaryType;    // type of binary message

   union {
     double        doubleValue;
     char          *stringValue;
     char          *systemValue;
     char          *message;        // filled if type is unknown (MESSAGE_UNKNOWN)
     USound        sound;           // filled if binary data is of the sound type
     UImage        image;           // filled if binary data is of the image type
     UBinary       binary;          // filled if binary data is of an unrecogn. type
   };
 }

The type field can be MESSAGE_DOUBLE, MESSAGE_STRING, MESSAGE_SYSTEM, MESSAGE_BINARY or MESSAGE_UNKNOWN. Depending of this field, the corresponding value in the union will be set. If the message is of the binary type, binaryType will give additional informations on the type of data (BINARYMESSAGE_SOUND, BINARYMESSAGE_IMAGE or BINARYMESSAGE_UNKNOWN), and the appropriate sound or image structure will be filled.

USound

 class USound {
  public:
  char                  *data;            // pointer to sound data
  int                   size;             // total size in byte
  int                   channels;         // number of audio channels
  int                   rate;             // rate in Hertz
  int                   sampleSize;       // sample size in bit
  USoundFormat          soundFormat;      // format of the sound data
                                             //(SOUND_RAW, SOUND_WAV, SOUDN_MP3...)
  USoundSampleFormat    sampleFormat;     // sample format
 };

UImage

 class UImage {
  public:
   char                  *data;            // pointer to image data
   int                   size;             // image size in byte
   int                   width, height;    // size of the image
   UImageFormat          imageFormat;      // IMAGE_RGB, IMAGE_YCbCr, IMAGE_JPEG...
 };