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

#include <rnpcommunication.hh>

Inheritance diagram for rnp::RnpBaseClientComm:
RnpClientComm

Public Member Functions

 RnpBaseClientComm (RnpQuark serverType, RnpTransport::CarrierProtocol=RnpTransport::crp_Rnp) throw ()
 Constructor taking the server type and the carrier protocol. More...
 
 RnpBaseClientComm (const char *serverHost, int serverPort, RnpQuark serverType, RnpTransport::CarrierProtocol=RnpTransport::crp_Rnp) throw ()
 
virtual ~RnpBaseClientComm () throw ()
 Destructor. More...
 
void setConnectionParameters (const char *serverHost, int serverPort) throw ()
 
void setCarrierProtocol (RnpTransport::CarrierProtocol) throw ()
 Set the carrier protocol. More...
 
RnpTransport::CarrierProtocol getCarrierProtocol () throw ()
 Returns the used carrier protocol. More...
 
void jobIsReady () throw ()
 
void setMaxRetry (unsigned int newMaxRetry)
 
unsigned int getMaxRetry ()
 Returns the maximal retry count. More...
 

Protected Member Functions

void startRequest (RnpQuark command, int transmitterBufferSize=RNP_DEFAULTBUFFERSIZE)
 Start building the request, might throw whatever new throws. More...
 
bool sendRequestGetAnswer ()
 
virtual bool checkForExceptions ()
 
void reassembleAkgSerializable () throw (AkgSerializableException)
 
void reassembleStlException () throw (RnpStlException)
 
void clearAnswer () throw ()
 Clear the answer when you don't need it any more, memory is released. More...
 
void initDefaultCommunication () throw ()
 
void printCurrentParameter () throw ()
 Helper function for ptinting the current parameter. More...
 

Protected Attributes

RnpQuark serverType
 
RnpTransport::CarrierProtocol carrierProtocol
 
RnpProtocolDecoder decoder
 
RnpTransmitter encoder
 
CommBuffer transmitterBuffer
 
RnpClientJob clientJob
 
NbCommunicator * communicatorPtr
 
NbCommunicator internalCommunicator
 
const char * serverHost
 
unsigned int serverPort
 
unsigned int maxRetry
 

Detailed Description

RnpBaseClientComm is the base class for the client communication. It offers the necessary elements for creating the request, send it, receive the answer and decode it. Every specific client comm will inherit from this and will implement the various functions using the functions provided by this class.

It has a private NbCommunicator object, but if you need a shared one be my guest. The RnpClientJob is its own also and this stays like that!

Constructor & Destructor Documentation

rnp::RnpBaseClientComm::RnpBaseClientComm ( RnpQuark  serverType,
RnpTransport::CarrierProtocol  = RnpTransport::crp_Rnp 
)
throw (
)

Constructor taking the server type and the carrier protocol.

rnp::RnpBaseClientComm::RnpBaseClientComm ( const char *  serverHost,
int  serverPort,
RnpQuark  serverType,
RnpTransport::CarrierProtocol  = RnpTransport::crp_Rnp 
)
throw (
)

Constructor taking also the connection info for the server Assert: serverHost != 0, serverPort > 0

virtual rnp::RnpBaseClientComm::~RnpBaseClientComm ( )
throw (
)
virtual

Destructor.

Member Function Documentation

virtual bool rnp::RnpBaseClientComm::checkForExceptions ( )
protectedvirtual

detects an exception as answer and throws it. this version only Akg and STL returns true if there is an exception, but can't reassemble it returns false if there is a correct answer, no exception doesn't return, but throws, if there is an exception and it can reassemble it

void rnp::RnpBaseClientComm::clearAnswer ( )
throw (
)
protected

Clear the answer when you don't need it any more, memory is released.

RnpTransport::CarrierProtocol rnp::RnpBaseClientComm::getCarrierProtocol ( )
throw (
)

Returns the used carrier protocol.

unsigned int rnp::RnpBaseClientComm::getMaxRetry ( )

Returns the maximal retry count.

void rnp::RnpBaseClientComm::initDefaultCommunication ( )
throw (
)
protected

Default communication init, build another init() if you don't like this This sets 1 job, 60sec as timeout, attaches the internal job. Be aware that this timeout is not the timeout of the client job, but the one of the communicator

void rnp::RnpBaseClientComm::jobIsReady ( )
throw (
)
void rnp::RnpBaseClientComm::printCurrentParameter ( )
throw (
)
protected

Helper function for ptinting the current parameter.

void rnp::RnpBaseClientComm::reassembleAkgSerializable ( )
throw (AkgSerializableException
)
protected
void rnp::RnpBaseClientComm::reassembleStlException ( )
throw (RnpStlException
)
protected
bool rnp::RnpBaseClientComm::sendRequestGetAnswer ( )
protected

Does the dirty work: sends the request and brings the answer Later it will throw various exceptions, but for now it only returns 'true' if everything is OK Assert: serverHost != 0, serverPort > 0

void rnp::RnpBaseClientComm::setCarrierProtocol ( RnpTransport::CarrierProtocol  )
throw (
)

Set the carrier protocol.

void rnp::RnpBaseClientComm::setConnectionParameters ( const char *  serverHost,
int  serverPort 
)
throw (
)

Set the connection parameter Assert: serverHost != 0, serverPort > 0

void rnp::RnpBaseClientComm::setMaxRetry ( unsigned int  newMaxRetry)
void rnp::RnpBaseClientComm::startRequest ( RnpQuark  command,
int  transmitterBufferSize = RNP_DEFAULTBUFFERSIZE 
)
protected

Start building the request, might throw whatever new throws.

Member Data Documentation

RnpTransport::CarrierProtocol rnp::RnpBaseClientComm::carrierProtocol
protected
RnpClientJob rnp::RnpBaseClientComm::clientJob
protected
NbCommunicator* rnp::RnpBaseClientComm::communicatorPtr
protected
RnpProtocolDecoder rnp::RnpBaseClientComm::decoder
protected
RnpTransmitter rnp::RnpBaseClientComm::encoder
protected
NbCommunicator rnp::RnpBaseClientComm::internalCommunicator
protected
unsigned int rnp::RnpBaseClientComm::maxRetry
protected
const char* rnp::RnpBaseClientComm::serverHost
protected
unsigned int rnp::RnpBaseClientComm::serverPort
protected
RnpQuark rnp::RnpBaseClientComm::serverType
protected
CommBuffer rnp::RnpBaseClientComm::transmitterBuffer
protected

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