All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
ignition::transport::HandlerStorage< T > Class Template Reference

ignition/transport/HandlerStorage.hh More...

#include <HandlerStorage.hh>

Public Member Functions

 HandlerStorage ()=default
 Constructor. More...
 
virtual ~HandlerStorage ()=default
 Destructor. More...
 
void AddHandler (const std::string &_topic, const std::string &_nUuid, const std::shared_ptr< T > &_handler)
 Add a request handler to a topic. More...
 
bool FirstHandler (const std::string &_topic, const std::string &_reqTypeName, const std::string &_repTypeName, std::shared_ptr< T > &_handler) const
 Get the first handler for a topic that matches a specific pair of request/response types. More...
 
bool FirstHandler (const std::string &_topic, const std::string &_msgTypeName, std::shared_ptr< T > &_handler) const
 Get the first handler for a topic that matches a specific message type. More...
 
bool Handler (const std::string &_topic, const std::string &_nUuid, const std::string &_hUuid, std::shared_ptr< T > &_handler) const
 Get a specific handler. More...
 
bool Handlers (const std::string &_topic, std::map< std::string, std::map< std::string, std::shared_ptr< T > >> &_handlers) const
 Get the data handlers for a topic. More...
 
bool HasHandlersForNode (const std::string &_topic, const std::string &_nUuid) const
 Check if a node has at least one handler. More...
 
bool HasHandlersForTopic (const std::string &_topic) const
 Return true if we have stored at least one request for the topic. More...
 
bool RemoveHandler (const std::string &_topic, const std::string &_nUuid, const std::string &_reqUuid)
 Remove a request handler. More...
 
bool RemoveHandlersForNode (const std::string &_topic, const std::string &_nUuid)
 Remove all the handlers from a given node. More...
 

Detailed Description

template<typename T>
class ignition::transport::HandlerStorage< T >

ignition/transport/HandlerStorage.hh

Class to store and manage service call handlers.

Constructor & Destructor Documentation

template<typename T>
ignition::transport::HandlerStorage< T >::HandlerStorage ( )
default

Constructor.

template<typename T>
virtual ignition::transport::HandlerStorage< T >::~HandlerStorage ( )
virtualdefault

Destructor.

Member Function Documentation

template<typename T>
void ignition::transport::HandlerStorage< T >::AddHandler ( const std::string &  _topic,
const std::string &  _nUuid,
const std::shared_ptr< T > &  _handler 
)
inline

Add a request handler to a topic.

A request handler stores the callback and types associated to a service call request.

Parameters
[in]_topicTopic name.
[in]_nUuidNode's unique identifier.
[in]_handlerRequest handler.
template<typename T>
bool ignition::transport::HandlerStorage< T >::FirstHandler ( const std::string &  _topic,
const std::string &  _reqTypeName,
const std::string &  _repTypeName,
std::shared_ptr< T > &  _handler 
) const
inline

Get the first handler for a topic that matches a specific pair of request/response types.

Parameters
[in]_topicTopic name.
[in]_reqTypeNameType of the service request.
[in]_repTypeNameType of the service response.
[out]_handlerhandler.
Returns
true if a handler was found.
template<typename T>
bool ignition::transport::HandlerStorage< T >::FirstHandler ( const std::string &  _topic,
const std::string &  _msgTypeName,
std::shared_ptr< T > &  _handler 
) const
inline

Get the first handler for a topic that matches a specific message type.

Parameters
[in]_topicTopic name.
[in]_msgTypeNameType of the msg in string format.
[out]_handlerhandler.
Returns
true if a handler was found.
template<typename T>
bool ignition::transport::HandlerStorage< T >::Handler ( const std::string &  _topic,
const std::string &  _nUuid,
const std::string &  _hUuid,
std::shared_ptr< T > &  _handler 
) const
inline

Get a specific handler.

Parameters
[in]_topicTopic name.
[in]_nUuidNode UUID of the handler.
[in]_hUuidHandler UUID.
[out]_handlerHandler requested.
Returns
true if the handler was found.
template<typename T>
bool ignition::transport::HandlerStorage< T >::Handlers ( const std::string &  _topic,
std::map< std::string, std::map< std::string, std::shared_ptr< T > >> &  _handlers 
) const
inline

Get the data handlers for a topic.

A request handler stores the callback and types associated to a service call request.

Parameters
[in]_topicTopic name.
[out]_handlersRequest handlers. The key of _handlers is the topic name. The value is another map, where the key is the node UUID and the value is a smart pointer to the handler.
Returns
true if the topic contains at least one request.
template<typename T>
bool ignition::transport::HandlerStorage< T >::HasHandlersForNode ( const std::string &  _topic,
const std::string &  _nUuid 
) const
inline

Check if a node has at least one handler.

Parameters
[in]_topicTopic name.
[in]_nUuidNode's unique identifier.
Returns
true if the node has at least one handler registered.
template<typename T>
bool ignition::transport::HandlerStorage< T >::HasHandlersForTopic ( const std::string &  _topic) const
inline

Return true if we have stored at least one request for the topic.

Parameters
[in]_topicTopic name.
Returns
true if we have stored at least one request for the topic.
template<typename T>
bool ignition::transport::HandlerStorage< T >::RemoveHandler ( const std::string &  _topic,
const std::string &  _nUuid,
const std::string &  _reqUuid 
)
inline

Remove a request handler.

The node's uuid is used as a key to remove the appropriate request handler.

Parameters
[in]_topicTopic name.
[in]_nUuidNode's unique identifier.
[in]_reqUuidRequest's UUID to remove.
Returns
True when the handler is removed or false otherwise.
template<typename T>
bool ignition::transport::HandlerStorage< T >::RemoveHandlersForNode ( const std::string &  _topic,
const std::string &  _nUuid 
)
inline

Remove all the handlers from a given node.

Parameters
[in]_topicTopic name.
[in]_nUuidNode's unique identifier.
Returns
True when at least one handler was removed or false otherwise.

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