glove::comm::Connection Class Reference
#include <Connection.hpp>
List of all members.
|
Public Member Functions |
| Connection (boost::asio::ip::tcp::socket &s) |
virtual | ~Connection () |
void | write (const std::string msg) |
std::string | read () |
template<typename T > |
T | get () |
template<typename T > |
const std::vector< T > | getN (const char separator= ',') |
void | getACK () |
std::string | getString () |
const std::vector< std::string > | getStringList () |
Detailed Description
This class implements in collaboration with the set of functions and definitions provided by
msg.hpp the remote communication between the
glove::devices::remote::RemoteDevices and the remote server.
- Author:
- Christian Wressnegger
- Date:
- 2009-2010
Constructor & Destructor Documentation
glove::comm::Connection::Connection |
( |
boost::asio::ip::tcp::socket & |
s |
) |
|
The constructor that associates this Connection to the given socket.
- Parameters:
-
virtual glove::comm::Connection::~Connection |
( |
|
) |
[virtual] |
Member Function Documentation
template<typename T >
T glove::comm::Connection::get |
( |
|
) |
[inline] |
Retrieves a value of type T from the internal socket.
- Template Parameters:
-
| T | A type that is able to be processed by a standard istringstream. |
- Exceptions:
-
| glove::comm::illegal_response | If the underlying communication protocol was violated. |
| boost::system::system_error | If the low-level communication to the remote server failed. |
- Returns:
- The retrieved value.
void glove::comm::Connection::getACK |
( |
|
) |
|
Retrieves a "ack" string from the internal socket.
- Exceptions:
-
| glove::comm::illegal_response | If the underlying communication protocol was violated. |
| boost::system::system_error | If the low-level communication to the remote server failed. |
template<typename T >
const std::vector<T> glove::comm::Connection::getN |
( |
const char |
separator = ',' |
) |
[inline] |
Retrieves a vector of value of type T from the internal socket.
- Template Parameters:
-
| T | A type that is able to be processed by a standard istringstream. |
- Parameters:
-
[in] | separator | The separator character for the vector representation. |
- Exceptions:
-
| glove::comm::illegal_response | If the underlying communication protocol was violated. |
| boost::system::system_error | If the low-level communication to the remote server failed. |
- Returns:
- The retrieved vector of values.
std::string glove::comm::Connection::getString |
( |
|
) |
|
Retrieves a sting from the internal socket.
- Exceptions:
-
| glove::comm::illegal_response | If the underlying communication protocol was violated. |
| boost::system::system_error | If the low-level communication to the remote server failed. |
- Returns:
- The retrieved string.
const std::vector<std::string> glove::comm::Connection::getStringList |
( |
|
) |
|
Retrieves a list of strings from the internal socket. The expected list representation is as follows:
"string #1", "string #2", "string #3"
where as
string #1,
string #2 and
string #3 will end up in the list
- Exceptions:
-
| glove::comm::illegal_response | If the underlying communication protocol was violated. |
| boost::system::system_error | If the low-level communication to the remote server failed. |
- Returns:
- The collection of strings.
std::string glove::comm::Connection::read |
( |
|
) |
|
Reads the payload of a single message package according to the format defined by glove::comm::composeMsg(.) functions.
- Exceptions:
-
| glove::comm::illegal_response | If the underlying communication protocol was violated. |
| boost::system::system_error | If the low-level communication to the remote server failed. |
- Returns:
- The payload as standard string.
void glove::comm::Connection::write |
( |
const std::string |
msg |
) |
|
Writes the given message to the internal socket wrapped into a simple message package put together by the glove::comm::composeMsg(const string&) function.
- Exceptions:
-
| glove::comm::illegal_response | If the underlying communication protocol was violated. |
| boost::system::system_error | If the low-level communication to the remote server failed. |
- Parameters:
-
[in] | msg | The message to write. |
The documentation for this class was generated from the following file: