Template Class CMsgPublisher#
Defined in File publisher.h
Inheritance Relationships#
Base Type#
public eCAL::CPublisher
(Class CPublisher)
Class Documentation#
-
template<typename T>
class CMsgPublisher : public eCAL::CPublisher# eCAL abstract message publisher class.
Abstract publisher template class for messages. For details see documentation of CPublisher class.
Public Functions
-
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()
function, first.
-
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).
-
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.
-
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.
-
CMsgPublisher(const CMsgPublisher&) = delete#
Copy Constructor is not available.
-
CMsgPublisher &operator=(const CMsgPublisher&) = delete#
Copy Constructor is not available.
-
CMsgPublisher(CMsgPublisher&&) = default#
Move Constructor.
-
CMsgPublisher &operator=(CMsgPublisher&&) = default#
Move assignment.
-
virtual ~CMsgPublisher() = default#
-
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.
-
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.
-
inline bool Destroy()#
Destroys this object.
- Returns:
True if it succeeds, false if it fails.
-
inline size_t Send(const T &msg_, long long time_ = eCAL::CPublisher::DEFAULT_TIME_ARGUMENT)#
Send serialized message.
- Parameters:
msg_ – The message object.
time_ – Optional time stamp.
- Returns:
Number of bytes sent.
-
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.
-
inline CMsgPublisher()#