gz/transport/SubscriptionHandler.hh
bool RunRawCallback(const char *_msgData, const size_t _size, const MessageInfo &_info)
Executes the raw callback registered for this handler.
SubscriptionHandler(const std::string &_nUuid, const SubscribeOptions &_opts=SubscribeOptions())
Definition: gz/transport/SubscriptionHandler.hh:234
STL class.
double periodNs
If throttling is enabled, the minimum period for receiving a message in nanoseconds.
Definition: gz/transport/SubscriptionHandler.hh:92
google::protobuf::Message ProtoMsg
Definition: gz/transport/TransportTypes.hh:68
RawSubscriptionHandler(const std::string &_nUuid, const std::string &_msgType=kGenericMessageType, const SubscribeOptions &_opts=SubscribeOptions())
Constructor.
SubscriptionHandlerBase contains functions and data which are common to all SubscriptionHandler types...
Definition: gz/transport/SubscriptionHandler.hh:57
std::string TypeName()
Get the type of the messages from which this subscriber handler is subscribed.
Definition: gz/transport/SubscriptionHandler.hh:278
virtual ~ISubscriptionHandler()=default
Destructor.
std::string hUuid
Unique handler's UUID.
Definition: gz/transport/SubscriptionHandler.hh:101
SubscriptionHandlerBase(const std::string &_nUuid, const SubscribeOptions &_opts=SubscribeOptions())
Constructor.
bool UpdateThrottling()
Check if message subscription is throttled. If so, verify whether the callback should be executed or ...
T reset(T... args)
bool RunLocalCallback(const ProtoMsg &_msg, const MessageInfo &_info)
Executes the local callback registered for this handler.
Definition: gz/transport/SubscriptionHandler.hh:291
A class to provide different options for a subscription.
Definition: gz/transport/SubscribeOptions.hh:37
void SetCallback(const RawCallback &_callback)
Set the callback of this handler.
virtual ~SubscriptionHandlerBase()=default
Destructor.
Timestamp lastCbTimestamp
Timestamp of the last callback executed.
Definition: gz/transport/SubscriptionHandler.hh:104
virtual const std::shared_ptr< ProtoMsg > CreateMsg(const std::string &_data, const std::string &_type) const =0
Create a specific protobuf message given its serialized data.
std::chrono::steady_clock::time_point Timestamp
Definition: gz/transport/TransportTypes.hh:153
std::string TypeName() override
Get the type of the messages from which this subscriber handler is subscribed.
A class that provides information about the message received.
Definition: gz/transport/MessageInfo.hh:35
bool RunLocalCallback(const ProtoMsg &_msg, const MessageInfo &_info)
Executes the local callback registered for this handler.
Definition: gz/transport/SubscriptionHandler.hh:197
SubscribeOptions opts
Subscribe options.
Definition: gz/transport/SubscriptionHandler.hh:88
It creates a subscription handler for a specific protobuf message. 'T' is the Protobuf message type t...
Definition: gz/transport/SubscriptionHandler.hh:155
std::string NodeUuid() const
Get the node UUID.
Interface class used to manage generic protobuf messages.
Definition: gz/transport/SubscriptionHandler.hh:121
const std::shared_ptr< ProtoMsg > CreateMsg(const std::string &_data, const std::string &_type) const
Create a specific protobuf message given its serialized data.
Definition: gz/transport/SubscriptionHandler.hh:241
void SetCallback(const MsgCallback< ProtoMsg > &_cb)
Set the callback for this handler.
Definition: gz/transport/SubscriptionHandler.hh:285
T endl(T... args)
Definition: gz/transport/AdvertiseOptions.hh:28
std::string TypeName()
Get the type of the messages from which this subscriber handler is subscribed.
Definition: gz/transport/SubscriptionHandler.hh:184
const std::string kGenericMessageType
The string type used for generic messages.
Definition: gz/transport/TransportTypes.hh:172
std::string HandlerUuid() const
Get the unique UUID of this handler.
ISubscriptionHandler(const std::string &_nUuid, const SubscribeOptions &_opts=SubscribeOptions())
Constructor.
SubscriptionHandler(const std::string &_nUuid, const SubscribeOptions &_opts=SubscribeOptions())
Definition: gz/transport/SubscriptionHandler.hh:159
virtual bool RunLocalCallback(const ProtoMsg &_msg, const MessageInfo &_info)=0
Executes the local callback registered for this handler.
const std::shared_ptr< ProtoMsg > CreateMsg(const std::string &_data, const std::string &) const
Create a specific protobuf message given its serialized data.
Definition: gz/transport/SubscriptionHandler.hh:166
Definition: gz/transport/SubscriptionHandler.hh:317
~RawSubscriptionHandler()
Destructor.
void SetCallback(const MsgCallback< T > &_cb)
Set the callback for this handler.
Definition: gz/transport/SubscriptionHandler.hh:191
virtual std::string TypeName()=0
Get the type of the messages from which this subscriber handler is subscribed.