All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ignition::transport::ISubscriptionHandler Class Referenceabstract

ignition/transport/SubscriptionHandler.hh More...

#include <SubscriptionHandler.hh>

Inheritance diagram for ignition::transport::ISubscriptionHandler:
Inheritance graph
[legend]

Public Member Functions

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

Protected Member Functions

bool UpdateThrottling ()
 Check if message subscription is throttled. More...
 

Protected Attributes

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

ignition/transport/SubscriptionHandler.hh

Interface class used to manage generic protobub messages.

Constructor & Destructor Documentation

ignition::transport::ISubscriptionHandler::ISubscriptionHandler ( const std::string &  _nUuid,
const SubscribeOptions _opts = SubscribeOptions() 
)
inlineexplicit

Constructor.

Parameters
[in]_nUuidUUID of the node registering the handler.
[in]_optsSubscription options.
virtual ignition::transport::ISubscriptionHandler::~ISubscriptionHandler ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual const std::shared_ptr<ProtoMsg> ignition::transport::ISubscriptionHandler::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 ignition::transport::SubscriptionHandler< ProtoMsg >, and ignition::transport::SubscriptionHandler< T >.

std::string ignition::transport::ISubscriptionHandler::HandlerUuid ( ) const
inline

Get the unique UUID of this handler.

Returns
A string representation of the handler UUID.
std::string ignition::transport::ISubscriptionHandler::NodeUuid ( ) const
inline

Get the node UUID.

Returns
The string representation of the node UUID.
virtual bool ignition::transport::ISubscriptionHandler::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 ignition::transport::SubscriptionHandler< ProtoMsg >, and ignition::transport::SubscriptionHandler< T >.

virtual std::string ignition::transport::ISubscriptionHandler::TypeName ( )
pure virtual

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

Returns
String representation of the message type.

Implemented in ignition::transport::SubscriptionHandler< ProtoMsg >, and ignition::transport::SubscriptionHandler< T >.

bool ignition::transport::ISubscriptionHandler::UpdateThrottling ( )
inlineprotected

Check if message subscription is throttled.

If so, verify whether the callback should be executed or not.

Returns
true if the callback should be executed or false otherwise.

Referenced by ignition::transport::SubscriptionHandler< T >::RunLocalCallback(), and ignition::transport::SubscriptionHandler< ProtoMsg >::RunLocalCallback().

Member Data Documentation

std::string ignition::transport::ISubscriptionHandler::hUuid
protected

Unique handler's UUID.

Timestamp ignition::transport::ISubscriptionHandler::lastCbTimestamp
protected

Timestamp of the last callback executed.

SubscribeOptions ignition::transport::ISubscriptionHandler::opts
protected

Subscribe options.

double ignition::transport::ISubscriptionHandler::periodNs
protected

If throttling is enabled, the minimum period for receiving a message in nanoseconds.


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