gz/transport/Discovery.hh
Go to the documentation of this file.
void Register(const MessagePublisher &_pub) const
Register a node from this process as a remote subscriber.
Definition: gz/transport/Discovery.hh:384
void UnregistrationsCb(const DiscoveryCallback< Pub > &_cb)
Register a callback to receive an event when a remote node unsubscribes to a topic within this proces...
Definition: gz/transport/Discovery.hh:551
void ConnectionsCb(const DiscoveryCallback< Pub > &_cb)
Register a callback to receive discovery connection events. Each time a new topic is connected,...
Definition: gz/transport/Discovery.hh:523
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.
Definition: gz/transport/TopicStorage.hh:207
T lock(T... args)
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.
Definition: gz/transport/TopicStorage.hh:222
@ HOST
Topic/service only available to subscribers in the same machine as the publisher.
Definition: gz/transport/AdvertiseOptions.hh:28
STL class.
This class stores all the information about a publisher. It stores the topic name that publishes,...
Definition: gz/transport/Publisher.hh:44
std::map< std::string, Timestamp > activity
Activity information. Every time there is a message from a remote node, its activity information is u...
Definition: gz/transport/Discovery.hh:1419
void SetActivityInterval(const unsigned int _ms)
Set the activity interval.
Definition: gz/transport/Discovery.hh:495
unsigned int ActivityInterval() const
The discovery checks the validity of the topic information every 'activity interval' milliseconds.
Definition: gz/transport/Discovery.hh:465
bool pollSockets(const std::vector< int > &_sockets, const int _timeout)
std::vector< std::string > split(const std::string &_orig, char _delim)
split at a one character delimiter to get a vector of something
STL class.
void WaitForInit() const
Check if ready/initialized. If not, then wait on the initializedCv condition variable.
Definition: gz/transport/Discovery.hh:610
void TopicList(std::vector< std::string > &_topics) const
Get the list of topics currently stored.
Definition: gz/transport/TopicStorage.hh:339
T strerror(T... args)
const TopicStorage< Pub > & Info() const
Get the discovery information.
Definition: gz/transport/Discovery.hh:400
This class stores all the information about a message publisher.
Definition: gz/transport/Publisher.hh:222
A class for customizing the publication options for a topic or service advertised....
Definition: gz/transport/AdvertiseOptions.hh:59
unsigned int SilenceInterval() const
Get the maximum time allowed without receiving any discovery information from a node before canceling...
Definition: gz/transport/Discovery.hh:486
T unlock(T... args)
std::string determineHost()
Determine IP or hostname. Reference: https://github.com/ros/ros_comm/blob/hydro-devel/clients/ roscpp...
virtual ~Discovery()
Destructor.
Definition: gz/transport/Discovery.hh:247
T push_back(T... args)
unsigned int HeartbeatInterval() const
Each node broadcasts periodic heartbeats to keep its topic information alive in other nodes....
Definition: gz/transport/Discovery.hh:476
void Unregister(const MessagePublisher &_pub) const
Unregister a node from this process as a remote subscriber.
Definition: gz/transport/Discovery.hh:392
T joinable(T... args)
void PrintCurrentState() const
Print the current discovery state.
Definition: gz/transport/Discovery.hh:558
std::chrono::steady_clock::time_point Timestamp
Definition: gz/transport/TransportTypes.hh:155
STL class.
T at(T... args)
bool DelPublishersByProc(const std::string &_pUuid)
Remove all the publishers associated to a given process.
Definition: gz/transport/TopicStorage.hh:262
bool AddPublisher(const T &_publisher)
Add a new address associated to a given topic and node UUID.
Definition: gz/transport/TopicStorage.hh:53
T c_str(T... args)
STL class.
bool Unadvertise(const std::string &_topic, const std::string &_nUuid)
Unadvertise a new message. Broadcast a discovery message that will cancel all the discovery informati...
Definition: gz/transport/Discovery.hh:424
T erase(T... args)
T wait(T... args)
STL class.
bool env(const std::string &_name, std::string &_value)
Find the environment variable '_name' and return its value.
A discovery class that implements a distributed topic discovery protocol. It uses UDP multicast for s...
Definition: gz/transport/Discovery.hh:117
T min(T... args)
DestinationType
Options for sending discovery messages.
Definition: gz/transport/Discovery.hh:88
void SetSilenceInterval(const unsigned int _ms)
Set the maximum silence interval.
Definition: gz/transport/Discovery.hh:513
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.
Definition: gz/transport/TopicStorage.hh:134
T endl(T... args)
void TopicList(std::vector< std::string > &_topics) const
Get the list of topics currently advertised in the network.
Definition: gz/transport/Discovery.hh:601
T duration_cast(T... args)
std::string HostAddr() const
Get the IP address of this host.
Definition: gz/transport/Discovery.hh:455
T boolalpha(T... args)
T cbegin(T... args)
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...
Definition: gz/transport/TopicStorage.hh:286
void DisconnectionsCb(const DiscoveryCallback< Pub > &_cb)
Register a callback to receive discovery disconnection events. Each time a topic is no longer active,...
Definition: gz/transport/Discovery.hh:533
void Print() const
Print all the information for debugging purposes.
Definition: gz/transport/TopicStorage.hh:346
T empty(T... args)
STL class.
Discovery(const std::string &_pUuid, const int _port, const bool _verbose=false)
Constructor.
Definition: gz/transport/Discovery.hh:124
T memcpy(T... args)
void SetHeartbeatInterval(const unsigned int _ms)
Set the heartbeat interval.
Definition: gz/transport/Discovery.hh:504
T max(T... args)
void Start()
Start the discovery service. You probably want to register the callbacks for receiving discovery noti...
Definition: gz/transport/Discovery.hh:278
bool Discover(const std::string &_topic) const
Request discovery information about a topic. When using this method, the user might want to use SetCo...
Definition: gz/transport/Discovery.hh:334
@ PROCESS
Topic/service only available to subscribers in the same process as the publisher.
T notify_all(T... args)
void RegistrationsCb(const DiscoveryCallback< Pub > &_cb)
Register a callback to receive an event when a new remote node subscribes to a topic within this proc...
Definition: gz/transport/Discovery.hh:542
bool Advertise(const Pub &_publisher)
Advertise a new message.
Definition: gz/transport/Discovery.hh:302
T join(T... args)
T memset(T... args)
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.
Definition: gz/transport/TopicStorage.hh:169
std::vector< std::string > determineInterfaces()
Determine the list of network interfaces for this machine. Reference: https://github....
bool Publishers(const std::string &_topic, Addresses_M< Pub > &_publishers) const
Get all the publishers' information known for a given topic.
Definition: gz/transport/Discovery.hh:410
T now(T... args)