Template Class CMsgSubscriber#
Defined in File subscriber.h
Inheritance Relationships#
Base Type#
public eCAL::CSubscriber
(Class CSubscriber)
Class Documentation#
-
template<typename T>
class CMsgSubscriber : public eCAL::CSubscriber# eCAL abstract message subscriber class.
Abstract subscriber template class for messages. For details see documentation of CPublisher class.
Public Types
-
using MsgReceiveCallbackT = std::function<void(const char*, const T&, long long, long long, long long)>#
eCAL message receive callback function
- Param topic_name_:
Topic name of the data source (publisher).
- Param msg_:
Message content.
- Param time_:
Message time stamp.
- Param clock_:
Message writer clock.
- Param id_:
Message id.
Public Functions
-
inline CMsgSubscriber()#
Constructor.
-
inline CMsgSubscriber(const std::string &topic_name_, const struct SDataTypeInformation &topic_info_)#
Constructor.
- Parameters:
topic_name_ – Unique topic name.
topic_info_ – Topic type information (encoding, type, descriptor).
-
virtual ~CMsgSubscriber() = default#
-
CMsgSubscriber(const CMsgSubscriber&) = delete#
Copy Constructor is not available.
-
CMsgSubscriber &operator=(const CMsgSubscriber&) = delete#
Copy Constructor is not available.
-
inline CMsgSubscriber(CMsgSubscriber &&rhs) noexcept#
Move Constructor.
-
inline CMsgSubscriber &operator=(CMsgSubscriber &&rhs) noexcept#
Move assignment.
-
inline bool Create(const std::string &topic_name_, const struct 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.
-
inline bool Destroy()#
Destroys this object.
- Returns:
true if it succeeds, false if it fails.
-
inline bool Receive(T &msg_, long long *time_ = nullptr, int rcv_timeout_ = 0) const#
Receive deserialized message.
- Parameters:
msg_ – [out] The message object.
time_ – [out] Optional receive time stamp.
rcv_timeout_ – Receive timeout in ms.
- Returns:
True if a message could received, false otherwise.
-
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.
-
inline bool RemReceiveCallback()#
Remove receive callback for incoming messages.
- Returns:
True if it succeeds, false if it fails.
-
using MsgReceiveCallbackT = std::function<void(const char*, const T&, long long, long long, long long)>#