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/topic_endpoint_info_array.h"
41 namespace graph_listener
46 namespace node_interfaces
63 std::map<std::string, std::vector<std::string>>
67 std::map<std::string, std::vector<std::string>>
71 std::map<std::string, std::vector<std::string>>
73 const std::string & node_name,
74 const std::string & namespace_)
const override;
77 std::map<std::string, std::vector<std::string>>
79 const std::string & node_name,
80 const std::string & namespace_)
const override;
83 std::map<std::string, std::vector<std::string>>
85 const std::string & node_name,
86 const std::string & namespace_,
87 bool no_demangle =
false)
const override;
90 std::map<std::string, std::vector<std::string>>
92 const std::string & node_name,
93 const std::string & namespace_,
94 bool no_demangle =
false)
const override;
97 std::vector<std::string>
101 std::vector<std::tuple<std::string, std::string, std::string>>
105 std::vector<std::pair<std::string, std::string>>
118 count_clients(
const std::string & service_name)
const override;
137 rclcpp::Event::SharedPtr
143 rclcpp::Event::SharedPtr event,
144 std::chrono::nanoseconds timeout)
override;
151 std::vector<rclcpp::TopicEndpointInfo>
153 const std::string & topic_name,
154 bool no_mangle =
false)
const override;
157 std::vector<rclcpp::TopicEndpointInfo>
159 const std::string & topic_name,
160 bool no_mangle =
false)
const override;
169 std::shared_ptr<rclcpp::graph_listener::GraphListener> graph_listener_;
171 std::atomic_bool should_add_to_graph_listener_;
174 mutable std::mutex graph_mutex_;
176 std::condition_variable graph_cv_;
178 std::vector<rclcpp::Event::WeakPtr> graph_events_;
181 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 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 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.