A simple receiver object for handling data streamed by rc_visard's rc_dynamics module.
More...
#include <data_receiver.h>
|
std::string | getIpAddress () const |
| Returns Ip address for which the receiver was created. More...
|
|
unsigned int | getPort () const |
| Returns port for which the receiver was created. More...
|
|
template<class PbMsgType > |
std::shared_ptr< PbMsgType > | receive () |
| Receives the next message from data stream (template-parameter version) More...
|
|
virtual std::shared_ptr<::google::protobuf::Message > | receive (const std::string &pb_msg_type) |
| Receives the next message from data stream (string-parameter version) More...
|
|
virtual void | setTimeout (unsigned int ms) |
| Sets a user-specified timeout for the receivePose() method. More...
|
|
virtual | ~DataReceiver () |
|
|
static Ptr | create (const std::string &ip_address, unsigned int &port) |
| Creates a data receiver bound to the user-given IP address and port number. More...
|
|
|
typedef std::map< std::string, std::function< std::shared_ptr<::google::protobuf::Message >)> > | map_type |
|
|
| DataReceiver (const std::string &ip_address, unsigned int &port) |
|
A simple receiver object for handling data streamed by rc_visard's rc_dynamics module.
Definition at line 69 of file data_receiver.h.
virtual rc::dynamics::DataReceiver::~DataReceiver |
( |
| ) |
|
|
inlinevirtual |
rc::dynamics::DataReceiver::DataReceiver |
( |
const std::string & |
ip_address, |
|
|
unsigned int & |
port |
|
) |
| |
|
inlineprotected |
static Ptr rc::dynamics::DataReceiver::create |
( |
const std::string & |
ip_address, |
|
|
unsigned int & |
port |
|
) |
| |
|
inlinestatic |
Creates a data receiver bound to the user-given IP address and port number.
For binding to an arbitrary port, the given port number might be 0. In this case, the actually chosen port number is returned.
- Parameters
-
ip_address | IP address for receiving data |
port | port number for receiving data |
- Returns
Definition at line 85 of file data_receiver.h.
std::string rc::dynamics::DataReceiver::getIpAddress |
( |
| ) |
const |
|
inline |
Returns Ip address for which the receiver was created.
Definition at line 102 of file data_receiver.h.
unsigned int rc::dynamics::DataReceiver::getPort |
( |
| ) |
const |
|
inline |
Returns port for which the receiver was created.
Definition at line 109 of file data_receiver.h.
template<class PbMsgType >
std::shared_ptr<PbMsgType> rc::dynamics::DataReceiver::receive |
( |
| ) |
|
|
inline |
Receives the next message from data stream (template-parameter version)
This method blocks until the next message is received and returns it as specified by the template parameter PbMsgType, or when it runs into user-specified timeout (see setTimeout(...)).
NOTE: The specified PbMsgType must match the type with which the received data was serialized during sending. Otherwise it will result in undefined behaviour!
- Returns
- the next rc_dynamics data stream message as PbMsgType, or NULL if timeout
Definition at line 151 of file data_receiver.h.
virtual std::shared_ptr<::google::protobuf::Message> rc::dynamics::DataReceiver::receive |
( |
const std::string & |
pb_msg_type | ) |
|
|
inlinevirtual |
Receives the next message from data stream (string-parameter version)
This method blocks until the next message is available and returns it - de-serialized as specified by the pb_msg_type parameter - as a pb::Message base class pointer, or until it runs into user-specified timeout (see setTimeout(...)).
NOTE: The specified PbMsgType must match the type with which the received data was serialized during sending. Otherwise it will result in undefined behaviour!
- Returns
- the next rc_dynamics data stream message as a pb::Message base class pointer, or NULL if timeout
Definition at line 208 of file data_receiver.h.
virtual void rc::dynamics::DataReceiver::setTimeout |
( |
unsigned int |
ms | ) |
|
|
inlinevirtual |
Sets a user-specified timeout for the receivePose() method.
- Parameters
-
ms | timeout in milliseconds |
Definition at line 118 of file data_receiver.h.
char rc::dynamics::DataReceiver::_buffer[512] |
|
protected |
map_type rc::dynamics::DataReceiver::_recv_func_map |
|
protected |
int rc::dynamics::DataReceiver::_sockfd |
|
protected |
std::string rc::dynamics::DataReceiver::ip_ |
|
protected |
unsigned int rc::dynamics::DataReceiver::port_ |
|
protected |
The documentation for this class was generated from the following file: