Gazebo Transport

API Reference

14.0.0
RawSubscriptionHandler Class Reference

#include <SubscriptionHandler.hh>

Public Member Functions

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

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

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: