version 3.3

VRS::TwoPointConnection Class Reference

#include <vrs/qt3/twopointconnection.h>

Inheritance diagram for VRS::TwoPointConnection:

VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  NetworkError { ERR_NO_ERROR, ERR_CONNECTION_REFUSED, ERR_HOST_NOT_FOUND, ERR_SOCKET_READ }

Public Member Functions

 TwoPointConnection ()
 Creates an TwopointConnection. It is idle until one of the start() methods is called.
void start (int port)
 Sets up a server on the specified port */.
void start (std::string host, int port)
 Connects two a server on the specified host and the specified port.
void stop ()
 Stops the current connection.
virtual ~TwoPointConnection ()
int bytesReceived () const
 Number of received bytes waiting in the buffer for being streamed.
bool connected () const
 Indicates the connection status.
void flush ()
 Sends the in streamed data.
void setFlushThreshold (unsigned int size=0)
 Set the autoFlush constant. Setting it to 0 disables auto flush.
unsigned int getFlushThreshold () const
 Return the autoFlush constant.
TwoPointConnectionoperator<< (VRS::UINT8)
TwoPointConnectionoperator<< (VRS::UINT16)
TwoPointConnectionoperator<< (VRS::UINT32)
TwoPointConnectionoperator<< (VRS::UINT64)
TwoPointConnectionoperator<< (float)
TwoPointConnectionoperator<< (double)
TwoPointConnectionoperator<< (bool)
TwoPointConnectionoperator<< (Vector)
TwoPointConnectionoperator<< (SO< SharedObj >)
TwoPointConnectionoperator>> (VRS::UINT8 &)
TwoPointConnectionoperator>> (VRS::UINT16 &)
TwoPointConnectionoperator>> (VRS::UINT32 &)
TwoPointConnectionoperator>> (VRS::UINT64 &)
TwoPointConnectionoperator>> (float &)
TwoPointConnectionoperator>> (double &)
TwoPointConnectionoperator>> (bool &)
TwoPointConnectionoperator>> (Vector &)
TwoPointConnectionoperator>> (SO< SharedObj > &)
void restore (VRS::UINT8)
void restore (VRS::UINT16)
void restore (VRS::UINT32)
void restore (VRS::UINT64)
void restore (float)
void restore (double)
void restore (bool)
void restore (std::string)
void restore (Vector)
void restore (SO< SharedObj >)
void sendString (const std::string &s)
 Sends a 0-terminated string.
bool receiveString (std::string &s)
void registerReceiveCB (Callback1< SharedObj * > *cb)
void unregisterReceiveCB (Callback1< SharedObj * > *cb)
void registerDisconnectCB (Callback1< SharedObj * > *cb)
void unregisterDisconnectCB (Callback1< SharedObj * > *cb)
void registerConnectCB (Callback1< SharedObj * > *cb)
void unregisterConnectCB (Callback1< SharedObj * > *cb)
void registerErrorCB (Callback1< SharedObj * > *cb)
void unregisterErrorCB (Callback1< SharedObj * > *cb)
 VRS_SERIALIZABLE_CLASS_ENUM (NetworkError)
NetworkError getLastError () const
 VRS_TYPEINFO (TwoPointConnection, SharedObj)

Friends

class ImplClient

Classes

class  ImplClient
class  ImplServer


Detailed Description

A TwoPointConnection is a simple interface for a TCP/IP-network connecting two hosts. To establish a connection, the following steps are necessary:

Member Enumeration Documentation

Enumerator:
ERR_NO_ERROR 
ERR_CONNECTION_REFUSED 
ERR_HOST_NOT_FOUND 
ERR_SOCKET_READ 


Constructor & Destructor Documentation

VRS::TwoPointConnection::TwoPointConnection (  ) 

Creates an TwopointConnection. It is idle until one of the start() methods is called.

virtual VRS::TwoPointConnection::~TwoPointConnection (  )  [virtual]


Member Function Documentation

void VRS::TwoPointConnection::start ( int  port  ) 

Sets up a server on the specified port */.

void VRS::TwoPointConnection::start ( std::string  host,
int  port 
)

Connects two a server on the specified host and the specified port.

void VRS::TwoPointConnection::stop (  ) 

Stops the current connection.

int VRS::TwoPointConnection::bytesReceived (  )  const

Number of received bytes waiting in the buffer for being streamed.

bool VRS::TwoPointConnection::connected (  )  const

Indicates the connection status.

void VRS::TwoPointConnection::flush (  ) 

Sends the in streamed data.

void VRS::TwoPointConnection::setFlushThreshold ( unsigned int  size = 0  ) 

Set the autoFlush constant. Setting it to 0 disables auto flush.

unsigned int VRS::TwoPointConnection::getFlushThreshold (  )  const

Return the autoFlush constant.

TwoPointConnection& VRS::TwoPointConnection::operator<< ( VRS::UINT8   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( VRS::UINT16   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( VRS::UINT32   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( VRS::UINT64   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( float   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( double   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( bool   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( Vector   ) 

TwoPointConnection& VRS::TwoPointConnection::operator<< ( SO< SharedObj  ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( VRS::UINT8  ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( VRS::UINT16  ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( VRS::UINT32  ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( VRS::UINT64  ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( float &   ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( double &   ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( bool &   ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( Vector  ) 

TwoPointConnection& VRS::TwoPointConnection::operator>> ( SO< SharedObj > &   ) 

void VRS::TwoPointConnection::restore ( VRS::UINT8   ) 

void VRS::TwoPointConnection::restore ( VRS::UINT16   ) 

void VRS::TwoPointConnection::restore ( VRS::UINT32   ) 

void VRS::TwoPointConnection::restore ( VRS::UINT64   ) 

void VRS::TwoPointConnection::restore ( float   ) 

void VRS::TwoPointConnection::restore ( double   ) 

void VRS::TwoPointConnection::restore ( bool   ) 

void VRS::TwoPointConnection::restore ( std::string   ) 

void VRS::TwoPointConnection::restore ( Vector   ) 

void VRS::TwoPointConnection::restore ( SO< SharedObj  ) 

If you receive data of variable length it can be useful to check data without streaming them out. For example if you store the byte size s of a message first, you should wait until you can stream out the complete message. But you must be able to check the size info without removing it from the stream. So you can give it back by the "restore" method if the message is not completely received.

void VRS::TwoPointConnection::sendString ( const std::string &  s  ) 

Sends a 0-terminated string.

bool VRS::TwoPointConnection::receiveString ( std::string &  s  ) 

Receives a 0-terminated string and stores it in 's'. If the string is not completely received yet, 's' is left unchanged and 'false' is returned.

void VRS::TwoPointConnection::registerReceiveCB ( Callback1< SharedObj * > *  cb  ) 

Similar to the callback mechanism of SharedObj, you can register a callback that is called each time when data arrive.

void VRS::TwoPointConnection::unregisterReceiveCB ( Callback1< SharedObj * > *  cb  ) 

Removes a callback from the callback list.

void VRS::TwoPointConnection::registerDisconnectCB ( Callback1< SharedObj * > *  cb  ) 

This callback is invoked if the socket connection ends.

void VRS::TwoPointConnection::unregisterDisconnectCB ( Callback1< SharedObj * > *  cb  ) 

Removes a callback from the callback list.

void VRS::TwoPointConnection::registerConnectCB ( Callback1< SharedObj * > *  cb  ) 

This callback is invoked when a connection attempt was successful (client mode) or when a client has connected (server mode).

void VRS::TwoPointConnection::unregisterConnectCB ( Callback1< SharedObj * > *  cb  ) 

Unregisters a registered connection callback.

void VRS::TwoPointConnection::registerErrorCB ( Callback1< SharedObj * > *  cb  ) 

Called when a network error occurs.

void VRS::TwoPointConnection::unregisterErrorCB ( Callback1< SharedObj * > *  cb  ) 

Unregisters a registered error callback.

VRS::TwoPointConnection::VRS_SERIALIZABLE_CLASS_ENUM ( NetworkError   ) 

NetworkError VRS::TwoPointConnection::getLastError (  )  const

VRS::TwoPointConnection::VRS_TYPEINFO ( TwoPointConnection  ,
SharedObj   
)


Friends And Related Function Documentation

friend class ImplClient [friend]


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

Generated on Wed May 23 06:00:24 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact