ROS 2 rclcpp + rcl - humble  humble
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 <stdint.h>
26 
27 #include "rcl/allocator.h"
28 #include "rcl/arguments.h"
29 #include "rcl/context.h"
30 #include "rcl/guard_condition.h"
31 #include "rcl/macros.h"
32 #include "rcl/node_options.h"
33 #include "rcl/types.h"
34 #include "rcl/visibility_control.h"
35 
36 extern const char * const RCL_DISABLE_LOANED_MESSAGES_ENV_VAR;
37 
38 typedef struct rcl_node_impl_s rcl_node_impl_t;
39 
41 typedef struct rcl_node_s
42 {
45 
49 
51 RCL_PUBLIC
52 RCL_WARN_UNUSED
55 
57 
146 RCL_PUBLIC
147 RCL_WARN_UNUSED
148 rcl_ret_t
150  rcl_node_t * node,
151  const char * name,
152  const char * namespace_,
153  rcl_context_t * context,
154  const rcl_node_options_t * options);
155 
157 
183 RCL_PUBLIC
184 RCL_WARN_UNUSED
185 rcl_ret_t
186 rcl_node_fini(rcl_node_t * node);
187 
189 
223 RCL_PUBLIC
224 bool
225 rcl_node_is_valid(const rcl_node_t * node);
226 
228 
236 RCL_PUBLIC
237 bool
239 
241 
262 RCL_PUBLIC
263 RCL_WARN_UNUSED
264 const char *
265 rcl_node_get_name(const rcl_node_t * node);
266 
268 
289 RCL_PUBLIC
290 RCL_WARN_UNUSED
291 const char *
292 rcl_node_get_namespace(const rcl_node_t * node);
293 
295 
312 RCL_PUBLIC
313 RCL_WARN_UNUSED
314 const char *
316 
318 
339 RCL_PUBLIC
340 RCL_WARN_UNUSED
341 const rcl_node_options_t *
342 rcl_node_get_options(const rcl_node_t * node);
343 
345 
372 RCL_PUBLIC
373 RCL_WARN_UNUSED
374 rcl_ret_t
375 rcl_node_get_domain_id(const rcl_node_t * node, size_t * domain_id);
376 
378 
403 RCL_PUBLIC
404 RCL_WARN_UNUSED
405 rmw_node_t *
406 rcl_node_get_rmw_handle(const rcl_node_t * node);
407 
409 
432 RCL_PUBLIC
433 RCL_WARN_UNUSED
434 uint64_t
436 
438 
465 RCL_PUBLIC
466 RCL_WARN_UNUSED
467 const rcl_guard_condition_t *
469 
471 
492 RCL_PUBLIC
493 RCL_WARN_UNUSED
494 const char *
496 
498 
527 RCL_PUBLIC
528 RCL_WARN_UNUSED
529 rcl_ret_t
531  const rcl_node_t * node,
532  const char * input_name,
533  rcl_allocator_t allocator,
534  bool is_service,
535  bool only_expand,
536  char ** output_name);
537 
539 
548 RCL_PUBLIC
549 rcl_ret_t
550 rcl_get_disable_loaned_message(bool * disable_loaned_message);
551 
552 #ifdef __cplusplus
553 }
554 #endif
555 
556 #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:462
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:107
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:435
RCL_PUBLIC bool rcl_node_is_valid(const rcl_node_t *node)
Return true if the node is valid, else false.
Definition: node.c:421
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:521
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_node_fini(rcl_node_t *node)
Finalize a rcl_node_t.
Definition: node.c:366
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:444
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:503
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:485
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:453
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:494
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:471
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:512
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:117
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:411
Encapsulates the non-global state of an init/shutdown cycle.
Definition: context.h:114
Handle for a rcl guard condition.
Structure which encapsulates the options for creating a rcl_node_t.
Definition: node_options.h:35
Structure which encapsulates a ROS Node.
Definition: node.h:42
rcl_node_impl_t * impl
Private implementation pointer.
Definition: node.h:47
rcl_context_t * context
Context associated with this node.
Definition: node.h:44
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23