class eCAL::CMsgPublisher
1class eCAL::CMsgPublisher2 : public eCAL::CPublishereCAL 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.