class eCAL::CMsgSubscriber
1class eCAL::CMsgSubscriber2 : public eCAL::CSubscribereCAL abstract message subscriber class.
Abstract subscriber template class for messages. For details see documentation of CPublisher class.
Members
public inline CMsgSubscriber()
Constructor.
public inline CMsgSubscriber(const std::string & topic_name_,const std::string & topic_type_,const std::string & topic_desc_)
Constructor.
Deprecated: Please use the constructor CMsgSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in future eCAL versions.
Parameters
-
topic_name_Unique topic name. -
topic_type_Type name (optional for type checking). -
topic_desc_Type description (optional for description checking).
public inline CMsgSubscriber(const std::string & topic_name_,const SDataTypeInformation & topic_info_)
Constructor.
Parameters
-
topic_name_Unique topic name. -
topic_info_Topic type information (encoding, type, descriptor).
public virtual ~CMsgSubscriber() = default
public CMsgSubscriber(const CMsgSubscriber &) = delete
Copy Constructor is not available.
public CMsgSubscriber&operator=(const CMsgSubscriber &) = delete
Copy Constructor is not available.
public inline CMsgSubscriber(CMsgSubscriber && rhs)
Move Constructor.
public inline CMsgSubscriber&operator=(CMsgSubscriber && rhs)
Move assignment.
public inline bool Create(const std::string & topic_name_,const std::string & topic_type_,const std::string & topic_desc_)
Creates this object.
Deprecated: Please use the method CMsgSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in future eCAL versions.
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.
public inline bool Create(const std::string & topic_name_,const SDataTypeInformation & topic_info_)
Creates this object.
Parameters
-
topic_name_Unique topic name. -
topic_info_Topic type information (encoding, type, descriptor).
Returns
true if it succeeds, false if it fails.
public inline bool Destroy()
Destroys this object.
Returns
true if it succeeds, false if it fails.
public inline bool Receive(T & msg_,long long * time_,int rcv_timeout_) const
Receive deserialized message.
Parameters
-
msg_The message object. -
time_Optional receive time stamp. -
rcv_timeout_Receive timeout in ms.
Returns
True if a message could received, false otherwise.
public 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.
public inline bool RemReceiveCallback()
Remove receive callback for incoming messages.
Returns
True if it succeeds, false if it fails.
protected inline virtual std::string GetTypeName() const
protected inline virtual std::string GetDescription() const
protected inline virtual SDataTypeInformation GetDataTypeInformation() const
protected bool Deserialize(T & msg_,const void * buffer_,size_t size_) const
typedef MsgReceiveCallbackT
eCAL message receive callback function
Parameters
-
topic_name_Topic name of the data source (publisher). -
msg_Message content. -
time_Message time stamp. -
clock_Message writer clock. -
id_Message id.