Gazebo Transport

API Reference

12.2.2
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. More...
 
virtual ~ISubscriptionHandler ()=default
 Destructor. More...
 
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. More...
 
virtual bool RunLocalCallback (const ProtoMsg &_msg, const MessageInfo &_info)=0
 Executes the local callback registered for this handler. More...
 
- Public Member Functions inherited from SubscriptionHandlerBase
 SubscriptionHandlerBase (const std::string &_nUuid, const SubscribeOptions &_opts=SubscribeOptions())
 Constructor. More...
 
virtual ~SubscriptionHandlerBase ()=default
 Destructor. More...
 
std::string HandlerUuid () const
 Get the unique UUID of this handler. More...
 
std::string NodeUuid () const
 Get the node UUID. More...
 
virtual std::string TypeName ()=0
 Get the type of the messages from which this subscriber handler is subscribed. More...
 

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. More...
 
- Protected Attributes inherited from SubscriptionHandlerBase
std::string hUuid
 Unique handler's UUID. More...
 
Timestamp lastCbTimestamp
 Timestamp of the last callback executed. More...
 
SubscribeOptions opts
 Subscribe options. More...
 
double periodNs
 If throttling is enabled, the minimum period for receiving a message in nanoseconds. More...
 

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< ProtoMsg >, and SubscriptionHandler< T >.

◆ 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< ProtoMsg >, and SubscriptionHandler< T >.


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