CarobNS::DriverSocket Class Reference

Higher level class for socket. More...

#include <DriverSocket.hpp>

Inheritance diagram for CarobNS::DriverSocket:

CarobNS::JavaSocket List of all members.

Public Member Functions

 DriverSocket (const std::wstring &host, in_addr_t port) throw (ConnectionException, UnexpectedException)
 Constructor to directly connect to a host.
const DriverSocketoperator<< (const std::wstring &) const throw (SocketIOException, UnexpectedException)
 Writes a string to the socket according to the controller protocol FIXME: we don't support string longer than 64K once UTF8 encoded.
const DriverSocketoperator<< (const wchar_t *) const throw (SocketIOException, UnexpectedException)
 Convenience method to send C-style strings.
const DriverSocketoperator>> (std::wstring &) const throw (SocketIOException, UnexpectedException)
 Reads a string from the socket according to the controller protocol FIXME: we don't support string longer than 64K once UTF8 encoded.
const DriverSocketoperator<< (const int32_t &) const throw (SocketIOException, UnexpectedException)
 Writes a 32-bits int to the socket
Exceptions:
SocketIOException. 

const DriverSocketoperator>> (int32_t &i) const throw (SocketIOException, UnexpectedException)
 Reads a 32-bits int from the socket
Exceptions:
SocketIOException. 

const DriverSocketoperator<< (const int64_t &) const throw (SocketIOException, UnexpectedException)
 Writes a 64-bits long to the socket
Exceptions:
SocketIOException. 

const DriverSocketoperator>> (int64_t &i) const throw (SocketIOException, UnexpectedException)
 Reads a 64-bits long from the socket
Exceptions:
SocketIOException. 

const DriverSocketoperator<< (const bool &) const throw (SocketIOException, UnexpectedException)
 Writes a boolean to the socket
Exceptions:
SocketIOException. 

const DriverSocketoperator>> (bool &i) const throw (SocketIOException, UnexpectedException)
 Reads a boolean from the socket
Exceptions:
SocketIOException. 

void readBytes (int32_t length, java_byte *data) const throw (SocketIOException, UnexpectedException)
 Reads given number of bytes from the socket into the given array
Exceptions:
SocketIOException. 

void writeBytes (int32_t length, java_byte *data) const throw (SocketIOException, UnexpectedException)
 Writes given number of bytes from the socket
Exceptions:
SocketIOException. 


Detailed Description

Higher level class for socket.

Defines handy methods to read/write to/from a controller following the controller/driver communication protocol.


Constructor & Destructor Documentation

CarobNS::DriverSocket::DriverSocket ( const std::wstring &  host,
in_addr_t  port 
) throw (ConnectionException, UnexpectedException)

Constructor to directly connect to a host.

Parameters:
host host to connect to
port port of the host to connect to
Exceptions:
ConnectionException 


Member Function Documentation

const DriverSocket& CarobNS::DriverSocket::operator<< ( const std::wstring &   )  const throw (SocketIOException, UnexpectedException)

Writes a string to the socket according to the controller protocol FIXME: we don't support string longer than 64K once UTF8 encoded.

Exceptions:
SocketIOException 

const DriverSocket& CarobNS::DriverSocket::operator<< ( const wchar_t *   )  const throw (SocketIOException, UnexpectedException)

Convenience method to send C-style strings.

Creates a wstring and sends it. Reminder: every C-style string can be a wstring; the opposite is not true.

const DriverSocket& CarobNS::DriverSocket::operator>> ( std::wstring &   )  const throw (SocketIOException, UnexpectedException)

Reads a string from the socket according to the controller protocol FIXME: we don't support string longer than 64K once UTF8 encoded.

Exceptions:
SocketIOException 


The documentation for this class was generated from the following file:
Generated on Tue Oct 24 09:05:38 2006 for Carob by  doxygen 1.5.0