15 #ifndef RCLCPP__NODE_INTERFACES__NODE_GRAPH_INTERFACE_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_GRAPH_INTERFACE_HPP_
30 #include "rclcpp/event.hpp"
31 #include "rclcpp/macros.hpp"
32 #include "rclcpp/node_interfaces/detail/node_interfaces_helpers.hpp"
33 #include "rclcpp/qos.hpp"
34 #include "rclcpp/visibility_control.hpp"
39 enum class EndpointType
41 Invalid = RMW_ENDPOINT_INVALID,
42 Publisher = RMW_ENDPOINT_PUBLISHER,
43 Subscription = RMW_ENDPOINT_SUBSCRIPTION
60 qos_profile_({info.qos_profile.history, info.qos_profile.depth}, info.qos_profile),
61 topic_type_hash_(info.topic_type_hash)
63 std::copy(info.endpoint_gid, info.endpoint_gid + RMW_GID_STORAGE_SIZE, endpoint_gid_.begin());
98 rclcpp::EndpointType &
103 const rclcpp::EndpointType &
108 std::array<uint8_t, RMW_GID_STORAGE_SIZE> &
113 const std::array<uint8_t, RMW_GID_STORAGE_SIZE> &
133 const rosidl_type_hash_t &
137 std::string node_name_;
138 std::string node_namespace_;
139 std::string topic_type_;
140 rclcpp::EndpointType endpoint_type_;
141 std::array<uint8_t, RMW_GID_STORAGE_SIZE> endpoint_gid_;
143 rosidl_type_hash_t topic_type_hash_;
146 namespace node_interfaces
171 std::map<std::string, std::vector<std::string>>
185 std::map<std::string, std::vector<std::string>>
200 std::map<std::string, std::vector<std::string>>
202 const std::string & node_name,
203 const std::string & namespace_)
const = 0;
217 std::map<std::string, std::vector<std::string>>
219 const std::string & node_name,
220 const std::string & namespace_)
const = 0;
235 std::map<std::string, std::vector<std::string>>
237 const std::string & node_name,
238 const std::string & namespace_,
239 bool no_demangle =
false)
const = 0;
254 std::map<std::string, std::vector<std::string>>
256 const std::string & node_name,
257 const std::string & namespace_,
258 bool no_demangle =
false)
const = 0;
266 std::vector<std::string>
278 std::vector<std::tuple<std::string, std::string, std::string>>
287 std::vector<std::pair<std::string, std::string>>
361 rclcpp::Event::SharedPtr
376 rclcpp::Event::SharedPtr event,
377 std::chrono::nanoseconds timeout) = 0;
397 std::vector<rclcpp::TopicEndpointInfo>
409 std::vector<rclcpp::TopicEndpointInfo>
Encapsulation of Quality of Service settings.
RCLCPP_PUBLIC TopicEndpointInfo(const rcl_topic_endpoint_info_t &info)
Construct a TopicEndpointInfo from a rcl_topic_endpoint_info_t.
RCLCPP_PUBLIC std::string & node_name()
Get a mutable reference to the node name.
RCLCPP_PUBLIC std::string & node_namespace()
Get a mutable reference to the node namespace.
RCLCPP_PUBLIC rosidl_type_hash_t & topic_type_hash()
Get a mutable reference to the type hash of the topic endpoint.
RCLCPP_PUBLIC std::string & topic_type()
Get a mutable reference to the topic type string.
RCLCPP_PUBLIC rclcpp::QoS & qos_profile()
Get a mutable reference to the QoS profile of the topic endpoint.
RCLCPP_PUBLIC rclcpp::EndpointType & endpoint_type()
Get a mutable reference to the topic endpoint type.
RCLCPP_PUBLIC std::array< uint8_t, RMW_GID_STORAGE_SIZE > & endpoint_gid()
Get a mutable reference to the GID of the topic endpoint.
Pure virtual interface class for the NodeGraph part of the Node API.
virtual RCLCPP_PUBLIC rclcpp::Event::SharedPtr get_graph_event()=0
Return a graph event, which will be set anytime a graph change occurs.
virtual 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 =0
Return a map of existing service names and types with a specific node.
virtual RCLCPP_PUBLIC size_t count_clients(const std::string &service_name) const =0
Return the number of clients created for a given service.
virtual 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 =0
Return a map of existing topic names to list of topic types for a specific node.
virtual RCLCPP_PUBLIC std::vector< std::pair< std::string, std::string > > get_node_names_and_namespaces() const =0
Return a vector of existing node names and namespaces (pair of string).
virtual RCLCPP_PUBLIC std::vector< rclcpp::TopicEndpointInfo > get_subscriptions_info_by_topic(const std::string &topic_name, bool no_mangle=false) const =0
Return the topic endpoint information about subscriptions on a given topic.
virtual 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 =0
Return a map of existing topic names to list of topic types for a specific node.
virtual RCLCPP_PUBLIC void notify_shutdown()=0
Notify any and all blocking node actions that shutdown has occurred.
virtual RCLCPP_PUBLIC std::vector< std::tuple< std::string, std::string, std::string > > get_node_names_with_enclaves() const =0
Return a vector of existing node names, namespaces and enclaves (tuple of string).
virtual RCLCPP_PUBLIC size_t count_subscribers(const std::string &topic_name) const =0
Return the number of subscribers who have created a subscription for a given topic.
virtual RCLCPP_PUBLIC size_t count_services(const std::string &service_name) const =0
Return the number of services created for a given service.
virtual 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 =0
Return a map of existing service names to list of service types for a specific node.
virtual RCLCPP_PUBLIC std::vector< rclcpp::TopicEndpointInfo > get_publishers_info_by_topic(const std::string &topic_name, bool no_mangle=false) const =0
Return the topic endpoint information about publishers on a given topic.
virtual RCLCPP_PUBLIC void notify_graph_change()=0
Notify threads waiting on graph changes.
virtual RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_service_names_and_types() const =0
Return a map of existing service names to list of service types.
virtual RCLCPP_PUBLIC std::vector< std::string > get_node_names() const =0
Return a vector of existing node names (string).
virtual RCLCPP_PUBLIC size_t count_graph_users() const =0
Return the number of on loan graph events, see get_graph_event().
virtual RCLCPP_PUBLIC void wait_for_graph_change(rclcpp::Event::SharedPtr event, std::chrono::nanoseconds timeout)=0
Wait for a graph event to occur by waiting on an Event to become set.
virtual RCLCPP_PUBLIC std::map< std::string, std::vector< std::string > > get_topic_names_and_types(bool no_demangle=false) const =0
Return a map of existing topic names to list of topic types.
virtual RCLCPP_PUBLIC const rcl_guard_condition_t * get_graph_guard_condition() const =0
Return the rcl guard condition which is triggered when the ROS graph changes.
virtual RCLCPP_PUBLIC size_t count_publishers(const std::string &topic_name) const =0
Return the number of publishers that are advertised on a given topic.
rmw_topic_endpoint_info_t rcl_topic_endpoint_info_t
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Handle for a rcl guard condition.