#include <DriverSocket.hpp>
Inheritance diagram for CarobNS::DriverSocket:
Public Member Functions | ||||
DriverSocket (const std::wstring &host, in_addr_t port) throw (ConnectionException, UnexpectedException) | ||||
Constructor to directly connect to a host. | ||||
const 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. | ||||
const DriverSocket & | operator<< (const wchar_t *) const throw (SocketIOException, UnexpectedException) | |||
Convenience method to send C-style strings. | ||||
const 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. | ||||
const DriverSocket & | operator<< (const int32_t &) const throw (SocketIOException, UnexpectedException) | |||
Writes a 32-bits int to the socket
| ||||
const DriverSocket & | operator>> (int32_t &i) const throw (SocketIOException, UnexpectedException) | |||
Reads a 32-bits int from the socket
| ||||
const DriverSocket & | operator<< (const int64_t &) const throw (SocketIOException, UnexpectedException) | |||
Writes a 64-bits long to the socket
| ||||
const DriverSocket & | operator>> (int64_t &i) const throw (SocketIOException, UnexpectedException) | |||
Reads a 64-bits long from the socket
| ||||
const DriverSocket & | operator<< (const bool &) const throw (SocketIOException, UnexpectedException) | |||
Writes a boolean to the socket
| ||||
const DriverSocket & | operator>> (bool &i) const throw (SocketIOException, UnexpectedException) | |||
Reads a boolean from the socket
| ||||
void | readBytes (int32_t length, java_byte *data) const throw (SocketIOException, UnexpectedException) | |||
Reads given number of bytes from the socket into the given array
| ||||
void | writeBytes (int32_t length, java_byte *data) const throw (SocketIOException, UnexpectedException) | |||
Writes given number of bytes from the socket
|
Defines handy methods to read/write to/from a controller following the controller/driver communication protocol.
CarobNS::DriverSocket::DriverSocket | ( | const std::wstring & | host, | |
in_addr_t | port | |||
) | throw (ConnectionException, UnexpectedException) |
Constructor to directly connect to a host.
host | host to connect to | |
port | port of the host to connect to |
ConnectionException |
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.
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.
SocketIOException |