ROS 2 rclcpp + rcl - kilted  kilted
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 #include "type_description_interfaces/srv/get_type_description.h"
37 
38 extern const char * const RCL_DISABLE_LOANED_MESSAGES_ENV_VAR;
39 
40 typedef struct rcl_node_impl_s rcl_node_impl_t;
41 typedef struct rcl_service_s rcl_service_t;
42 
44 typedef struct rcl_node_s
45 {
48 
52 
54 RCL_PUBLIC
55 RCL_WARN_UNUSED
58 
60 
149 RCL_PUBLIC
150 RCL_WARN_UNUSED
151 rcl_ret_t
153  rcl_node_t * node,
154  const char * name,
155  const char * namespace_,
156  rcl_context_t * context,
157  const rcl_node_options_t * options);
158 
160 
186 RCL_PUBLIC
187 RCL_WARN_UNUSED
188 rcl_ret_t
189 rcl_node_fini(rcl_node_t * node);
190 
192 
226 RCL_PUBLIC
227 bool
228 rcl_node_is_valid(const rcl_node_t * node);
229 
231 
239 RCL_PUBLIC
240 bool
242 
244 
265 RCL_PUBLIC
266 RCL_WARN_UNUSED
267 const char *
268 rcl_node_get_name(const rcl_node_t * node);
269 
271 
292 RCL_PUBLIC
293 RCL_WARN_UNUSED
294 const char *
295 rcl_node_get_namespace(const rcl_node_t * node);
296 
298 
315 RCL_PUBLIC
316 RCL_WARN_UNUSED
317 const char *
319 
321 
342 RCL_PUBLIC
343 RCL_WARN_UNUSED
344 const rcl_node_options_t *
345 rcl_node_get_options(const rcl_node_t * node);
346 
348 
375 RCL_PUBLIC
376 RCL_WARN_UNUSED
377 rcl_ret_t
378 rcl_node_get_domain_id(const rcl_node_t * node, size_t * domain_id);
379 
381 
406 RCL_PUBLIC
407 RCL_WARN_UNUSED
408 rmw_node_t *
409 rcl_node_get_rmw_handle(const rcl_node_t * node);
410 
412 
435 RCL_PUBLIC
436 RCL_WARN_UNUSED
437 uint64_t
439 
441 
468 RCL_PUBLIC
469 RCL_WARN_UNUSED
470 const rcl_guard_condition_t *
472 
474 
495 RCL_PUBLIC
496 RCL_WARN_UNUSED
497 const char *
499 
501 
530 RCL_PUBLIC
531 RCL_WARN_UNUSED
532 rcl_ret_t
534  const rcl_node_t * node,
535  const char * input_name,
536  rcl_allocator_t allocator,
537  bool is_service,
538  bool only_expand,
539  char ** output_name);
540 
542 
551 RCL_PUBLIC
552 rcl_ret_t
553 rcl_get_disable_loaned_message(bool * disable_loaned_message);
554 
556 
584 RCL_PUBLIC
585 RCL_WARN_UNUSED
587  rcl_service_t * service,
588  const rcl_node_t * node);
589 
591 
609 RCL_PUBLIC
611  rcl_node_t * node,
612  const rmw_request_id_t * request_header,
613  const type_description_interfaces__srv__GetTypeDescription_Request * request,
614  type_description_interfaces__srv__GetTypeDescription_Response * response);
615 
616 #ifdef __cplusplus
617 }
618 #endif
619 
620 #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:435
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:579
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:98
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:408
RCL_PUBLIC bool rcl_node_is_valid(const rcl_node_t *node)
Return true if the node is valid, else false.
Definition: node.c:394
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:494
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_node_fini(rcl_node_t *node)
Finalize a rcl_node_t.
Definition: node.c:341
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:417
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:476
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:458
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:426
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:513
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:467
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:444
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:485
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:106
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:384
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:45
rcl_node_impl_t * impl
Private implementation pointer.
Definition: node.h:50
rcl_context_t * context
Context associated with this node.
Definition: node.h:47
Structure which encapsulates a ROS Service.
Definition: service.h:43
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:24