Template Class CMsgSubscriber#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename T>
class CMsgSubscriber : public eCAL::CSubscriber#

eCAL abstract message subscriber class.

Abstract subscriber template class for messages. For details see documentation of CPublisher class.

Public Types

typedef std::function<void(const char *topic_name_, const T &msg_, long long time_, long long clock_, long long id_)> MsgReceiveCallbackT#

eCAL message receive callback function

Param topic_name_

Topic name of the data source (publisher).

Param msg_

Message content.

Param time_

Message time stamp.

Param clock_

Message writer clock.

Param id_

Message id.

Public Functions

inline CMsgSubscriber()#

Constructor.

inline CMsgSubscriber(const std::string &topic_name_, const std::string &topic_type_ = "", const std::string &topic_desc_ = "")#

Constructor.

Parameters
  • topic_name_ – Unique topic name.

  • topic_type_ – Type name (optional for type checking).

  • topic_desc_ – Type description (optional for description checking).

CMsgSubscriber(const CMsgSubscriber&) = delete#

Copy Constructor is not available.

CMsgSubscriber &operator=(const CMsgSubscriber&) = delete#

Copy Constructor is not available.

inline CMsgSubscriber(CMsgSubscriber &&rhs)#

Move Constructor.

inline CMsgSubscriber &operator=(CMsgSubscriber &&rhs)#

Move assignment.

inline virtual ~CMsgSubscriber()#
inline bool Create(const std::string &topic_name_, const std::string &topic_type_ = "", const std::string &topic_desc_ = "")#

Creates this object.

Parameters
  • topic_name_ – Unique topic name.

  • topic_type_ – Type name (optional for type checking).

  • topic_desc_ – Type description (optional for description checking).

Returns

true if it succeeds, false if it fails.

inline bool Destroy()#

Destroys this object.

Returns

true if it succeeds, false if it fails.

inline bool Receive(T &msg_, long long *time_ = nullptr, int rcv_timeout_ = 0) const#

Receive deserialized message.

Parameters
  • msg_[out] The message object.

  • time_[out] Optional receive time stamp.

  • rcv_timeout_ – Receive timeout in ms.

Returns

True if a message could received, false otherwise.

inline bool AddReceiveCallback(MsgReceiveCallbackT callback_)#

Add receive callback for incoming messages.

Parameters

callback_ – The callback function.

Returns

True if it succeeds, false if it fails.

inline bool RemReceiveCallback()#

Remove receive callback for incoming messages.

Returns

True if it succeeds, false if it fails.