Message Buffer Classes

Message buffer classes describe the memory buffers into which XML message are encoded or from which XML messages are decoded. The main base class for all memory buffer derivations is OSRTMessageBufferIF. This is a pure virtual class that defines the interface all derived message buffer or stream classes must implement.

The base class for all in-memory message buffers is OSRTMessageBuffer. This too is abstract. It is used as the base for the OSXMLMessageBuffer class which is the base class for XML message encoding or decoding. From this, concrete XML encode (OSXMLEncodeBuffer) and decode (OSXMLDecodeBuffer) buffer classes are derived.

To encode an XML message, a user would need to describe the target buffer to which it is to be written. This is what the OSXMLEncodeBuffer class is used for. The default constructor allows a dynamic buffer to be setup that the encoder will manage the memory for to ensure there is enough space for a given encode operation to succeed. Another constructor is available that allows a fixed-sized buffer to be specified by providing the start address and buffer size. If this buffer is not large enough to hold a given encoded message, a buffer overflow error is returned from the encode method that is using the buffer.