15 #ifndef RCLCPP__NODE_INTERFACES__NODE_GRAPH_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_GRAPH_HPP_
20 #include <condition_variable>
31 #include "rclcpp/event.hpp"
32 #include "rclcpp/macros.hpp"
33 #include "rclcpp/node_interfaces/node_base_interface.hpp"
34 #include "rclcpp/node_interfaces/node_graph_interface.hpp"
35 #include "rclcpp/visibility_control.hpp"
36 #include "rmw/service_endpoint_info_array.h"
37 #include "rmw/topic_endpoint_info_array.h"
42 namespace graph_listener
47 namespace node_interfaces
64 std::map<std::string, std::vector<std::string>>
68 std::map<std::string, std::vector<std::string>>
72 std::map<std::string, std::vector<std::string>>
74 const std::string & node_name,
75 const std::string & namespace_)
const override;
78 std::map<std::string, std::vector<std::string>>
80 const std::string & node_name,
81 const std::string & namespace_)
const override;
84 std::map<std::string, std::vector<std::string>>
86 const std::string & node_name,
87 const std::string & namespace_,
88 bool no_demangle =
false)
const override;
91 std::map<std::string, std::vector<std::string>>
93 const std::string & node_name,
94 const std::string & namespace_,
95 bool no_demangle =
false)
const override;
98 std::vector<std::string>
102 std::vector<std::tuple<std::string, std::string, std::string>>
106 std::vector<std::pair<std::string, std::string>>
119 count_clients(
const std::string & service_name)
const override;
138 rclcpp::Event::SharedPtr
144 rclcpp::Event::SharedPtr event,
145 std::chrono::nanoseconds timeout)
override;
152 std::vector<rclcpp::TopicEndpointInfo>
154 const std::string & topic_name,
155 bool no_mangle =
false)
const override;
158 std::vector<rclcpp::TopicEndpointInfo>
160 const std::string & topic_name,
161 bool no_mangle =
false)
const override;
164 std::vector<rclcpp::ServiceEndpointInfo>
166 const std::string & service_name,
167 bool no_mangle =
false)
const override;
170 std::vector<rclcpp::ServiceEndpointInfo>
172 const std::string & service_name,
173 bool no_mangle =
false)
const override;
182 std::atomic_bool should_add_to_graph_listener_;
185 mutable std::mutex graph_mutex_;
187 std::condition_variable graph_cv_;
189 std::vector<rclcpp::Event::WeakPtr> graph_events_;
192 std::atomic_size_t graph_users_count_;
Pure virtual interface class for the NodeBase part of the Node API.
Pure virtual interface class for the NodeGraph part of the Node API.
Implementation the NodeGraph part of the Node API.
RCLCPP_PUBLIC std::vector< std::string > get_node_names() const override
Return a vector of existing node names (string).
RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_service_names_and_types() const override
Return a map of existing service names to list of service types.
RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_publisher_names_and_types_by_node(const std::string &node_name, const std::string &namespace_, bool no_demangle=false) const override
Return a map of existing topic names to list of topic types for a specific node.
RCLCPP_PUBLIC std::vector< rclcpp::TopicEndpointInfo > get_publishers_info_by_topic(const std::string &topic_name, bool no_mangle=false) const override
Return the topic endpoint information about publishers on a given topic.
RCLCPP_PUBLIC std::vector< std::pair< std::string, std::string > > get_node_names_and_namespaces() const override
Return a vector of existing node names and namespaces (pair of string).
RCLCPP_PUBLIC size_t count_services(const std::string &service_name) const override
Return the number of services created for a given service.
RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_subscriber_names_and_types_by_node(const std::string &node_name, const std::string &namespace_, bool no_demangle=false) const override
Return a map of existing topic names to list of topic types for a specific node.
RCLCPP_PUBLIC size_t count_subscribers(const std::string &topic_name) const override
Return the number of subscribers who have created a subscription for a given topic.
RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_client_names_and_types_by_node(const std::string &node_name, const std::string &namespace_) const override
Return a map of existing service names and types with a specific node.
RCLCPP_PUBLIC std::vector< rclcpp::TopicEndpointInfo > get_subscriptions_info_by_topic(const std::string &topic_name, bool no_mangle=false) const override
Return the topic endpoint information about subscriptions on a given topic.
RCLCPP_PUBLIC size_t count_graph_users() const override
Return the number of on loan graph events, see get_graph_event().
RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_topic_names_and_types(bool no_demangle=false) const override
Return a map of existing topic names to list of topic types.
RCLCPP_PUBLIC void wait_for_graph_change(rclcpp::Event::SharedPtr event, std::chrono::nanoseconds timeout) override
Wait for a graph event to occur by waiting on an Event to become set.
RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_service_names_and_types_by_node(const std::string &node_name, const std::string &namespace_) const override
Return a map of existing service names to list of service types for a specific node.
RCLCPP_PUBLIC rclcpp::Event::SharedPtr get_graph_event() override
Return a graph event, which will be set anytime a graph change occurs.
RCLCPP_PUBLIC std::vector< rclcpp::ServiceEndpointInfo > get_clients_info_by_service(const std::string &service_name, bool no_mangle=false) const override
Return the service endpoint information about clients on a given service.
RCLCPP_PUBLIC void notify_shutdown() override
Notify any and all blocking node actions that shutdown has occurred.
RCLCPP_PUBLIC std::vector< std::tuple< std::string, std::string, std::string > > get_node_names_with_enclaves() const override
Return a vector of existing node names, namespaces and enclaves (tuple of string).
RCLCPP_PUBLIC size_t count_publishers(const std::string &topic_name) const override
Return the number of publishers that are advertised on a given topic.
RCLCPP_PUBLIC size_t count_clients(const std::string &service_name) const override
Return the number of clients created for a given service.
RCLCPP_PUBLIC std::vector< rclcpp::ServiceEndpointInfo > get_servers_info_by_service(const std::string &service_name, bool no_mangle=false) const override
Return the service endpoint information about servers on a given service.
RCLCPP_PUBLIC void notify_graph_change() override
Notify threads waiting on graph changes.
RCLCPP_PUBLIC const rcl_guard_condition_t * get_graph_guard_condition() const override
Return the rcl guard condition which is triggered when the ROS graph changes.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Handle for a rcl guard condition.