rmw_dds_common  master
Define a common interface between DDS implementations of ROS middleware.
Public Types | Public Member Functions | Friends | List of all members
rmw_dds_common::GraphCache Class Reference

Graph cache data structure. More...

#include <graph_cache.hpp>

Public Types

using DemangleFunctionT = std::function< std::string(const std::string &)>
 
using NodeEntitiesInfoSeq = decltype(std::declval< rmw_dds_common::msg::ParticipantEntitiesInfo >().node_entities_info_seq)
 
using EntityGidToInfo = std::map< rmw_gid_t, EntityInfo, Compare_rmw_gid_t >
 
using ParticipantToNodesMap = std::map< rmw_gid_t, ParticipantInfo, Compare_rmw_gid_t >
 
using GidSeq = decltype(std::declval< rmw_dds_common::msg::NodeEntitiesInfo >().writer_gid_seq)
 

Public Member Functions

template<typename CallbackT >
void set_on_change_callback (CallbackT &&callback)
 Set a callback that will be called when the state of the object changes. More...
 
void clear_on_change_callback ()
 Clear previously registered "on change" callback. More...
 
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. More...
 
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. More...
 
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. More...
 
bool remove_writer (const rmw_gid_t &gid)
 Remove a data writer based on discovery. More...
 
bool remove_reader (const rmw_gid_t &gid)
 Remove a data reader based on discovery. More...
 
bool remove_entity (const rmw_gid_t &gid, bool is_reader)
 Remove a data reader or writer based based on discovery. More...
 
void add_participant (const rmw_gid_t &participant_gid, const std::string &enclave)
 Add a discovered participant to the cache. More...
 
bool remove_participant (const rmw_gid_t &participant_gid)
 Remove a participant based on discovery. More...
 
void update_participant_entities (const rmw_dds_common::msg::ParticipantEntitiesInfo &msg)
 Update participant info based on a received ParticipantEntitiesInfo message. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
rmw_ret_t get_writer_count (const std::string &topic_name, size_t *count) const
 Get the number of publishers of a topic. More...
 
rmw_ret_t get_reader_count (const std::string &topic_name, size_t *count) const
 Get the number of subscriptions of a topic. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
size_t get_number_of_nodes () const
 Get the number of nodes that have been discovered. More...
 
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. More...
 

Friends

std::ostreamoperator<< (std::ostream &ostream, const GraphCache &topic_cache)
 

Detailed Description

Graph cache data structure.

Manages relationships between participants, nodes and topics.

Member Typedef Documentation

◆ NodeEntitiesInfoSeq

using rmw_dds_common::GraphCache::NodeEntitiesInfoSeq = decltype(std::declval<rmw_dds_common::msg::ParticipantEntitiesInfo>().node_entities_info_seq)

◆ EntityGidToInfo

◆ ParticipantToNodesMap

◆ GidSeq

using rmw_dds_common::GraphCache::GidSeq = decltype(std::declval<rmw_dds_common::msg::NodeEntitiesInfo>().writer_gid_seq)

Member Function Documentation

◆ set_on_change_callback()

template<typename CallbackT >
void rmw_dds_common::GraphCache::set_on_change_callback ( CallbackT &&  callback)
inline

Set a callback that will be called when the state of the object changes.

Parameters
callbackcallback to be called.

◆ clear_on_change_callback()

void rmw_dds_common::GraphCache::clear_on_change_callback ( )

Clear previously registered "on change" callback.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream ostream,
const GraphCache topic_cache 
)
friend

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