OpenDaVINCI  4.15.3
odcore::io::tcp::TCPConnection Class Referenceabstract

#include <TCPConnection.h>

Inheritance diagram for odcore::io::tcp::TCPConnection:
Inheritance graph

Public Member Functions

virtual ~TCPConnection ()
void send (const string &data)
void setConnectionListener (ConnectionListener *cl)
void setStringListener (StringListener *listener)
virtual void start ()=0
virtual void stop ()=0
bool isRaw () const
void setRaw (const bool &raw)

Protected Member Functions

 TCPConnection ()
void receivedString (const string &partialData)
virtual void sendImplementation (const string &data)=0
void invokeConnectionListener ()

Constructor & Destructor Documentation

odcore::io::tcp::TCPConnection::TCPConnection ( )

Protected constructor for enforcing subclasses for this class.

odcore::io::tcp::TCPConnection::~TCPConnection ( )

Member Function Documentation

bool odcore::io::tcp::TCPConnection::isRaw ( ) const

This method returns if we have configured a raw TCP connection (i.e. without the size of the payload information).

Referenced by receivedString(), and send().

void odcore::io::tcp::TCPConnection::receivedString ( const string &  partialData)

This method has to be called by subclasses whenever new (partial) data was received. This method is responsible for gathering partial data and invoking the registered StringListener when a complete data packet was gathered.

partialDataPartially received data that will be gathered until the complete data can be passed to the registered StringListener.

References isRaw().

Referenced by odcore::wrapper::POSIX::POSIXTCPConnection::run(), and odcore::wrapper::WIN32Impl::WIN32TCPConnection::run().

void odcore::io::tcp::TCPConnection::send ( const string &  data)

This method is used to send data using this TCP connection.

dataData to send.

References isRaw(), and sendImplementation().

Referenced by odcore::wrapper::POSIX::POSIXTCPConnection::sendImplementation(), and odcore::wrapper::WIN32Impl::WIN32TCPConnection::sendImplementation().

virtual void odcore::io::tcp::TCPConnection::sendImplementation ( const string &  data)
protectedpure virtual

This method has to be implemented in subclasses to send data. It is called from within the send()- method.

param data Data with prepended size information.

Implemented in odcore::wrapper::POSIX::POSIXTCPConnection, and odcore::wrapper::WIN32Impl::WIN32TCPConnection.

Referenced by send().

void odcore::io::tcp::TCPConnection::setConnectionListener ( ConnectionListener cl)

This method registers a ConnectionListener that will be informed about connection errors.

clThe ConnectionListener

Implements odcore::io::ConnectionObserver.

Referenced by ~TCPConnection().

void odcore::io::tcp::TCPConnection::setRaw ( const bool &  raw)

This method configures a TCP connection to just transport the raw bytes.

void odcore::io::tcp::TCPConnection::setStringListener ( StringListener listener)

This method sets the StringListener that will receive incoming data.

listenerStringListener that will receive incoming data.

Implements odcore::io::StringObserver.

Referenced by ~TCPConnection().

virtual void odcore::io::tcp::TCPConnection::start ( )
pure virtual

This method must be called to start the connection.

Implemented in odcore::wrapper::POSIX::POSIXTCPConnection, and odcore::wrapper::WIN32Impl::WIN32TCPConnection.

virtual void odcore::io::tcp::TCPConnection::stop ( )
pure virtual