15 #ifndef RCLCPP__NODE_INTERFACES__NODE_GRAPH_INTERFACE_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_GRAPH_INTERFACE_HPP_
32 #include "rclcpp/event.hpp"
33 #include "rclcpp/macros.hpp"
34 #include "rclcpp/node_interfaces/detail/node_interfaces_helpers.hpp"
35 #include "rclcpp/qos.hpp"
36 #include "rclcpp/visibility_control.hpp"
41 enum class EndpointType
43 Invalid = RMW_ENDPOINT_INVALID,
44 Publisher = RMW_ENDPOINT_PUBLISHER,
45 Subscription = RMW_ENDPOINT_SUBSCRIPTION,
46 Client = RMW_ENDPOINT_CLIENT,
47 Server = RMW_ENDPOINT_SERVER
61 qos_profile_({info.qos_profile.history, info.qos_profile.depth}, info.qos_profile),
62 topic_type_hash_(info.topic_type_hash)
64 if (!info.node_name || !info.node_namespace || !info.topic_type) {
65 throw std::invalid_argument(
"Constructor TopicEndpointInfo with invalid topic endpoint info");
67 node_name_ = info.node_name;
68 node_namespace_ = info.node_namespace;
69 topic_type_ = info.topic_type;
71 std::copy(info.endpoint_gid, info.endpoint_gid + RMW_GID_STORAGE_SIZE, endpoint_gid_.begin());
106 rclcpp::EndpointType &
111 const rclcpp::EndpointType &
116 std::array<uint8_t, RMW_GID_STORAGE_SIZE> &
121 const std::array<uint8_t, RMW_GID_STORAGE_SIZE> &
141 const rosidl_type_hash_t &
145 std::string node_name_;
146 std::string node_namespace_;
147 std::string topic_type_;
148 rclcpp::EndpointType endpoint_type_;
149 std::array<uint8_t, RMW_GID_STORAGE_SIZE> endpoint_gid_;
151 rosidl_type_hash_t topic_type_hash_;
171 for(
size_t i = 0; i < endpoint_count_; i++) {
172 std::array<uint8_t, RMW_GID_STORAGE_SIZE> gid;
173 std::copy(info.endpoint_gids[i], info.endpoint_gids[i] + RMW_GID_STORAGE_SIZE, gid.begin());
174 endpoint_gids_.push_back(gid);
177 {info.qos_profiles[i].history, info.qos_profiles[i].depth}, info.qos_profiles[i]);
178 qos_profiles_.push_back(qos);
214 rclcpp::EndpointType &
219 const rclcpp::EndpointType &
234 std::vector<std::array<uint8_t, RMW_GID_STORAGE_SIZE>> &
239 const std::vector<std::array<uint8_t, RMW_GID_STORAGE_SIZE>> &
244 std::vector<rclcpp::QoS> &
249 const std::vector<rclcpp::QoS> &
259 const rosidl_type_hash_t &
263 std::string node_name_;
264 std::string node_namespace_;
265 std::string service_type_;
266 rclcpp::EndpointType endpoint_type_;
267 std::vector<std::array<uint8_t, RMW_GID_STORAGE_SIZE>> endpoint_gids_;
268 std::vector<rclcpp::QoS> qos_profiles_;
269 rosidl_type_hash_t service_type_hash_;
270 size_t endpoint_count_;
273 namespace node_interfaces
298 std::map<std::string, std::vector<std::string>>
312 std::map<std::string, std::vector<std::string>>
327 std::map<std::string, std::vector<std::string>>
329 const std::string & node_name,
330 const std::string & namespace_)
const = 0;
344 std::map<std::string, std::vector<std::string>>
346 const std::string & node_name,
347 const std::string & namespace_)
const = 0;
362 std::map<std::string, std::vector<std::string>>
364 const std::string & node_name,
365 const std::string & namespace_,
366 bool no_demangle =
false)
const = 0;
381 std::map<std::string, std::vector<std::string>>
383 const std::string & node_name,
384 const std::string & namespace_,
385 bool no_demangle =
false)
const = 0;
393 std::vector<std::string>
405 std::vector<std::tuple<std::string, std::string, std::string>>
414 std::vector<std::pair<std::string, std::string>>
488 rclcpp::Event::SharedPtr
503 rclcpp::Event::SharedPtr event,
504 std::chrono::nanoseconds timeout) = 0;
524 std::vector<rclcpp::TopicEndpointInfo>
536 std::vector<rclcpp::TopicEndpointInfo>
548 std::vector<rclcpp::ServiceEndpointInfo>
560 std::vector<rclcpp::ServiceEndpointInfo>
Encapsulation of Quality of Service settings.
RCLCPP_PUBLIC rclcpp::EndpointType & endpoint_type()
Get a mutable reference to the service endpoint type.
RCLCPP_PUBLIC std::string & node_name()
Get a mutable reference to the node name.
RCLCPP_PUBLIC size_t & endpoint_count()
Get a mutable reference to the endpoint count.
RCLCPP_PUBLIC rosidl_type_hash_t & service_type_hash()
Get a mutable reference to the type hash of the service endpoint.
RCLCPP_PUBLIC ServiceEndpointInfo(const rcl_service_endpoint_info_t &info)
Construct a ServiceEndpointInfo from a rcl_service_endpoint_info_t.
RCLCPP_PUBLIC std::vector< rclcpp::QoS > & qos_profiles()
Get a mutable reference to the QoS profile of the service endpoint.
RCLCPP_PUBLIC std::string & node_namespace()
Get a mutable reference to the node namespace.
RCLCPP_PUBLIC std::vector< std::array< uint8_t, RMW_GID_STORAGE_SIZE > > & endpoint_gids()
Get a mutable reference to the GID of the service endpoint.
RCLCPP_PUBLIC std::string & service_type()
Get a mutable reference to the service type string.
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::vector< rclcpp::ServiceEndpointInfo > get_clients_info_by_service(const std::string &service_name, bool no_mangle=false) const =0
Return the service endpoint information about clients on a given service.
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 std::vector< rclcpp::ServiceEndpointInfo > get_servers_info_by_service(const std::string &service_name, bool no_mangle=false) const =0
Return the service endpoint information about servers on a given service.
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
rmw_service_endpoint_info_t rcl_service_endpoint_info_t
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Handle for a rcl guard condition.