ROS 2 rclcpp + rcl - rolling  rolling-e7363f10
ROS 2 C++ Client Library with ROS Client Library
node.h
Go to the documentation of this file.
1 // Copyright 2015 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__NODE_H_
18 #define RCL__NODE_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include <stdbool.h>
26 #include <stddef.h>
27 #include <stdint.h>
28 
29 #include "rcl/allocator.h"
30 #include "rcl/arguments.h"
31 #include "rcl/context.h"
32 #include "rcl/guard_condition.h"
33 #include "rcl/macros.h"
34 #include "rcl/node_options.h"
35 #include "rcl/types.h"
36 #include "rcl/visibility_control.h"
37 
38 #include "rmw/types.h"
39 
40 #include "type_description_interfaces/srv/get_type_description.h"
41 
42 extern const char * const RCL_DISABLE_LOANED_MESSAGES_ENV_VAR;
43 
44 typedef struct rcl_node_impl_s rcl_node_impl_t;
45 typedef struct rcl_service_s rcl_service_t;
46 
48 typedef struct rcl_node_s
49 {
52 
56 
58 RCL_PUBLIC
59 RCL_WARN_UNUSED
62 
64 
153 RCL_PUBLIC
154 RCL_WARN_UNUSED
155 rcl_ret_t
157  rcl_node_t * node,
158  const char * name,
159  const char * namespace_,
160  rcl_context_t * context,
161  const rcl_node_options_t * options);
162 
164 
190 RCL_PUBLIC
191 RCL_WARN_UNUSED
192 rcl_ret_t
193 rcl_node_fini(rcl_node_t * node);
194 
196 
230 RCL_PUBLIC
231 bool
232 rcl_node_is_valid(const rcl_node_t * node);
233 
235 
243 RCL_PUBLIC
244 bool
246 
248 
269 RCL_PUBLIC
270 RCL_WARN_UNUSED
271 const char *
272 rcl_node_get_name(const rcl_node_t * node);
273 
275 
296 RCL_PUBLIC
297 RCL_WARN_UNUSED
298 const char *
299 rcl_node_get_namespace(const rcl_node_t * node);
300 
302 
319 RCL_PUBLIC
320 RCL_WARN_UNUSED
321 const char *
323 
325 
346 RCL_PUBLIC
347 RCL_WARN_UNUSED
348 const rcl_node_options_t *
349 rcl_node_get_options(const rcl_node_t * node);
350 
352 
379 RCL_PUBLIC
380 RCL_WARN_UNUSED
381 rcl_ret_t
382 rcl_node_get_domain_id(const rcl_node_t * node, size_t * domain_id);
383 
385 
410 RCL_PUBLIC
411 RCL_WARN_UNUSED
412 rmw_node_t *
413 rcl_node_get_rmw_handle(const rcl_node_t * node);
414 
416 
439 RCL_PUBLIC
440 RCL_WARN_UNUSED
441 uint64_t
443 
445 
472 RCL_PUBLIC
473 RCL_WARN_UNUSED
474 const rcl_guard_condition_t *
476 
478 
499 RCL_PUBLIC
500 RCL_WARN_UNUSED
501 const char *
503 
505 
534 RCL_PUBLIC
535 RCL_WARN_UNUSED
536 rcl_ret_t
538  const rcl_node_t * node,
539  const char * input_name,
540  rcl_allocator_t allocator,
541  bool is_service,
542  bool only_expand,
543  char ** output_name);
544 
546 
555 RCL_PUBLIC
556 rcl_ret_t
557 rcl_get_disable_loaned_message(bool * disable_loaned_message);
558 
560 
588 RCL_PUBLIC
589 RCL_WARN_UNUSED
591  rcl_service_t * service,
592  const rcl_node_t * node);
593 
595 
613 RCL_PUBLIC
615  rcl_node_t * node,
616  const rmw_request_id_t * request_header,
617  const type_description_interfaces__srv__GetTypeDescription_Request * request,
618  type_description_interfaces__srv__GetTypeDescription_Response * response);
619 
620 #ifdef __cplusplus
621 }
622 #endif
623 
624 #endif // RCL__NODE_H_
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Definition: allocator.h:31
RCL_PUBLIC RCL_WARN_UNUSED const rcl_node_options_t * rcl_node_get_options(const rcl_node_t *node)
Return the rcl node options.
Definition: node.c:447
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_node_type_description_service_init(rcl_service_t *service, const rcl_node_t *node)
Initialize the node's ~/get_type_description service.
Definition: node.c:591
RCL_PUBLIC RCL_WARN_UNUSED rcl_node_t rcl_get_zero_initialized_node(void)
Return a rcl_node_t struct with members initialized to NULL.
Definition: node.c:102
RCL_PUBLIC RCL_WARN_UNUSED const char * rcl_node_get_name(const rcl_node_t *node)
Return the name of the node.
Definition: node.c:420
RCL_PUBLIC bool rcl_node_is_valid(const rcl_node_t *node)
Return true if the node is valid, else false.
Definition: node.c:406
RCL_PUBLIC rcl_ret_t rcl_get_disable_loaned_message(bool *disable_loaned_message)
Check if loaned message is disabled, according to the environment variable.
Definition: node.c:506
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_node_fini(rcl_node_t *node)
Finalize a rcl_node_t.
Definition: node.c:353
RCL_PUBLIC RCL_WARN_UNUSED const char * rcl_node_get_namespace(const rcl_node_t *node)
Return the namespace of the node.
Definition: node.c:429
struct rcl_node_s rcl_node_t
Structure which encapsulates a ROS Node.
RCL_PUBLIC RCL_WARN_UNUSED const rcl_guard_condition_t * rcl_node_get_graph_guard_condition(const rcl_node_t *node)
Return a guard condition which is triggered when the ROS graph changes.
Definition: node.c:488
RCL_PUBLIC RCL_WARN_UNUSED rmw_node_t * rcl_node_get_rmw_handle(const rcl_node_t *node)
Return the rmw node handle.
Definition: node.c:470
RCL_PUBLIC RCL_WARN_UNUSED const char * rcl_node_get_fully_qualified_name(const rcl_node_t *node)
Return the fully qualified name of the node.
Definition: node.c:438
RCL_PUBLIC void rcl_node_type_description_service_handle_request(rcl_node_t *node, const rmw_request_id_t *request_header, const type_description_interfaces__srv__GetTypeDescription_Request *request, type_description_interfaces__srv__GetTypeDescription_Response *response)
Process a single pending request to the GetTypeDescription service.
Definition: node.c:525
RCL_PUBLIC RCL_WARN_UNUSED uint64_t rcl_node_get_rcl_instance_id(const rcl_node_t *node)
Return the associated rcl instance id.
Definition: node.c:479
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_node_get_domain_id(const rcl_node_t *node, size_t *domain_id)
Return the ROS domain ID that the node is using.
Definition: node.c:456
RCL_PUBLIC RCL_WARN_UNUSED const char * rcl_node_get_logger_name(const rcl_node_t *node)
Return the logger name of the node.
Definition: node.c:497
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_node_init(rcl_node_t *node, const char *name, const char *namespace_, rcl_context_t *context, const rcl_node_options_t *options)
Initialize a ROS node.
Definition: node.c:110
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_node_resolve_name(const rcl_node_t *node, const char *input_name, rcl_allocator_t allocator, bool is_service, bool only_expand, char **output_name)
Expand a given name into a fully-qualified topic name and apply remapping rules.
RCL_PUBLIC bool rcl_node_is_valid_except_context(const rcl_node_t *node)
Return true if node is valid, except for the context being valid.
Definition: node.c:396
Encapsulates the non-global state of an init/shutdown cycle.
Definition: context.h:117
Handle for a rcl guard condition.
Structure which encapsulates the options for creating a rcl_node_t.
Definition: node_options.h:41
Structure which encapsulates a ROS Node.
Definition: node.h:49
rcl_node_impl_t * impl
Private implementation pointer.
Definition: node.h:54
rcl_context_t * context
Context associated with this node.
Definition: node.h:51
Structure which encapsulates a ROS Service.
Definition: service.h:46
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:25