rmw_dds_common
master
Define a common interface between DDS implementations of ROS middleware.
|
15 #ifndef RMW_DDS_COMMON__GRAPH_CACHE_HPP_
16 #define RMW_DDS_COMMON__GRAPH_CACHE_HPP_
22 #include <unordered_map>
33 #include "rmw_dds_common/gid_utils.hpp"
34 #include "rmw_dds_common/visibility_control.h"
35 #include "rmw_dds_common/msg/gid.hpp"
36 #include "rmw_dds_common/msg/node_entities_info.hpp"
37 #include "rmw_dds_common/msg/participant_entities_info.hpp"
39 namespace rmw_dds_common
44 struct ParticipantInfo;
62 template<
typename CallbackT>
67 on_change_callback_ = callback;
108 RMW_DDS_COMMON_PUBLIC
127 RMW_DDS_COMMON_PUBLIC
142 RMW_DDS_COMMON_PUBLIC
151 RMW_DDS_COMMON_PUBLIC
161 RMW_DDS_COMMON_PUBLIC
177 RMW_DDS_COMMON_PUBLIC
188 RMW_DDS_COMMON_PUBLIC
204 RMW_DDS_COMMON_PUBLIC
222 RMW_DDS_COMMON_PUBLIC
223 rmw_dds_common::msg::ParticipantEntitiesInfo
236 RMW_DDS_COMMON_PUBLIC
237 rmw_dds_common::msg::ParticipantEntitiesInfo
251 RMW_DDS_COMMON_PUBLIC
252 rmw_dds_common::msg::ParticipantEntitiesInfo
267 RMW_DDS_COMMON_PUBLIC
268 rmw_dds_common::msg::ParticipantEntitiesInfo
283 RMW_DDS_COMMON_PUBLIC
284 rmw_dds_common::msg::ParticipantEntitiesInfo
299 RMW_DDS_COMMON_PUBLIC
300 rmw_dds_common::msg::ParticipantEntitiesInfo
323 RMW_DDS_COMMON_PUBLIC
327 size_t * count)
const;
338 RMW_DDS_COMMON_PUBLIC
342 size_t * count)
const;
358 RMW_DDS_COMMON_PUBLIC
377 RMW_DDS_COMMON_PUBLIC
401 RMW_DDS_COMMON_PUBLIC
427 RMW_DDS_COMMON_PUBLIC
455 RMW_DDS_COMMON_PUBLIC
470 RMW_DDS_COMMON_PUBLIC
490 RMW_DDS_COMMON_PUBLIC
502 using NodeEntitiesInfoSeq =
505 decltype(std::declval<rmw_dds_common::msg::ParticipantEntitiesInfo>().node_entities_info_seq);
515 decltype(std::declval<rmw_dds_common::msg::NodeEntitiesInfo>().writer_gid_seq);
526 RMW_DDS_COMMON_PUBLIC
566 #endif // RMW_DDS_COMMON__GRAPH_CACHE_HPP_
rmw_ret_t get_readers_info_by_topic(const std::string &topic_name, DemangleFunctionT demangle_type, rcutils_allocator_t *allocator, rmw_topic_endpoint_info_array_t *endpoints_info) const
Get an array with information about the readers in a topic.
rmw_ret_t get_writer_count(const std::string &topic_name, size_t *count) const
Get the number of publishers of a topic.
Graph cache data structure.
Definition: graph_cache.hpp:50
rmw_dds_common::msg::ParticipantEntitiesInfo associate_writer(const rmw_gid_t &writer_gid, const rmw_gid_t &participant_gid, const std::string &node_name, const std::string &node_namespace)
Remove a node to the graph, and get the message to be sent.
void add_participant(const rmw_gid_t &participant_gid, const std::string &enclave)
Add a discovered participant to the cache.
rmw_dds_common::msg::ParticipantEntitiesInfo dissociate_reader(const rmw_gid_t &reader_gid, const rmw_gid_t &participant_gid, const std::string &node_name, const std::string &node_namespace)
Dissociate a reader from a node, and get an update message to be sent.
EntityInfo(const std::string &topic_name, const std::string &topic_type, const rmw_gid_t &participant_gid, const rmw_qos_profile_t &qos)
Simple constructor.
Definition: graph_cache.hpp:552
rmw_ret_t get_writer_names_and_types_by_node(const std::string &node_name, const std::string &namespace_, DemangleFunctionT demangle_topic, DemangleFunctionT demangle_type, rcutils_allocator_t *allocator, rmw_names_and_types_t *topic_names_and_types) const
Get the topic names and types that a node is publishing.
rmw_qos_profile_t qos
Quality of service of the topic.
Definition: graph_cache.hpp:549
bool remove_writer(const rmw_gid_t &gid)
Remove a data writer based on discovery.
bool remove_entity(const rmw_gid_t &gid, bool is_reader)
Remove a data reader or writer based based on discovery.
rmw_ret_t get_reader_count(const std::string &topic_name, size_t *count) const
Get the number of subscriptions of a topic.
bool add_entity(const rmw_gid_t &gid, const std::string &topic_name, const std::string &type_name, const rmw_gid_t &participant_gid, const rmw_qos_profile_t &qos, bool is_reader)
Add a data reader based on discovery.
std::string topic_type
Topic type.
Definition: graph_cache.hpp:545
GraphCache::NodeEntitiesInfoSeq node_entities_info_seq
Discovery information of each Node created from a Participant.
Definition: graph_cache.hpp:534
bool add_reader(const rmw_gid_t &reader_gid, const std::string &topic_name, const std::string &type_name, const rmw_gid_t &participant_gid, const rmw_qos_profile_t &qos)
Add a data reader based on discovery.
rmw_ret_t get_node_names(rcutils_string_array_t *node_names, rcutils_string_array_t *node_namespaces, rcutils_string_array_t *enclaves, rcutils_allocator_t *allocator) const
Copy the names and namespaces of the discovered nodes.
rmw_dds_common::msg::ParticipantEntitiesInfo dissociate_writer(const rmw_gid_t &writer_gid, const rmw_gid_t &participant_gid, const std::string &node_name, const std::string &node_namespace)
Dissociate a writer from a node, and get an update message to be sent.
rmw_dds_common::msg::ParticipantEntitiesInfo add_node(const rmw_gid_t &participant_gid, const std::string &node_name, const std::string &node_namespace)
Add a node to the graph, and get the message to be sent.
std::string topic_name
Topic name.
Definition: graph_cache.hpp:543
std::string enclave
Name of the enclave.
Definition: graph_cache.hpp:536
size_t get_number_of_nodes() const
Get the number of nodes that have been discovered.
void update_participant_entities(const rmw_dds_common::msg::ParticipantEntitiesInfo &msg)
Update participant info based on a received ParticipantEntitiesInfo message.
Structure to represent the discovery data of an endpoint (reader or writer).
Definition: graph_cache.hpp:540
void set_on_change_callback(CallbackT &&callback)
Set a callback that will be called when the state of the object changes.
Definition: graph_cache.hpp:64
Structure to represent the discovery data of a Participant.
Definition: graph_cache.hpp:531
std::ostream & operator<<(std::ostream &os, const path &p)
rmw_ret_t get_names_and_types(DemangleFunctionT demangle_topic, DemangleFunctionT demangle_type, rcutils_allocator_t *allocator, rmw_names_and_types_t *topic_names_and_types) const
Get all the topic names and types.
rmw_dds_common::msg::ParticipantEntitiesInfo associate_reader(const rmw_gid_t &reader_gid, const rmw_gid_t &participant_gid, const std::string &node_name, const std::string &node_namespace)
Associate a reader with a node, and get an update message to be sent.
rmw_dds_common::msg::ParticipantEntitiesInfo remove_node(const rmw_gid_t &participant_gid, const std::string &node_name, const std::string &node_namespace)
Remove a node to the graph, and get the message to be sent.
bool remove_reader(const rmw_gid_t &gid)
Remove a data reader based on discovery.
rmw_gid_t participant_gid
Participant gid.
Definition: graph_cache.hpp:547
rmw_ret_t get_writers_info_by_topic(const std::string &topic_name, DemangleFunctionT demangle_type, rcutils_allocator_t *allocator, rmw_topic_endpoint_info_array_t *endpoints_info) const
Get an array with information about the writers in a topic.
rmw_ret_t get_reader_names_and_types_by_node(const std::string &node_name, const std::string &namespace_, DemangleFunctionT demangle_topic, DemangleFunctionT demangle_type, rcutils_allocator_t *allocator, rmw_names_and_types_t *topic_names_and_types) const
Get the topic names and types that a node is subscribing.
void clear_on_change_callback()
Clear previously registered "on change" callback.
bool remove_participant(const rmw_gid_t &participant_gid)
Remove a participant based on discovery.
bool add_writer(const rmw_gid_t &writer_gid, const std::string &topic_name, const std::string &type_name, const rmw_gid_t &participant_gid, const rmw_qos_profile_t &qos)
Add a data writer based on discovery.