rcl  master
C API providing common ROS client library functionality.
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>
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 
41 
46 
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 
452 RCL_PUBLIC
453 RCL_WARN_UNUSED
454 rcl_ret_t
456  const rcl_node_t * node,
457  rcl_allocator_t allocator,
458  rcutils_string_array_t * node_names,
459  rcutils_string_array_t * node_namespaces);
460 
462 
485 RCL_PUBLIC
486 RCL_WARN_UNUSED
487 rcl_ret_t
489  const rcl_node_t * node,
490  rcl_allocator_t allocator,
491  rcutils_string_array_t * node_names,
492  rcutils_string_array_t * node_namespaces,
493  rcutils_string_array_t * enclaves);
494 
496 
532 RCL_PUBLIC
533 RCL_WARN_UNUSED
534 rcl_ret_t
536  const rcl_node_t * node,
537  const char * topic_name,
538  size_t * count);
539 
541 
577 RCL_PUBLIC
578 RCL_WARN_UNUSED
579 rcl_ret_t
581  const rcl_node_t * node,
582  const char * topic_name,
583  size_t * count);
584 
586 
629 RCL_PUBLIC
630 RCL_WARN_UNUSED
631 rcl_ret_t
633  const rcl_node_t * node,
634  rcl_allocator_t * allocator,
635  const char * topic_name,
636  const size_t count,
637  rcutils_duration_value_t timeout,
638  bool * success);
639 
641 
666 RCL_PUBLIC
667 RCL_WARN_UNUSED
668 rcl_ret_t
670  const rcl_node_t * node,
671  rcl_allocator_t * allocator,
672  const char * topic_name,
673  const size_t count,
674  rcutils_duration_value_t timeout,
675  bool * success);
676 
678 
728 RCL_PUBLIC
729 RCL_WARN_UNUSED
730 rcl_ret_t
732  const rcl_node_t * node,
733  rcutils_allocator_t * allocator,
734  const char * topic_name,
735  bool no_mangle,
736  rcl_topic_endpoint_info_array_t * publishers_info);
737 
739 
789 RCL_PUBLIC
790 RCL_WARN_UNUSED
791 rcl_ret_t
793  const rcl_node_t * node,
794  rcutils_allocator_t * allocator,
795  const char * topic_name,
796  bool no_mangle,
797  rcl_topic_endpoint_info_array_t * subscriptions_info);
798 
800 
834 RCL_PUBLIC
835 RCL_WARN_UNUSED
836 rcl_ret_t
838  const rcl_node_t * node,
839  const rcl_client_t * client,
840  bool * is_available);
841 
842 #ifdef __cplusplus
843 }
844 #endif
845 
846 #endif // RCL__GRAPH_H_
rcutils_duration_value_t
int64_t rcutils_duration_value_t
rcl_node_t
Structure which encapsulates a ROS Node.
Definition: node.h:39
rcl_topic_endpoint_info_array_t
rmw_topic_endpoint_info_array_t rcl_topic_endpoint_info_array_t
An array of topic endpoint information.
Definition: graph.h:48
rcl_count_publishers
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.
rcl_wait_for_publishers
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.
rcl_ret_t
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23
rcl_count_subscribers
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.
rcl_client_t
Structure which encapsulates a ROS Client.
Definition: client.h:35
time.h
rcl_get_publishers_info_by_topic
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.
rcl_get_subscriptions_info_by_topic
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.
rcl_names_and_types_fini
rcl_ret_t rcl_names_and_types_fini(rcl_names_and_types_t *names_and_types)
Finalize a rcl_names_and_types_t object.
rcutils_string_array_t
rcl_get_service_names_and_types
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.
topic_endpoint_info_array.h
node.h
rcl_topic_endpoint_info_t
rmw_topic_endpoint_info_t rcl_topic_endpoint_info_t
Definition: graph.h:45
rmw_names_and_types_t
rcl_get_node_names_with_enclaves
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 available nodes in the ROS graph, including their enclave names.
rcl_names_and_types_t
rmw_names_and_types_t rcl_names_and_types_t
A structure that contains topic names and types.
Definition: graph.h:40
rcl_get_client_names_and_types_by_node
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.
rcutils_allocator_t
rcl_get_publisher_names_and_types_by_node
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.
rmw_topic_endpoint_info_t
get_topic_names_and_types.h
rmw_topic_endpoint_info_array_t
rcl_get_service_names_and_types_by_node
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.
rcl_service_server_is_available
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.
names_and_types.h
rcl_get_node_names
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 available nodes in the ROS graph.
rcl_get_topic_names_and_types
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.
types.h
rcl_wait_for_subscribers
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.
client.h
rcl_names_and_types_init
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.
rcl_get_subscriber_names_and_types_by_node
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.