Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
rc::dynamics::DataReceiver Class Reference

#include <data_receiver.h>

Inheritance diagram for rc::dynamics::DataReceiver:
Inheritance graph
[legend]

List of all members.

Public Member Functions

template<class PbMsgType >
std::shared_ptr< PbMsgType > receive ()
virtual std::shared_ptr
<::google::protobuf::Message > 
receive (const std::string &pbMsgType)
virtual void setTimeout (unsigned int ms)
virtual ~DataReceiver ()

Static Public Member Functions

static Ptr create (std::string ip_address, unsigned int &port)

Protected Types

typedef std::map< std::string,
std::function< std::shared_ptr
<::google::protobuf::Message >)> > 
map_type

Protected Member Functions

 DataReceiver (std::string ip_address, unsigned int &port)

Protected Attributes

char _buffer [512]
map_type _recv_func_map
struct timeval _recvtimeout
int _sockfd

Detailed Description

A simple receiver object for handling data streamed by rc_visard's rc_dynamics module.

Definition at line 65 of file data_receiver.h.


Member Typedef Documentation

typedef std::map<std::string, std::function<std::shared_ptr<::google::protobuf::Message>)> > rc::dynamics::DataReceiver::map_type [protected]

Definition at line 236 of file data_receiver.h.


Constructor & Destructor Documentation

virtual rc::dynamics::DataReceiver::~DataReceiver ( ) [inline, virtual]

Definition at line 88 of file data_receiver.h.

rc::dynamics::DataReceiver::DataReceiver ( std::string  ip_address,
unsigned int &  port 
) [inline, protected]

Definition at line 180 of file data_receiver.h.


Member Function Documentation

static Ptr rc::dynamics::DataReceiver::create ( std::string  ip_address,
unsigned int &  port 
) [inline, static]

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_addressIP address for receiving data
portport number for receiving data
Returns:

Definition at line 83 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 125 of file data_receiver.h.

virtual std::shared_ptr<::google::protobuf::Message> rc::dynamics::DataReceiver::receive ( const std::string &  pbMsgType) [inline, virtual]

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 pbMsgType 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 164 of file data_receiver.h.

virtual void rc::dynamics::DataReceiver::setTimeout ( unsigned int  ms) [inline, virtual]

Sets a user-specified timeout for the receivePose() method.

Parameters:
mstimeout in milliseconds

Definition at line 98 of file data_receiver.h.


Member Data Documentation

char rc::dynamics::DataReceiver::_buffer[512] [protected]

Definition at line 234 of file data_receiver.h.

Definition at line 237 of file data_receiver.h.

Definition at line 233 of file data_receiver.h.

Definition at line 232 of file data_receiver.h.


The documentation for this class was generated from the following file:


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:12