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 
15 #ifndef RCL__ARGUMENTS_H_
16 #define RCL__ARGUMENTS_H_
17 
18 #include "rcl/allocator.h"
19 #include "rcl/macros.h"
20 #include "rcl/types.h"
21 #include "rcl/visibility_control.h"
22 #include "rcl_yaml_param_parser/types.h"
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 struct rcl_arguments_impl_t;
30 
32 typedef struct rcl_arguments_t
33 {
35  struct rcl_arguments_impl_t * impl;
37 
38 #define RCL_ROS_ARGS_FLAG "--ros-args"
39 #define RCL_ROS_ARGS_EXPLICIT_END_TOKEN "--"
40 #define RCL_PARAM_FLAG "--param"
41 #define RCL_SHORT_PARAM_FLAG "-p"
42 #define RCL_PARAM_FILE_FLAG "--params-file"
43 #define RCL_REMAP_FLAG "--remap"
44 #define RCL_SHORT_REMAP_FLAG "-r"
45 #define RCL_LOG_LEVEL_FLAG "--log-level"
46 #define RCL_EXTERNAL_LOG_CONFIG_FLAG "--log-config-file"
47 // To be prefixed with --enable- or --disable-
48 #define RCL_LOG_STDOUT_FLAG_SUFFIX "stdout-logs"
49 #define RCL_LOG_ROSOUT_FLAG_SUFFIX "rosout-logs"
50 #define RCL_LOG_EXT_LIB_FLAG_SUFFIX "external-lib-logs"
51 
52 // \deprecated to be removed in F-Turtle
53 #define RCL_LOG_LEVEL_ARG_RULE "__log_level:="
54 #define RCL_EXTERNAL_LOG_CONFIG_ARG_RULE "__log_config_file:="
55 #define RCL_LOG_DISABLE_STDOUT_ARG_RULE "__log_disable_stdout:="
56 #define RCL_LOG_DISABLE_ROSOUT_ARG_RULE "__log_disable_rosout:="
57 #define RCL_LOG_DISABLE_EXT_LIB_ARG_RULE "__log_disable_external_lib:="
58 #define RCL_PARAM_FILE_ARG_RULE "__params:="
59 
65 
67 
125 rcl_ret_t
127  int argc,
128  const char * const argv[],
129  rcl_allocator_t allocator,
130  rcl_arguments_t * args_output);
131 
133 
148 int
150  const rcl_arguments_t * args);
151 
153 
179 rcl_ret_t
181  const rcl_arguments_t * args,
182  rcl_allocator_t allocator,
183  int ** output_unparsed_indices);
184 
186 
201 int
203  const rcl_arguments_t * args);
204 
206 
231 rcl_ret_t
233  const rcl_arguments_t * args,
234  rcl_allocator_t allocator,
235  int ** output_unparsed_ros_indices);
236 
238 
253 int
255  const rcl_arguments_t * args);
256 
257 
259 
280 rcl_ret_t
282  const rcl_arguments_t * arguments,
283  rcl_allocator_t allocator,
284  char *** parameter_files);
285 
287 
310 rcl_ret_t
312  const rcl_arguments_t * arguments,
313  rcl_params_t ** parameter_overrides);
314 
316 
344 rcl_ret_t
346  char const * const argv[],
347  const rcl_arguments_t * args,
348  rcl_allocator_t allocator,
349  int * nonros_argc,
350  const char ** nonros_argv[]);
351 
353 
372 rcl_ret_t
374  const rcl_arguments_t * args,
375  rcl_arguments_t * args_out);
376 
378 
394 rcl_ret_t
396  rcl_arguments_t * args);
397 
398 #ifdef __cplusplus
399 }
400 #endif
401 
402 #endif // RCL__ARGUMENTS_H_
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:930
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:810
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:835
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:110
struct rcl_arguments_t rcl_arguments_t
Hold output of parsing command line arguments.
rmw_ret_t rcl_ret_t
Definition: types.h:20
Hold output of parsing command line arguments.
Definition: arguments.h:32
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:879
rcl_arguments_t rcl_get_zero_initialized_arguments(void)
Return a rcl_arguments_t struct with members initialized to NULL.
Definition: arguments.c:870
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:120
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
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:800
#define RCL_WARN_UNUSED
Ignored return values of functions with this macro will emit a warning.
Definition: macros.h:25
rcl_ret_t rcl_arguments_fini(rcl_arguments_t *args)
Reclaim resources held inside rcl_arguments_t structure.
Definition: arguments.c:1050
#define RCL_PUBLIC
Definition: visibility_control.h:48
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:845
struct rcl_arguments_impl_t * impl
Private implementation pointer.
Definition: arguments.h:35
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:303