Gazebo Transport

API Reference

11.4.1
RawSubscriptionHandler Class Reference

#include <SubscriptionHandler.hh>

Public Member Functions

 RawSubscriptionHandler (const std::string &_nUuid, const std::string &_msgType=kGenericMessageType, const SubscribeOptions &_opts=SubscribeOptions())
 Constructor. More...
 
 ~RawSubscriptionHandler ()
 Destructor. More...
 
bool RunRawCallback (const char *_msgData, const size_t _size, const MessageInfo &_info)
 Executes the raw callback registered for this handler. More...
 
void SetCallback (const RawCallback &_callback)
 Set the callback of this handler. More...
 
std::string TypeName () override
 Get the type of the messages from which this subscriber handler is subscribed. 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...
 

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

RawSubscriptionHandler is used to manage the callback of a raw subscription.

Constructor & Destructor Documentation

◆ RawSubscriptionHandler()

RawSubscriptionHandler ( const std::string _nUuid,
const std::string _msgType = kGenericMessageType,
const SubscribeOptions _opts = SubscribeOptions() 
)
explicit

Constructor.

Parameters
[in]_nUuidUUID of the node registering the handler
[in]_msgTypeName of message type that this handler should listen for. Setting this to kGenericMessageType will tell this handler to listen for all message types.
[in]_optsSubscription options.

◆ ~RawSubscriptionHandler()

Destructor.

Member Function Documentation

◆ RunRawCallback()

bool RunRawCallback ( const char *  _msgData,
const size_t  _size,
const MessageInfo _info 
)

Executes the raw callback registered for this handler.

Parameters
[in]_msgDataSerialized string of message data
[in]_sizeNumber of bytes in the serialized message data
[in]_infoMeta-data for the message
Returns
True if the callback was triggered, false if the callback was not set.

◆ SetCallback()

void SetCallback ( const RawCallback _callback)

Set the callback of this handler.

Parameters
[in]_callbackThe callback function that will be triggered when a message is received.

◆ TypeName()

std::string TypeName ( )
overridevirtual

Get the type of the messages from which this subscriber handler is subscribed.

Returns
String representation of the message type.

Implements SubscriptionHandlerBase.


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