Store address information about topics and provide convenient methods for adding new topics, removing them, etc. More...
#include <gz/transport/TopicStorage.hh>
Public Member Functions | |
TopicStorage ()=default | |
Constructor. | |
virtual | ~TopicStorage ()=default |
Destructor. | |
bool | AddPublisher (const T &_publisher) |
Add a new address associated to a given topic and node UUID. | |
void | Clear () |
Clear the content. | |
bool | DelPublisherByNode (const std::string &_topic, const std::string &_pUuid, const std::string &_nUuid) |
Remove a publisher associated to a given topic and UUID pair. | |
bool | DelPublishersByProc (const std::string &_pUuid) |
Remove all the publishers associated to a given process. | |
bool | HasAnyPublishers (const std::string &_topic, const std::string &_pUuid) const |
Return if there is any publisher stored for the given topic and process UUID. | |
bool | HasPublisher (const std::string &_addr) const |
Return if the requested publisher's address is stored. | |
bool | HasTopic (const std::string &_topic) const |
Return if there is any publisher stored for the given topic. | |
bool | HasTopic (const std::string &_topic, const std::string &_type) const |
Return if there is any publisher stored for the given topic and type. | |
void | Print () const |
Print all the information for debugging purposes. | |
bool | Publisher (const std::string &_topic, const std::string &_pUuid, const std::string &_nUuid, T &_publisher) const |
Get the address information for a given topic and node UUID. | |
bool | Publishers (const std::string &_topic, std::map< std::string, std::vector< T > > &_info) const |
Get the map of publishers stored for a given topic. | |
void | PublishersByNode (const std::string &_pUuid, const std::string &_nUuid, std::vector< T > &_pubs) const |
Given a process UUID and the node UUID, the function returns the list of publishers contained in the node. | |
void | PublishersByProc (const std::string &_pUuid, std::map< std::string, std::vector< T > > &_pubs) const |
Given a process UUID, the function returns the list of publishers contained in this process UUID with its address information. | |
void | TopicList (std::vector< std::string > &_topics) const |
Get the list of topics currently stored. | |
Detailed Description
class gz::transport::TopicStorage< T >
Store address information about topics and provide convenient methods for adding new topics, removing them, etc.
Constructor & Destructor Documentation
◆ TopicStorage()
|
default |
Constructor.
◆ ~TopicStorage()
|
virtualdefault |
Destructor.
Member Function Documentation
◆ AddPublisher()
|
inline |
Add a new address associated to a given topic and node UUID.
- Parameters
-
[in] _publisher New publisher.
- Returns
- true if the new entry is added or false if not (because it was already stored).
References map< K, T >::find(), and std::find_if().
Referenced by Discovery< Pub >::Advertise().
◆ Clear()
|
inline |
◆ DelPublisherByNode()
|
inline |
Remove a publisher associated to a given topic and UUID pair.
- Parameters
-
[in] _topic Topic name [in] _pUuid Process UUID of the publisher. [in] _nUuid Node UUID of the publisher.
- Returns
- True when the publisher was removed or false otherwise.
References map< K, T >::erase(), map< K, T >::find(), std::remove_if(), and map< K, T >::size().
Referenced by Discovery< Pub >::Unadvertise().
◆ DelPublishersByProc()
|
inline |
Remove all the publishers associated to a given process.
- Parameters
-
[in] _pUuid Process' UUID of the publisher.
- Returns
- True when at least one address was removed or false otherwise.
References map< K, T >::begin(), map< K, T >::end(), and map< K, T >::erase().
◆ HasAnyPublishers()
|
inline |
Return if there is any publisher stored for the given topic and process UUID.
- Parameters
-
[in] _topic Topic name. [in] _pUuid Process UUID of the publisher.
- Returns
- True if there is at least one address stored for the topic and process UUID.
References map< K, T >::at(), and TopicStorage< T >::HasTopic().
◆ HasPublisher()
|
inline |
Return if the requested publisher's address is stored.
- Parameters
-
[in] _addr Publisher's address requested
- Returns
- true if the publisher's address is stored.
◆ HasTopic() [1/2]
|
inline |
Return if there is any publisher stored for the given topic.
- Parameters
-
[in] _topic Topic name.
- Returns
- True if there is at least one entry stored for the topic.
References map< K, T >::end(), and map< K, T >::find().
Referenced by TopicStorage< T >::HasAnyPublishers(), TopicStorage< T >::HasTopic(), and TopicStorage< T >::Publishers().
◆ HasTopic() [2/2]
|
inline |
Return if there is any publisher stored for the given topic and type.
- Parameters
-
[in] _topic Topic name. [in] _type Topic type.
- Returns
- True if there is at least one entry stored for the topic and type.
References map< K, T >::at(), std::find_if(), and TopicStorage< T >::HasTopic().
◆ Print()
|
inline |
Print all the information for debugging purposes.
References std::endl().
Referenced by Discovery< Pub >::PrintCurrentState().
◆ Publisher()
|
inline |
Get the address information for a given topic and node UUID.
- Parameters
-
[in] _topic Topic name. [in] _pUuid Process UUID of the publisher. [in] _nUuid Node UUID of the publisher. [out] _publisher Publisher's information requested.
- Returns
- true if a publisher is found for the given topic and UUID pair
References map< K, T >::at(), map< K, T >::find(), and std::find_if().
Referenced by Discovery< Pub >::Unadvertise().
◆ Publishers()
|
inline |
Get the map of publishers stored for a given topic.
- Parameters
-
[in] _topic Topic name. [out] _info Map of publishers requested.
- Returns
- true if at least there is one publisher stored.
References map< K, T >::at(), and TopicStorage< T >::HasTopic().
Referenced by Discovery< Pub >::Discover(), Discovery< Pub >::Publishers(), and Discovery< Pub >::RemoteSubscribers().
◆ PublishersByNode()
|
inline |
Given a process UUID and the node UUID, the function returns the list of publishers contained in the node.
- Parameters
-
[in] _pUuid Process UUID. [in] _nUuid Node UUID. [out] _pubs Vector of publishers.
References vector< T >::clear(), and vector< T >::push_back().
◆ PublishersByProc()
|
inline |
Given a process UUID, the function returns the list of publishers contained in this process UUID with its address information.
- Parameters
-
[in] _pUuid Process UUID. [out] _pubs Map of publishers where the keys are the node UUIDs and the value is its address information.
◆ TopicList()
|
inline |
Get the list of topics currently stored.
- Parameters
-
[out] _topics List of stored topics.
References vector< T >::push_back().
Referenced by Discovery< Pub >::TopicList().
The documentation for this class was generated from the following file: