class eCAL::CMsgPublisher
1class eCAL::CMsgPublisher2 : public eCAL::CPublisher
eCAL abstract message publisher class.
Abstract publisher template class for messages. For details see documentation of CPublisher class.
Members
public inline
CMsgPublisher
()
Default Constructor. Using this constructor, the object is not actually in a usable state. Before being able to send data, one has to call the [Create()](src/content/docs/doxygen/md/Create.md#d3/d46/classeCAL_1_1CMsgPublisher_1a447bbe94735245dbccd3dc274103b770)
function, first.
public inline
CMsgPublisher
(const std::string & topic_name_,const std::string & topic_type_,const std::string & topic_desc_)
Constructor, that automatically intializes the Publisher.
Deprecated: Please use the constructor CMsgPublisher(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. -
topic_desc_
Type description (optional for description checking).
public inline
CMsgPublisher
(const std::string & topic_name_,const
SDataTypeInformation
& topic_info_)
Constructor, that automatically intializes the Publisher. This should be the preferred constructor.
Parameters
-
topic_name_
Unique topic name. -
topic_info_
Struct that contains information of the datatype (name, encoding, description) of the topic.
public inline
CMsgPublisher
(const std::string & topic_name_)
Constructor, that automatically intializes the Publisher. If no datatype information about the topic is available, this constructor can be used.
Parameters
topic_name_
Unique topic name.
public
CMsgPublisher
(const
CMsgPublisher
&) = delete
Copy Constructor is not available.
public
CMsgPublisher
&
operator=
(const
CMsgPublisher
&) = delete
Copy Constructor is not available.
public
CMsgPublisher
(
CMsgPublisher
&&) = default
Move Constructor.
public
CMsgPublisher
&
operator=
(
CMsgPublisher
&&) = default
Move assignment.
public virtual
~CMsgPublisher
() = default
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 Create(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_
Associated datatype description.
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 size_t
Send
(const T & msg_,long long time_)
Send serialized message.
Parameters
-
msg_
The message object. -
time_
Optional time stamp.
Returns
Number of bytes sent.
public inline size_t
Send
(const T & msg_,long long time_,long long acknowledge_timeout_ms_)
Send a serialized message to all subscribers synchronized with acknowledge timeout (see also ShmSetAcknowledgeTimeout).
This synchronized mode is currently implemented for local interprocess communication (shm-ecal layer) only.
Parameters
-
msg_
The message object. -
time_
Time stamp. -
acknowledge_timeout_ms_
Maximum time to wait for all subscribers acknowledge feedback in ms (buffer received and processed).
Returns
Number of bytes sent.