class eCAL::CMsgSubscriber
1class eCAL::CMsgSubscriber2 : public eCAL::CSubscriber
eCAL 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.