Class DataReceiver
Defined in File data_receiver.h
Inheritance Relationships
Base Type
public std::enable_shared_from_this< DataReceiver >
Class Documentation
-
class DataReceiver : public std::enable_shared_from_this<DataReceiver>
A simple receiver object for handling data streamed by rc_visard’s rc_dynamics module.
Public Types
-
using Ptr = std::shared_ptr<DataReceiver>
Public Functions
-
inline virtual ~DataReceiver()
-
inline std::string getIpAddress() const
Returns Ip address for which the receiver was created
-
inline unsigned int getPort() const
Returns port for which the receiver was created
-
inline virtual void setTimeout(unsigned int ms)
Sets a user-specified timeout for the receivePose() method.
- Parameters:
ms – timeout in milliseconds
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
-
inline virtual std::shared_ptr<::google::protobuf::Message> receive(const std::string &pb_msg_type)
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
Public Static Functions
-
static inline Ptr create(const std::string &ip_address, unsigned int &port)
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:
Protected Types
- std::map< std::string, std::function< std::shared_ptr<::google::protobuf::Message >)> > map_type
Protected Functions
-
inline DataReceiver(const std::string &ip_address, unsigned int &port)
-
using Ptr = std::shared_ptr<DataReceiver>