rasdaman complete source
Public Member Functions | Protected Attributes | List of all members
rnp::RnpProtocolEncoder Class Reference

#include <rnprotocol.hh>

Inheritance diagram for rnp::RnpProtocolEncoder:
rnp::RnpTransmitter

Public Member Functions

 RnpProtocolEncoder () throw ()
 Default constructor. More...
 
 ~RnpProtocolEncoder () throw ()
 Destructor. More...
 
void setBuffer (akg::CommBuffer *) throw ()
 Sets an external buffer as work buffer. More...
 
bool allocateBuffer (int maxMessageLength) throw ()
 Allocates an internal buffer as work buffer. More...
 
bool adjustBufferSize (int differenceSize) throw ()
 
int getBufferSize () throw ()
 
void startMessage (RnpQuark serverType, int carrierHeaderSize=0) throw ()
 
void setDesiredEndianness (Rnp::Endianness) throw ()
 
void setFinalEndianness (Rnp::Endianness) throw ()
 
void startFragment (Rnp::FragmentType, RnpQuark command) throw ()
 Starts a new fragment. More...
 
void addStringParameter (RnpQuark parameterType, const char *) throw ()
 Adds a string parameter to the current fragment. More...
 
void addInt32Parameter (RnpQuark parameterType, int) throw ()
 Adds an int parameter to the current fragment. More...
 
void addFloat32Parameter (RnpQuark parameterType, float) throw ()
 Adds a float parameter to the current fragment. More...
 
void addDouble64Parameter (RnpQuark parameterType, double) throw ()
 Adds a double parameter to the current fragment. More...
 
void addOpaqueParameter (RnpQuark parameterType, const void *, int size) throw ()
 Adds an opaque parameter to the current fragment. More...
 
void endFragment () throw ()
 Ends the current fragment. More...
 
akg::CommBufferendMessage () throw ()
 Ends the message and, if necessary, changes the endianness. More...
 
int getCarrierHeaderSize () throw ()
 Returns the size of the reserved space for the embedding carrier header. More...
 

Protected Attributes

akg::CommBuffercommBuffer
 

Detailed Description

Class for encoding a RNP message. It has support for the header of the embedding protocol and for the endianness of the partner. The rest is for creating the message into a akg::CommBuffer, which can be internal or external. The buffer has to be big enough, the size is not adapted

Constructor & Destructor Documentation

rnp::RnpProtocolEncoder::RnpProtocolEncoder ( )
throw (
)

Default constructor.

rnp::RnpProtocolEncoder::~RnpProtocolEncoder ( )
throw (
)

Destructor.

Member Function Documentation

void rnp::RnpProtocolEncoder::addDouble64Parameter ( RnpQuark  parameterType,
double   
)
throw (
)

Adds a double parameter to the current fragment.

void rnp::RnpProtocolEncoder::addFloat32Parameter ( RnpQuark  parameterType,
float   
)
throw (
)

Adds a float parameter to the current fragment.

void rnp::RnpProtocolEncoder::addInt32Parameter ( RnpQuark  parameterType,
int   
)
throw (
)

Adds an int parameter to the current fragment.

void rnp::RnpProtocolEncoder::addOpaqueParameter ( RnpQuark  parameterType,
const void *  ,
int  size 
)
throw (
)

Adds an opaque parameter to the current fragment.

void rnp::RnpProtocolEncoder::addStringParameter ( RnpQuark  parameterType,
const char *   
)
throw (
)

Adds a string parameter to the current fragment.

bool rnp::RnpProtocolEncoder::adjustBufferSize ( int  differenceSize)
throw (
)

resizes the internal buffer, so the new buffer can hold the actual data plus the requested difference. Additionally we allocate also RNP_DEFAULTBUFFERSIZE bytes Assert: commBuffer != 0 , differenceSize >= 0

bool rnp::RnpProtocolEncoder::allocateBuffer ( int  maxMessageLength)
throw (
)

Allocates an internal buffer as work buffer.

void rnp::RnpProtocolEncoder::endFragment ( )
throw (
)

Ends the current fragment.

akg::CommBuffer* rnp::RnpProtocolEncoder::endMessage ( )
throw (
)

Ends the message and, if necessary, changes the endianness.

int rnp::RnpProtocolEncoder::getBufferSize ( )
throw (
)
int rnp::RnpProtocolEncoder::getCarrierHeaderSize ( )
throw (
)

Returns the size of the reserved space for the embedding carrier header.

void rnp::RnpProtocolEncoder::setBuffer ( akg::CommBuffer )
throw (
)

Sets an external buffer as work buffer.

void rnp::RnpProtocolEncoder::setDesiredEndianness ( Rnp::Endianness  )
throw (
)

Sets the desired endianness for the answer. Servers have to use this endianness when they answer, clients might use it for the next requests

void rnp::RnpProtocolEncoder::setFinalEndianness ( Rnp::Endianness  )
throw (
)

Sets the final endianness for the message. 'endMessage()' is the one who changes the endianness to the final one

void rnp::RnpProtocolEncoder::startFragment ( Rnp::FragmentType  ,
RnpQuark  command 
)
throw (
)

Starts a new fragment.

void rnp::RnpProtocolEncoder::startMessage ( RnpQuark  serverType,
int  carrierHeaderSize = 0 
)
throw (
)

Makes the necessary initializations for a new message. Takes as parameter the type of the destination server and allocates space for an embedding protocol header Assert: commBuffer != NULL, meaning there is a valid working buffer

IMPORTANT: Be aware that all this functions for creating the message have to be called in the correct order, otherwise undefined results may occur!

Member Data Documentation

akg::CommBuffer* rnp::RnpProtocolEncoder::commBuffer
protected

The documentation for this class was generated from the following file: