rcl  master
C API providing common ROS client library functionality.
Macros | Functions
arguments.c File Reference
#include "rcl/arguments.h"
#include <assert.h>
#include <string.h>
#include "./arguments_impl.h"
#include "./remap_impl.h"
#include "rcl/error_handling.h"
#include "rcl/lexer_lookahead.h"
#include "rcl/validate_topic_name.h"
#include "rcl_yaml_param_parser/parser.h"
#include "rcutils/allocator.h"
#include "rcutils/error_handling.h"
#include "rcutils/format_string.h"
#include "rcutils/logging.h"
#include "rcutils/logging_macros.h"
#include "rcutils/strdup.h"
#include "rmw/validate_namespace.h"
#include "rmw/validate_node_name.h"
Include dependency graph for arguments.c:

Macros

#define RCL_ENABLE_FLAG_PREFIX   "--enable-"
 
#define RCL_DISABLE_FLAG_PREFIX   "--disable-"
 

Functions

RCL_LOCAL rcl_ret_t _rcl_parse_remap_rule (const char *arg, rcl_allocator_t allocator, rcl_remap_t *output_rule)
 // Internal Doxygen documentation More...
 
rcl_ret_t _rcl_parse_param_rule (const char *arg, rcl_params_t *params)
 Parse an argument that may or may not be a param rule. More...
 
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. More...
 
int rcl_arguments_get_param_files_count (const rcl_arguments_t *args)
 Return the number of parameter yaml files given in the arguments. More...
 
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. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_log_level (const char *arg, rcl_allocator_t allocator, int *log_level)
 Parse an argument that may or may not be a log level rule. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_log_level_rule (const char *arg, rcl_allocator_t allocator, int *log_level)
 Parse an argument that may or may not be a log level rule. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_external_log_config_file (const char *arg, rcl_allocator_t allocator, char **log_config_file)
 Parse an argument that may or may not be a log configuration file. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_external_log_config_file_rule (const char *arg, rcl_allocator_t allocator, char **log_config_file)
 Parse an argument that may or may not be a log file rule. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_param_file (const char *arg, rcl_allocator_t allocator, rcl_params_t *params, char **param_file)
 Parse an argument that may or may not be a parameter file. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_param_file_rule (const char *arg, rcl_allocator_t allocator, rcl_params_t *params, char **param_file)
 Parse an argument that may or may not be a parameter file rule. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_disabling_flag (const char *arg, const char *key, bool *value)
 Parse a bool argument that may or may not be for the provided key rule. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_bool_arg (const char *arg, const char *key, bool *value)
 Parse a bool argument that may or may not be for the provided key rule. More...
 
RCL_LOCAL rcl_ret_t _atob (const char *str, bool *val)
 Parse a null terminated string to a boolean value. More...
 
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. More...
 
int rcl_arguments_get_count_unparsed (const rcl_arguments_t *args)
 Return the number of arguments that were not ROS specific arguments. More...
 
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. More...
 
int rcl_arguments_get_count_unparsed_ros (const rcl_arguments_t *args)
 Return the number of ROS specific arguments that were not successfully parsed. More...
 
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. More...
 
rcl_arguments_t rcl_get_zero_initialized_arguments (void)
 Return a rcl_arguments_t struct with members initialized to NULL. More...
 
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. More...
 
rcl_ret_t rcl_arguments_copy (const rcl_arguments_t *args, rcl_arguments_t *args_out)
 Copy one arguments structure into another. More...
 
rcl_ret_t rcl_arguments_fini (rcl_arguments_t *args)
 Reclaim resources held inside rcl_arguments_t structure. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_fully_qualified_namespace (rcl_lexer_lookahead2_t *lex_lookahead)
 Parses a fully qualified namespace for a namespace replacement rule (ex: /foo/bar) More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_replacement_token (rcl_lexer_lookahead2_t *lex_lookahead)
 Parse either a token or a backreference (ex: bar, or \7). More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_replacement_name (rcl_lexer_lookahead2_t *lex_lookahead, rcl_remap_t *rule)
 Parse the replacement side of a name remapping rule (ex: bar/\1/foo). More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_resource_match_token (rcl_lexer_lookahead2_t *lex_lookahead)
 Parse either a resource name token or a wildcard (ex: foobar, or *, or **). More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_resource_match (rcl_lexer_lookahead2_t *lex_lookahead, rcl_allocator_t allocator, char **resource_match)
 Parse a resource name match side of a rule (ex: rostopic://foo) More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_param_name (rcl_lexer_lookahead2_t *lex_lookahead, rcl_allocator_t allocator, char **param_name)
 Parse a parameter name in a parameter override rule (ex: foo.bar) More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_match_name (rcl_lexer_lookahead2_t *lex_lookahead, rcl_remap_t *rule)
 Parse the match side of a name remapping rule (ex: rostopic://foo) More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_name_remap (rcl_lexer_lookahead2_t *lex_lookahead, rcl_remap_t *rule)
 Parse a name remapping rule (ex: rostopic:///foo:=bar). More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_namespace_replacement (rcl_lexer_lookahead2_t *lex_lookahead, rcl_remap_t *rule)
 Parse a namespace replacement rule (ex: __ns:=/new/ns). More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_nodename_replacement (rcl_lexer_lookahead2_t *lex_lookahead, rcl_remap_t *rule)
 Parse a nodename replacement rule (ex: __node:=new_name). More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_nodename_prefix (rcl_lexer_lookahead2_t *lex_lookahead, rcl_allocator_t allocator, char **node_name)
 Parse a nodename prefix including trailing colon (ex: node_name:). More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_nodename_prefix (rcl_lexer_lookahead2_t *lex_lookahead, rcl_remap_t *rule)
 Parse a nodename prefix for a remap rule. More...
 
RCL_LOCAL rcl_ret_t _rcl_parse_remap_begin_remap_rule (rcl_lexer_lookahead2_t *lex_lookahead, rcl_remap_t *rule)
 Start recursive descent parsing of a remap rule. More...
 

Macro Definition Documentation

◆ RCL_ENABLE_FLAG_PREFIX

#define RCL_ENABLE_FLAG_PREFIX   "--enable-"

◆ RCL_DISABLE_FLAG_PREFIX

#define RCL_DISABLE_FLAG_PREFIX   "--disable-"

Function Documentation

◆ _rcl_parse_remap_rule()

rcl_ret_t _rcl_parse_remap_rule ( const char *  arg,
rcl_allocator_t  allocator,
rcl_remap_t output_rule 
)

// Internal Doxygen documentation

Parse an argument that may or may not be a remap rule.

Parameters
[in]argthe argument to parse
[in]allocatoran allocator to use
[in,out]output_ruleinput a zero intialized rule, output a fully initialized one
Returns
RCL_RET_OK if a valid rule was parsed, or
RCL_RET_INVALID_REMAP_RULE if the argument is not a valid rule, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.

◆ _rcl_parse_param_rule()

rcl_ret_t _rcl_parse_param_rule ( const char *  arg,
rcl_params_t *  params 
)

Parse an argument that may or may not be a param rule.

Parameters
[in]argthe argument to parse
[in,out]paramsparam overrides structure to populate. This structure must have been initialized by the caller.
Returns
RCL_RET_OK if a valid rule was parsed, or
RCL_RET_INVALID_ARGUMENT if an argument is invalid, or
RCL_RET_INVALID_PARAM_RULE if the argument is not a valid rule, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.

◆ 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.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]argumentsAn arguments structure that has been parsed.
[in]allocatorA valid allocator.
[out]parameter_filesAn allocated array of paramter file names. This array must be deallocated by the caller using the given allocator. The output is NULL if there were no paramter files.
Returns
RCL_RET_OK if everything goes correctly, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ 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.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]argsAn arguments structure that has been parsed.
Returns
number of yaml files, or
-1 if args is NULL or zero initialized.

◆ 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.

Parameter overrides are parsed directly from command line arguments and parameter files provided in the command line.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]argumentsAn arguments structure that has been parsed.
[out]parameter_overridesParameter overrides as parsed from command line arguments. This structure must be finalized by the caller. The output is NULL if no parameter overrides were parsed.
Returns
RCL_RET_OK if everything goes correctly, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ _rcl_parse_log_level()

rcl_ret_t _rcl_parse_log_level ( const char *  arg,
rcl_allocator_t  allocator,
int *  log_level 
)

Parse an argument that may or may not be a log level rule.

Parameters
[in]argthe argument to parse
[in]allocatoran allocator to use
[in,out]log_levelparsed log level represented by RCUTILS_LOG_SEVERITY enum
Returns
RCL_RET_OK if a valid log level was parsed, or
RCL_RET_INVALID_LOG_LEVEL if the argument is not a valid rule, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.

◆ _rcl_parse_log_level_rule()

rcl_ret_t _rcl_parse_log_level_rule ( const char *  arg,
rcl_allocator_t  allocator,
int *  log_level 
)

Parse an argument that may or may not be a log level rule.

Parameters
[in]argthe argument to parse
[in]allocatoran allocator to use
[in,out]log_levelparsed log level represented by RCUTILS_LOG_SEVERITY enum
Returns
RCL_RET_OK if a valid log level was parsed, or
RCL_RET_INVALID_LOG_LEVEL_RULE if the argument is not a valid rule, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.
Deprecated:
to be removed in F-Turtle

◆ _rcl_parse_external_log_config_file()

rcl_ret_t _rcl_parse_external_log_config_file ( const char *  arg,
rcl_allocator_t  allocator,
char **  log_config_file 
)

Parse an argument that may or may not be a log configuration file.

Parameters
[in]argthe argument to parse
[in]allocatoran allocator to use
[in,out]log_config_fileparsed log configuration file
Returns
RCL_RET_OK if a valid log config file was parsed, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.

◆ _rcl_parse_external_log_config_file_rule()

rcl_ret_t _rcl_parse_external_log_config_file_rule ( const char *  arg,
rcl_allocator_t  allocator,
char **  log_config_file 
)

Parse an argument that may or may not be a log file rule.

Parameters
[in]argthe argument to parse
[in]allocatoran allocator to use
[in,out]log_config_fileparsed log configuration file
Returns
RCL_RET_OK if a valid log config file was parsed, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.
Deprecated:
to be removed in F-Turtle

◆ _rcl_parse_param_file()

rcl_ret_t _rcl_parse_param_file ( const char *  arg,
rcl_allocator_t  allocator,
rcl_params_t *  params,
char **  param_file 
)

Parse an argument that may or may not be a parameter file.

The syntax of the file name is not validated.

Parameters
[in]argthe argument to parse
[in]allocatoran allocator to use
[in,out]param_filestring that could be a parameter file name
Returns
RCL_RET_OK if the rule was parsed correctly, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.

◆ _rcl_parse_param_file_rule()

rcl_ret_t _rcl_parse_param_file_rule ( const char *  arg,
rcl_allocator_t  allocator,
rcl_params_t *  params,
char **  param_file 
)

Parse an argument that may or may not be a parameter file rule.

The syntax of the file name is not validated.

Parameters
[in]argthe argument to parse
[in]allocatoran allocator to use
[in,out]param_filestring that could be a parameter file name
Returns
RCL_RET_OK if the rule was parsed correctly, or
RCL_RET_INVALID_PARAM_RULE if the argument is not a valid rule, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.
Deprecated:
to be removed in F-Turtle

◆ _rcl_parse_disabling_flag()

rcl_ret_t _rcl_parse_disabling_flag ( const char *  arg,
const char *  key,
bool *  value 
)

Parse a bool argument that may or may not be for the provided key rule.

Parameters
[in]argthe argument to parse
[in]keythe key for the argument to parse. Should be a null terminated string
[in,out]valueparsed boolean value
Returns
RCL_RET_OK if the bool argument was parsed successfully, or
RLC_RET_ERROR if an unspecified error occurred.

◆ _rcl_parse_bool_arg()

rcl_ret_t _rcl_parse_bool_arg ( const char *  arg,
const char *  key,
bool *  value 
)

Parse a bool argument that may or may not be for the provided key rule.

Parameters
[in]argthe argument to parse
[in]keythe key for the argument to parse. Should be a null terminated string
[in,out]valueparsed boolean value
Returns
RCL_RET_OK if the bool argument was parsed successfully, or
RLC_RET_ERROR if an unspecified error occurred.
Deprecated:
to be removed in F-Turtle

◆ _atob()

rcl_ret_t _atob ( const char *  str,
bool *  val 
)

Parse a null terminated string to a boolean value.

The case sensitive values: "T", "t", "True", "true", "Y", "y", "Yes", "yes", and "1" will all map to true. The case sensitive values: "F", "f", "False", "false", "N", "n", "No", "no", and "0" will all map to false.

Parameters
[in]stra null terminated string to be parsed into a boolean
[in,out]valthe boolean value parsed from the string. Left unchanged if string cannot be parsed to a valid bool.
Returns
RCL_RET_OK if a valid boolean parsed, or
RLC_RET_ERROR if an unspecified error occurred.
Deprecated:
to be removed in F-Turtle

◆ 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.

See also
rcl_get_zero_initialized_arguments()

ROS arguments are expected to be scoped by a leading --ros-args flag and a trailing double dash token -- which may be elided if no non-ROS arguments follow after the last --ros-args.

Remap rule parsing is supported via -r/--remap flags e.g. --remap from:=to or -r from:=to. Successfully parsed remap rules are stored in the order they were given in argv. If given arguments {"__ns:=/foo", "__ns:=/bar"} then the namespace used by nodes in this process will be /foo and not /bar.

See also
rcl_remap_topic_name()
rcl_remap_service_name()
rcl_remap_node_name()
rcl_remap_node_namespace()

Parameter override rule parsing is supported via -p/--param flags e.g. --param name:=value or -p name:=value.

The default log level will be parsed as --log-level level, where level is a name representing one of the log levels in the RCUTILS_LOG_SEVERITY enum, e.g. info, debug, warn, not case sensitive. If multiple of these rules are found, the last one parsed will be used.

If an argument does not appear to be a valid ROS argument e.g. a -r/--remap flag followed by anything but a valid remap rule, parsing will fail immediately.

If an argument does not appear to be a known ROS argument, then it is skipped and left unparsed.

See also
rcl_arguments_get_count_unparsed_ros()
rcl_arguments_get_unparsed_ros()

All arguments found outside a --ros-args ... -- scope are skipped and left unparsed.

See also
rcl_arguments_get_count_unparsed()
rcl_arguments_get_unparsed()

Attribute Adherence
Allocates Memory Yes
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Parameters
[in]argcThe number of arguments in argv.
[in]argvThe values of the arguments.
[in]allocatorA valid allocator.
[out]args_outputA structure that will contain the result of parsing. Must be zero initialized before use.
Returns
RCL_RET_OK if the arguments were parsed successfully, or
RCL_RET_INVALID_ROS_ARGS if an invalid ROS argument is found, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ 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.


Attribute Adherence
Allocates Memory No
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Parameters
[in]argsAn arguments structure that has been parsed.
Returns
number of unparsed arguments, or
-1 if args is NULL or zero initialized.

◆ 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.

Non ROS specific arguments may have been provided i.e. arguments outside a '–ros-args' scope. This function populates an array of indices to these arguments in the original argv array. Since the first argument is always assumed to be a process name, the list will always contain the index 0.


Attribute Adherence
Allocates Memory Yes
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Parameters
[in]argsAn arguments structure that has been parsed.
[in]allocatorA valid allocator.
[out]output_unparsed_indicesAn allocated array of indices into the original argv array. This array must be deallocated by the caller using the given allocator. If there are no unparsed args then the output will be set to NULL.
Returns
RCL_RET_OK if everything goes correctly, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ 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.


Attribute Adherence
Allocates Memory No
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Parameters
[in]argsAn arguments structure that has been parsed.
Returns
number of unparsed ROS specific arguments, or
-1 if args is NULL or zero initialized.

◆ 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.

Some ROS specific arguments may not have been recognized, or were not intended to be parsed by rcl. This function populates an array of indices to these arguments in the original argv array.


Attribute Adherence
Allocates Memory Yes
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Parameters
[in]argsAn arguments structure that has been parsed.
[in]allocatorA valid allocator.
[out]output_unparsed_indicesAn allocated array of indices into the original argv array. This array must be deallocated by the caller using the given allocator. If there are no unparsed ROS specific arguments then the output will be set to NULL.
Returns
RCL_RET_OK if everything goes correctly, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ 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.

◆ 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.

Some arguments may not have been intended as ROS arguments. This function populates an array of the aruments in a new argv array. Since the first argument is always assumed to be a process name, the list will always contain the first value from the argument vector.


Attribute Adherence
Allocates Memory Yes
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Parameters
[in]argvThe argument vector
[in]argsAn arguments structure that has been parsed.
[in]allocatorA valid allocator.
[out]nonros_argcThe count of arguments that aren't ROS-specific
[out]nonros_argvAn allocated array of arguments that aren't ROS-specific This array must be deallocated by the caller using the given allocator. If there are no non-ROS args, then the output will be set to NULL.
Returns
RCL_RET_OK if everything goes correctly, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ 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.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]argsThe structure to be copied. Its allocator is used to copy memory into the new structure.
[out]args_outA zero-initialized arguments structure to be copied into.
Returns
RCL_RET_OK if the structure was copied successfully, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_ERROR if an unspecified error occurs.

◆ rcl_arguments_fini()

rcl_ret_t rcl_arguments_fini ( rcl_arguments_t args)

Reclaim resources held inside rcl_arguments_t structure.


Attribute Adherence
Allocates Memory No
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Parameters
[in]argsThe structure to be deallocated.
Returns
RCL_RET_OK if the memory was successfully freed, or
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
RCL_RET_ERROR if an unspecified error occurs.

◆ _rcl_parse_remap_fully_qualified_namespace()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_fully_qualified_namespace ( rcl_lexer_lookahead2_t lex_lookahead)

Parses a fully qualified namespace for a namespace replacement rule (ex: /foo/bar)

See also
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_remap_replacement_token()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_replacement_token ( rcl_lexer_lookahead2_t lex_lookahead)

Parse either a token or a backreference (ex: bar, or \7).

See also
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_remap_replacement_name()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_replacement_name ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_remap_t rule 
)

Parse the replacement side of a name remapping rule (ex: bar/\1/foo).

See also
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_resource_match_token()

RCL_LOCAL rcl_ret_t _rcl_parse_resource_match_token ( rcl_lexer_lookahead2_t lex_lookahead)

Parse either a resource name token or a wildcard (ex: foobar, or *, or **).

See also
_rcl_parse_resource_match()

◆ _rcl_parse_resource_match()

RCL_LOCAL rcl_ret_t _rcl_parse_resource_match ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_allocator_t  allocator,
char **  resource_match 
)

Parse a resource name match side of a rule (ex: rostopic://foo)

See also
_rcl_parse_remap_match_name()

◆ _rcl_parse_param_name()

RCL_LOCAL rcl_ret_t _rcl_parse_param_name ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_allocator_t  allocator,
char **  param_name 
)

Parse a parameter name in a parameter override rule (ex: foo.bar)

See also
_rcl_parse_param_rule()

◆ _rcl_parse_remap_match_name()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_match_name ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_remap_t rule 
)

Parse the match side of a name remapping rule (ex: rostopic://foo)

See also
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_remap_name_remap()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_name_remap ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_remap_t rule 
)

Parse a name remapping rule (ex: rostopic:///foo:=bar).

See also
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_remap_namespace_replacement()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_namespace_replacement ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_remap_t rule 
)

Parse a namespace replacement rule (ex: __ns:=/new/ns).

See also
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_remap_nodename_replacement()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_nodename_replacement ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_remap_t rule 
)

Parse a nodename replacement rule (ex: __node:=new_name).

See also
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_nodename_prefix()

RCL_LOCAL rcl_ret_t _rcl_parse_nodename_prefix ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_allocator_t  allocator,
char **  node_name 
)

Parse a nodename prefix including trailing colon (ex: node_name:).

◆ _rcl_parse_remap_nodename_prefix()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_nodename_prefix ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_remap_t rule 
)

Parse a nodename prefix for a remap rule.

See also
_rcl_parse_nodename_prefix()
_rcl_parse_remap_begin_remap_rule()

◆ _rcl_parse_remap_begin_remap_rule()

RCL_LOCAL rcl_ret_t _rcl_parse_remap_begin_remap_rule ( rcl_lexer_lookahead2_t lex_lookahead,
rcl_remap_t rule 
)

Start recursive descent parsing of a remap rule.

Parameters
[in]lex_lookaheada lookahead(2) buffer for the parser to use.
[in,out]ruleinput a zero intialized rule, output a fully initialized one.
Returns
RCL_RET_OK if a valid rule was parsed, or
RCL_RET_INVALID_REMAP_RULE if the argument is not a valid rule, or
RCL_RET_BAD_ALLOC if an allocation failed, or
RLC_RET_ERROR if an unspecified error occurred.