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 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 struct rcl_arguments_impl_t;
29 
31 typedef struct rcl_arguments_t
32 {
34  struct rcl_arguments_impl_t * impl;
36 
37 #define RCL_LOG_LEVEL_ARG_RULE "__log_level:="
38 #define RCL_PARAM_FILE_ARG_RULE "__params:="
39 
45 
47 
91  int argc,
92  const char * const argv[],
93  rcl_allocator_t allocator,
94  rcl_arguments_t * args_output);
95 
97 
112 int
114  const rcl_arguments_t * args);
115 
117 
143 rcl_ret_t
145  const rcl_arguments_t * args,
146  rcl_allocator_t allocator,
147  int ** output_unparsed_indices);
148 
150 
165 int
167  const rcl_arguments_t * args);
168 
169 
171 
192 rcl_ret_t
194  const rcl_arguments_t * arguments,
195  rcl_allocator_t allocator,
196  char *** parameter_files);
197 
199 
227 rcl_ret_t
229  char const * const argv[],
230  const rcl_arguments_t * args,
231  rcl_allocator_t allocator,
232  int * nonros_argc,
233  const char ** nonros_argv[]);
234 
236 
257 rcl_ret_t
259  rcl_allocator_t error_alloc,
260  const rcl_arguments_t * args,
261  rcl_arguments_t * args_out);
262 
264 
281 rcl_ret_t
283  rcl_arguments_t * args);
284 
286 
308 
309 #ifdef __cplusplus
310 }
311 #endif
312 
313 #endif // RCL__ARGUMENTS_H_
rcl_ret_t rcl_arguments_get_unparsed(const rcl_arguments_t *args, rcl_allocator_t allocator, int **output_unparsed_indices)
Return a list of indexes that weren't successfully parsed.
Definition: arguments.c:302
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:108
struct rcl_arguments_t rcl_arguments_t
Hold output of parsing command line arguments.
rcl_arguments_t * rcl_get_global_arguments()
Get a global instance of command line arguments.
Definition: arguments.c:517
rmw_ret_t rcl_ret_t
Definition: types.h:20
Hold output of parsing command line arguments.
Definition: arguments.h:31
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:336
rcl_arguments_t rcl_get_zero_initialized_arguments(void)
Return a rcl_node_t struct with members initialized to NULL.
Definition: arguments.c:327
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:78
int rcl_arguments_get_count_unparsed(const rcl_arguments_t *args)
Return the number of arguments that were not successfully parsed.
Definition: arguments.c:292
#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:469
#define RCL_PUBLIC
Definition: visibility_control.h:48
rcl_ret_t rcl_arguments_copy(rcl_allocator_t error_alloc, const rcl_arguments_t *args, rcl_arguments_t *args_out)
Copy one arguments structure into another.
Definition: arguments.c:378
struct rcl_arguments_impl_t * impl
Private implementation pointer.
Definition: arguments.h:34
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:135