ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
graph.h
Go to the documentation of this file.
1 // Copyright 2016-2017 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 
17 #ifndef RCL__GRAPH_H_
18 #define RCL__GRAPH_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include <rmw/names_and_types.h>
26 #include <rmw/get_topic_names_and_types.h>
27 #include <rmw/topic_endpoint_info_array.h>
28 
29 #include "rcutils/time.h"
30 #include "rcutils/types.h"
31 
32 #include "rosidl_runtime_c/service_type_support_struct.h"
33 
34 #include "rcl/macros.h"
35 #include "rcl/client.h"
36 #include "rcl/node.h"
37 #include "rcl/visibility_control.h"
38 
40 typedef rmw_names_and_types_t rcl_names_and_types_t;
41 
45 typedef rmw_topic_endpoint_info_t rcl_topic_endpoint_info_t;
46 
48 typedef rmw_topic_endpoint_info_array_t rcl_topic_endpoint_info_array_t;
49 
51 #define rcl_get_zero_initialized_names_and_types rmw_get_zero_initialized_names_and_types
52 
54 #define rcl_get_zero_initialized_topic_endpoint_info_array \
55  rmw_get_zero_initialized_topic_endpoint_info_array
56 
58 #define rcl_topic_endpoint_info_array_fini rmw_topic_endpoint_info_array_fini
59 
61 
104 RCL_PUBLIC
105 RCL_WARN_UNUSED
106 rcl_ret_t
108  const rcl_node_t * node,
109  rcl_allocator_t * allocator,
110  bool no_demangle,
111  const char * node_name,
112  const char * node_namespace,
113  rcl_names_and_types_t * topic_names_and_types);
114 
116 
154 RCL_PUBLIC
155 RCL_WARN_UNUSED
156 rcl_ret_t
158  const rcl_node_t * node,
159  rcl_allocator_t * allocator,
160  bool no_demangle,
161  const char * node_name,
162  const char * node_namespace,
163  rcl_names_and_types_t * topic_names_and_types);
164 
166 
203 RCL_PUBLIC
204 RCL_WARN_UNUSED
205 rcl_ret_t
207  const rcl_node_t * node,
208  rcl_allocator_t * allocator,
209  const char * node_name,
210  const char * node_namespace,
211  rcl_names_and_types_t * service_names_and_types);
212 
214 
251 RCL_PUBLIC
252 RCL_WARN_UNUSED
253 rcl_ret_t
255  const rcl_node_t * node,
256  rcl_allocator_t * allocator,
257  const char * node_name,
258  const char * node_namespace,
259  rcl_names_and_types_t * service_names_and_types);
260 
262 
297 RCL_PUBLIC
298 RCL_WARN_UNUSED
299 rcl_ret_t
301  const rcl_node_t * node,
302  rcl_allocator_t * allocator,
303  bool no_demangle,
304  rcl_names_and_types_t * topic_names_and_types);
305 
307 
337 RCL_PUBLIC
338 RCL_WARN_UNUSED
339 rcl_ret_t
341  const rcl_node_t * node,
342  rcl_allocator_t * allocator,
343  rcl_names_and_types_t * service_names_and_types);
344 
346 
368 RCL_PUBLIC
369 RCL_WARN_UNUSED
370 rcl_ret_t
372  rcl_names_and_types_t * names_and_types,
373  size_t size,
374  rcl_allocator_t * allocator);
375 
377 
399 RCL_PUBLIC
400 RCL_WARN_UNUSED
401 rcl_ret_t
403 
405 
459 RCL_PUBLIC
460 RCL_WARN_UNUSED
461 rcl_ret_t
463  const rcl_node_t * node,
464  rcl_allocator_t allocator,
465  rcutils_string_array_t * node_names,
466  rcutils_string_array_t * node_namespaces);
467 
469 
492 RCL_PUBLIC
493 RCL_WARN_UNUSED
494 rcl_ret_t
496  const rcl_node_t * node,
497  rcl_allocator_t allocator,
498  rcutils_string_array_t * node_names,
499  rcutils_string_array_t * node_namespaces,
500  rcutils_string_array_t * enclaves);
501 
503 
540 RCL_PUBLIC
541 RCL_WARN_UNUSED
542 rcl_ret_t
544  const rcl_node_t * node,
545  const char * topic_name,
546  size_t * count);
547 
549 
586 RCL_PUBLIC
587 RCL_WARN_UNUSED
588 rcl_ret_t
590  const rcl_node_t * node,
591  const char * topic_name,
592  size_t * count);
593 
595 
632 RCL_PUBLIC
633 RCL_WARN_UNUSED
634 rcl_ret_t
636  const rcl_node_t * node,
637  const char * service_name,
638  size_t * count);
639 
641 
678 RCL_PUBLIC
679 RCL_WARN_UNUSED
680 rcl_ret_t
682  const rcl_node_t * node,
683  const char * service_name,
684  size_t * count);
685 
687 
730 RCL_PUBLIC
731 RCL_WARN_UNUSED
732 rcl_ret_t
734  const rcl_node_t * node,
735  rcl_allocator_t * allocator,
736  const char * topic_name,
737  const size_t count,
738  rcutils_duration_value_t timeout,
739  bool * success);
740 
742 
767 RCL_PUBLIC
768 RCL_WARN_UNUSED
769 rcl_ret_t
771  const rcl_node_t * node,
772  rcl_allocator_t * allocator,
773  const char * topic_name,
774  const size_t count,
775  rcutils_duration_value_t timeout,
776  bool * success);
777 
779 
829 RCL_PUBLIC
830 RCL_WARN_UNUSED
831 rcl_ret_t
833  const rcl_node_t * node,
834  rcutils_allocator_t * allocator,
835  const char * topic_name,
836  bool no_mangle,
837  rcl_topic_endpoint_info_array_t * publishers_info);
838 
840 
890 RCL_PUBLIC
891 RCL_WARN_UNUSED
892 rcl_ret_t
894  const rcl_node_t * node,
895  rcutils_allocator_t * allocator,
896  const char * topic_name,
897  bool no_mangle,
898  rcl_topic_endpoint_info_array_t * subscriptions_info);
899 
901 
935 RCL_PUBLIC
936 RCL_WARN_UNUSED
937 rcl_ret_t
939  const rcl_node_t * node,
940  const rcl_client_t * client,
941  bool * is_available);
942 
943 #ifdef __cplusplus
944 }
945 #endif
946 
947 #endif // RCL__GRAPH_H_
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Definition: allocator.h:31
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_count_services(const rcl_node_t *node, const char *service_name, size_t *count)
Return the number of servers on a given service.
Definition: graph.c:479
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_subscriptions_info_by_topic(const rcl_node_t *node, rcutils_allocator_t *allocator, const char *topic_name, bool no_mangle, rcl_topic_endpoint_info_array_t *subscriptions_info)
Return a list of all subscriptions to a topic.
Definition: graph.c:738
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_names_and_types_fini(rcl_names_and_types_t *names_and_types)
Finalize a rcl_names_and_types_t object.
Definition: graph.c:306
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_node_names_with_enclaves(const rcl_node_t *node, rcl_allocator_t allocator, rcutils_string_array_t *node_names, rcutils_string_array_t *node_namespaces, rcutils_string_array_t *enclaves)
Return a list of node names and their associated namespaces and enclaves in the ROS graph.
Definition: graph.c:375
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_service_names_and_types(const rcl_node_t *node, rcl_allocator_t *allocator, rcl_names_and_types_t *service_names_and_types)
Return a list of service names and their types.
Definition: graph.c:267
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_client_names_and_types_by_node(const rcl_node_t *node, rcl_allocator_t *allocator, const char *node_name, const char *node_namespace, rcl_names_and_types_t *service_names_and_types)
Return a list of service client names and types associated with a node.
Definition: graph.c:200
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_service_server_is_available(const rcl_node_t *node, const rcl_client_t *client, bool *is_available)
Check if a service server is available for the given service client.
Definition: graph.c:755
rmw_topic_endpoint_info_t rcl_topic_endpoint_info_t
Definition: graph.h:45
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_publishers_info_by_topic(const rcl_node_t *node, rcutils_allocator_t *allocator, const char *topic_name, bool no_mangle, rcl_topic_endpoint_info_array_t *publishers_info)
Return a list of all publishers to a topic.
Definition: graph.c:721
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_names_and_types_init(rcl_names_and_types_t *names_and_types, size_t size, rcl_allocator_t *allocator)
Initialize a rcl_names_and_types_t object.
Definition: graph.c:292
rmw_topic_endpoint_info_array_t rcl_topic_endpoint_info_array_t
An array of topic endpoint information.
Definition: graph.h:48
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_service_names_and_types_by_node(const rcl_node_t *node, rcl_allocator_t *allocator, const char *node_name, const char *node_namespace, rcl_names_and_types_t *service_names_and_types)
Return a list of service names and types associated with a node.
Definition: graph.c:160
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_subscriber_names_and_types_by_node(const rcl_node_t *node, rcl_allocator_t *allocator, bool no_demangle, const char *node_name, const char *node_namespace, rcl_names_and_types_t *topic_names_and_types)
Return a list of topic names and types for subscriptions associated with a node.
Definition: graph.c:118
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_count_subscribers(const rcl_node_t *node, const char *topic_name, size_t *count)
Return the number of subscriptions on a given topic.
Definition: graph.c:441
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_wait_for_publishers(const rcl_node_t *node, rcl_allocator_t *allocator, const char *topic_name, const size_t count, rcutils_duration_value_t timeout, bool *success)
Wait for there to be a specified number of publishers on a given topic.
Definition: graph.c:633
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_count_clients(const rcl_node_t *node, const char *service_name, size_t *count)
Return the number of clients on a given service.
Definition: graph.c:460
rmw_names_and_types_t rcl_names_and_types_t
A structure that contains topic names and types.
Definition: graph.h:40
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_publisher_names_and_types_by_node(const rcl_node_t *node, rcl_allocator_t *allocator, bool no_demangle, const char *node_name, const char *node_namespace, rcl_names_and_types_t *topic_names_and_types)
Return a list of topic names and types for publishers associated with a node.
Definition: graph.c:77
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_wait_for_subscribers(const rcl_node_t *node, rcl_allocator_t *allocator, const char *topic_name, const size_t count, rcutils_duration_value_t timeout, bool *success)
Wait for there to be a specified number of subscribers on a given topic.
Definition: graph.c:652
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_topic_names_and_types(const rcl_node_t *node, rcl_allocator_t *allocator, bool no_demangle, rcl_names_and_types_t *topic_names_and_types)
Return a list of topic names and their types.
Definition: graph.c:240
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_get_node_names(const rcl_node_t *node, rcl_allocator_t allocator, rcutils_string_array_t *node_names, rcutils_string_array_t *node_namespaces)
Return a list of node names and their associated namespaces in the ROS graph.
Definition: graph.c:316
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_count_publishers(const rcl_node_t *node, const char *topic_name, size_t *count)
Return the number of publishers on a given topic.
Definition: graph.c:422
Structure which encapsulates a ROS Client.
Definition: client.h:43
Structure which encapsulates a ROS Node.
Definition: node.h:45
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:24