Gazebo Transport

API Reference

14.0.0
ISubscriptionHandler Class Referenceabstract

Interface class used to manage generic protobuf messages. More...

#include <SubscriptionHandler.hh>

Public Member Functions

 ISubscriptionHandler (const std::string &_nUuid, const SubscribeOptions &_opts=SubscribeOptions())
 Constructor.
 
virtual ~ISubscriptionHandler ()=default
 Destructor.
 
virtual const std::shared_ptr< ProtoMsgCreateMsg (const std::string &_data, const std::string &_type) const =0
 Create a specific protobuf message given its serialized data.
 
virtual bool RunLocalCallback (const ProtoMsg &_msg, const MessageInfo &_info)=0
 Executes the local callback registered for this handler.
 
- Public Member Functions inherited from SubscriptionHandlerBase
 SubscriptionHandlerBase (const std::string &_nUuid, const SubscribeOptions &_opts=SubscribeOptions())
 Constructor.
 
virtual ~SubscriptionHandlerBase ()=default
 Destructor.
 
std::string HandlerUuid () const
 Get the unique UUID of this handler.
 
bool IgnoreLocalMessages () const
 Return whether local messages are ignored or not.
 
std::string NodeUuid () const
 Get the node UUID.
 
virtual std::string TypeName ()=0
 Get the type of the messages from which this subscriber handler is subscribed.
 

Additional Inherited Members

- Protected Member Functions inherited from SubscriptionHandlerBase
bool UpdateThrottling ()
 Check if message subscription is throttled. If so, verify whether the callback should be executed or not.
 
- Protected Attributes inherited from SubscriptionHandlerBase
std::string hUuid
 Unique handler's UUID.
 
Timestamp lastCbTimestamp
 Timestamp of the last callback executed.
 
SubscribeOptions opts
 Subscribe options.
 
double periodNs
 If throttling is enabled, the minimum period for receiving a message in nanoseconds.
 

Detailed Description

Interface class used to manage generic protobuf messages.

gz/transport/SubscriptionHandler.hh

This extends SubscriptionHandlerBase by defining virtual functions for deserializing protobuf message data, and for receiving deserialized messages. Those functions are not needed by the RawSubscriptionHandler class.

Constructor & Destructor Documentation

◆ ISubscriptionHandler()

ISubscriptionHandler ( const std::string _nUuid,
const SubscribeOptions _opts = SubscribeOptions() 
)
explicit

Constructor.

Parameters
[in]_nUuidUUID of the node registering the handler.
[in]_optsSubscription options.

◆ ~ISubscriptionHandler()

virtual ~ISubscriptionHandler ( )
virtualdefault

Destructor.

Member Function Documentation

◆ CreateMsg()

virtual const std::shared_ptr< ProtoMsg > CreateMsg ( const std::string _data,
const std::string _type 
) const
pure virtual

Create a specific protobuf message given its serialized data.

Parameters
[in]_dataThe serialized data.
[in]_typeThe data type.
Returns
Pointer to the specific protobuf message.

Implemented in SubscriptionHandler< T >, and SubscriptionHandler< ProtoMsg >.

◆ RunLocalCallback()

virtual bool RunLocalCallback ( const ProtoMsg _msg,
const MessageInfo _info 
)
pure virtual

Executes the local callback registered for this handler.

Parameters
[in]_msgProtobuf message received.
[in]_infoMessage information (e.g.: topic name).
Returns
True when success, false otherwise.

Implemented in SubscriptionHandler< T >, and SubscriptionHandler< ProtoMsg >.


The documentation for this class was generated from the following file: