rcl  master
C API providing common ROS client library functionality.
arguments.h
Go to the documentation of this file.
1 // Copyright 2018 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__ARGUMENTS_H_
18 #define RCL__ARGUMENTS_H_
19 
20 #include "rcl/allocator.h"
21 #include "rcl/log_level.h"
22 #include "rcl/macros.h"
23 #include "rcl/types.h"
24 #include "rcl/visibility_control.h"
25 #include "rcl_yaml_param_parser/types.h"
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 struct rcl_arguments_impl_t;
33 
35 typedef struct rcl_arguments_t
36 {
38  struct rcl_arguments_impl_t * impl;
40 
42 #define RCL_ROS_ARGS_FLAG "--ros-args"
43 
45 #define RCL_ROS_ARGS_EXPLICIT_END_TOKEN "--"
46 
48 #define RCL_PARAM_FLAG "--param"
49 
51 #define RCL_SHORT_PARAM_FLAG "-p"
52 
54 #define RCL_PARAM_FILE_FLAG "--params-file"
55 
57 #define RCL_REMAP_FLAG "--remap"
58 
60 #define RCL_SHORT_REMAP_FLAG "-r"
61 
63 #define RCL_ENCLAVE_FLAG "--enclave"
64 
66 #define RCL_SHORT_ENCLAVE_FLAG "-e"
67 
69 #define RCL_LOG_LEVEL_FLAG "--log-level"
70 
72 #define RCL_EXTERNAL_LOG_CONFIG_FLAG "--log-config-file"
73 
76 #define RCL_LOG_STDOUT_FLAG_SUFFIX "stdout-logs"
77 
80 #define RCL_LOG_ROSOUT_FLAG_SUFFIX "rosout-logs"
81 
84 #define RCL_LOG_EXT_LIB_FLAG_SUFFIX "external-lib-logs"
85 
87 RCL_PUBLIC
88 RCL_WARN_UNUSED
91 
93 
149 RCL_PUBLIC
150 RCL_WARN_UNUSED
151 rcl_ret_t
153  int argc,
154  const char * const argv[],
155  rcl_allocator_t allocator,
156  rcl_arguments_t * args_output);
157 
159 
172 RCL_PUBLIC
173 RCL_WARN_UNUSED
174 int
176  const rcl_arguments_t * args);
177 
179 
203 RCL_PUBLIC
204 RCL_WARN_UNUSED
205 rcl_ret_t
207  const rcl_arguments_t * args,
208  rcl_allocator_t allocator,
209  int ** output_unparsed_indices);
210 
212 
225 RCL_PUBLIC
226 RCL_WARN_UNUSED
227 int
229  const rcl_arguments_t * args);
230 
232 
255 RCL_PUBLIC
256 RCL_WARN_UNUSED
257 rcl_ret_t
259  const rcl_arguments_t * args,
260  rcl_allocator_t allocator,
261  int ** output_unparsed_ros_indices);
262 
264 
277 RCL_PUBLIC
278 RCL_WARN_UNUSED
279 int
281  const rcl_arguments_t * args);
282 
283 
285 
304 RCL_PUBLIC
305 RCL_WARN_UNUSED
306 rcl_ret_t
308  const rcl_arguments_t * arguments,
309  rcl_allocator_t allocator,
310  char *** parameter_files);
311 
313 
334 RCL_PUBLIC
335 RCL_WARN_UNUSED
336 rcl_ret_t
338  const rcl_arguments_t * arguments,
339  rcl_params_t ** parameter_overrides);
340 
342 
368 RCL_PUBLIC
369 RCL_WARN_UNUSED
370 rcl_ret_t
372  char const * const argv[],
373  const rcl_arguments_t * args,
374  rcl_allocator_t allocator,
375  int * nonros_argc,
376  const char ** nonros_argv[]);
377 
379 
397 RCL_PUBLIC
398 RCL_WARN_UNUSED
399 rcl_ret_t
401  const rcl_arguments_t * arguments,
402  rcl_log_levels_t * log_levels);
403 
405 
422 RCL_PUBLIC
423 RCL_WARN_UNUSED
424 rcl_ret_t
426  const rcl_arguments_t * args,
427  rcl_arguments_t * args_out);
428 
430 
444 RCL_PUBLIC
445 RCL_WARN_UNUSED
446 rcl_ret_t
448  rcl_arguments_t * args);
449 
450 #ifdef __cplusplus
451 }
452 #endif
453 
454 #endif // RCL__ARGUMENTS_H_
rcl_arguments_get_param_files
rcl_ret_t rcl_arguments_get_param_files(const rcl_arguments_t *arguments, rcl_allocator_t allocator, char ***parameter_files)
Return a list of yaml parameter file paths specified on the command line.
Definition: arguments.c:77
rcl_arguments_get_param_overrides
rcl_ret_t rcl_arguments_get_param_overrides(const rcl_arguments_t *arguments, rcl_params_t **parameter_overrides)
Return all parameter overrides parsed from the command line.
Definition: arguments.c:117
types.h
rcl_ret_t
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23
rcl_arguments_get_unparsed_ros
rcl_ret_t rcl_arguments_get_unparsed_ros(const rcl_arguments_t *args, rcl_allocator_t allocator, int **output_unparsed_ros_indices)
Return a list of indices to unknown ROS specific arguments that were left unparsed.
Definition: arguments.c:727
rcl_arguments_get_unparsed
rcl_ret_t rcl_arguments_get_unparsed(const rcl_arguments_t *args, rcl_allocator_t allocator, int **output_unparsed_indices)
Return a list of indices to non ROS specific arguments.
Definition: arguments.c:692
rcl_arguments_get_param_files_count
int rcl_arguments_get_param_files_count(const rcl_arguments_t *args)
Return the number of parameter yaml files given in the arguments.
Definition: arguments.c:107
rcl_arguments_get_log_levels
rcl_ret_t rcl_arguments_get_log_levels(const rcl_arguments_t *arguments, rcl_log_levels_t *log_levels)
Return log levels parsed from the command line.
Definition: arguments.c:140
rcl_arguments_t::impl
struct rcl_arguments_impl_t * impl
Private implementation pointer.
Definition: arguments.h:38
rcl_arguments_get_count_unparsed_ros
int rcl_arguments_get_count_unparsed_ros(const rcl_arguments_t *args)
Return the number of ROS specific arguments that were not successfully parsed.
Definition: arguments.c:717
rcl_remove_ros_arguments
rcl_ret_t rcl_remove_ros_arguments(char const *const argv[], const rcl_arguments_t *args, rcl_allocator_t allocator, int *nonros_argc, const char **nonros_argv[])
Return a list of arguments with ROS-specific arguments removed.
Definition: arguments.c:761
rcl_arguments_t
Hold output of parsing command line arguments.
Definition: arguments.h:35
rcutils_allocator_t
allocator.h
rcl_arguments_copy
rcl_ret_t rcl_arguments_copy(const rcl_arguments_t *args, rcl_arguments_t *args_out)
Copy one arguments structure into another.
Definition: arguments.c:812
rcl_arguments_t
struct rcl_arguments_t rcl_arguments_t
Hold output of parsing command line arguments.
rcl_log_levels_t
Hold default logger level and other logger setting.
Definition: log_level.h:43
rcl_arguments_get_count_unparsed
int rcl_arguments_get_count_unparsed(const rcl_arguments_t *args)
Return the number of arguments that were not ROS specific arguments.
Definition: arguments.c:682
rcl_parse_arguments
rcl_ret_t rcl_parse_arguments(int argc, const char *const argv[], rcl_allocator_t allocator, rcl_arguments_t *args_output)
Parse command line arguments into a structure usable by code.
Definition: arguments.c:248
log_level.h
rcl_arguments_fini
rcl_ret_t rcl_arguments_fini(rcl_arguments_t *args)
Reclaim resources held inside rcl_arguments_t structure.
Definition: arguments.c:932
rcl_get_zero_initialized_arguments
rcl_arguments_t rcl_get_zero_initialized_arguments(void)
Return a rcl_arguments_t struct with members initialized to NULL.
Definition: arguments.c:752