22 #include "./arguments_impl.h"
23 #include "./remap_impl.h"
24 #include "rcl/error_handling.h"
27 #include "rcl_yaml_param_parser/parser.h"
28 #include "rcl_yaml_param_parser/types.h"
29 #include "rcutils/allocator.h"
30 #include "rcutils/error_handling.h"
31 #include "rcutils/format_string.h"
32 #include "rcutils/logging.h"
33 #include "rcutils/logging_macros.h"
34 #include "rcutils/strdup.h"
35 #include "rmw/validate_namespace.h"
36 #include "rmw/validate_node_name.h"
55 _rcl_parse_remap_rule(
72 _rcl_parse_param_rule(
74 rcl_params_t * params);
80 char *** parameter_files)
86 *(parameter_files) = allocator.allocate(
88 if (NULL == *parameter_files) {
93 if (NULL == (*parameter_files)[i]) {
95 for (
int r = i; r >= 0; --r) {
96 allocator.deallocate((*parameter_files)[r], allocator.state);
98 allocator.deallocate((*parameter_files), allocator.state);
99 (*parameter_files) = NULL;
110 if (NULL == args || NULL == args->
impl) {
119 rcl_params_t ** parameter_overrides)
125 if (NULL != *parameter_overrides) {
126 RCL_SET_ERROR_MSG(
"Output parameter override pointer is not null. May leak memory.");
129 *parameter_overrides = NULL;
132 if (NULL == *parameter_overrides) {
164 _rcl_parse_log_level(
179 _rcl_parse_external_log_config_file(
182 char ** log_config_file);
197 _rcl_parse_param_file(
200 rcl_params_t * params,
219 #define RCL_ENABLE_FLAG_PREFIX "--enable-"
220 #define RCL_DISABLE_FLAG_PREFIX "--disable-"
232 _rcl_parse_disabling_flag(
250 const char *
const * argv,
256 RCL_SET_ERROR_MSG(
"Argument count cannot be negative");
258 }
else if (argc > 0) {
263 if (args_output->
impl != NULL) {
264 RCL_SET_ERROR_MSG(
"Parse output is not zero-initialized");
271 ret = _rcl_allocate_initialized_arguments_impl(args_output, &allocator);
295 args_impl->
parameter_files = allocator.allocate(
sizeof(
char *) * argc, allocator.state);
300 args_impl->
unparsed_ros_args = allocator.allocate(
sizeof(
int) * argc, allocator.state);
305 args_impl->
unparsed_args = allocator.allocate(
sizeof(
int) * argc, allocator.state);
317 bool parsing_ros_args =
false;
318 for (
int i = 0; i < argc; ++i) {
319 if (parsing_ros_args) {
327 parsing_ros_args =
false;
336 RCUTILS_LOG_DEBUG_NAMED(
337 ROS_PACKAGE_NAME,
"Got param override rule : %s\n", argv[i + 1]);
341 rcl_error_string_t prev_error_string = rcl_get_error_string();
343 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
344 "Couldn't parse parameter override rule: '%s %s'. Error: %s", argv[i], argv[i + 1],
345 prev_error_string.str);
347 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
348 "Couldn't parse trailing %s flag. No parameter override rule found.", argv[i]);
353 RCUTILS_LOG_DEBUG_NAMED(
354 ROS_PACKAGE_NAME,
"Arg %d (%s) is not a %s nor a %s flag.",
363 if (
RCL_RET_OK == _rcl_parse_remap_rule(argv[i + 1], allocator, rule)) {
365 RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME,
"Got remap rule : %s\n", argv[i + 1]);
369 rcl_error_string_t prev_error_string = rcl_get_error_string();
371 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
372 "Couldn't parse remap rule: '%s %s'. Error: %s", argv[i], argv[i + 1],
373 prev_error_string.str);
375 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
376 "Couldn't parse trailing %s flag. No remap rule found.", argv[i]);
381 RCUTILS_LOG_DEBUG_NAMED(
382 ROS_PACKAGE_NAME,
"Arg %d (%s) is not a %s nor a %s flag.",
396 RCUTILS_LOG_DEBUG_NAMED(
398 "Got params file : %s\ntotal num param files %d",
404 rcl_error_string_t prev_error_string = rcl_get_error_string();
406 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
407 "Couldn't parse params file: '%s %s'. Error: %s", argv[i], argv[i + 1],
408 prev_error_string.str);
410 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
411 "Couldn't parse trailing %s flag. No file path provided.", argv[i]);
416 RCUTILS_LOG_DEBUG_NAMED(
417 ROS_PACKAGE_NAME,
"Arg %d (%s) is not a %s flag.",
424 _rcl_parse_log_level(argv[i + 1], &args_impl->
log_levels))
426 RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME,
"Got log level: %s\n", argv[i + 1]);
430 rcl_error_string_t prev_error_string = rcl_get_error_string();
432 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
433 "Couldn't parse log level: '%s %s'. Error: %s", argv[i], argv[i + 1],
434 prev_error_string.str);
436 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
437 "Couldn't parse trailing log level flag: '%s'. No log level provided.", argv[i]);
442 RCUTILS_LOG_DEBUG_NAMED(
443 ROS_PACKAGE_NAME,
"Arg %d (%s) is not a %s flag.",
450 RCUTILS_LOG_DEBUG_NAMED(
451 ROS_PACKAGE_NAME,
"Overriding log configuration file : %s\n",
456 if (
RCL_RET_OK == _rcl_parse_external_log_config_file(
459 RCUTILS_LOG_DEBUG_NAMED(
460 ROS_PACKAGE_NAME,
"Got log configuration file : %s\n",
465 rcl_error_string_t prev_error_string = rcl_get_error_string();
467 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
468 "Couldn't parse log configuration file: '%s %s'. Error: %s", argv[i], argv[i + 1],
469 prev_error_string.str);
471 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
472 "Couldn't parse trailing %s flag. No file path provided.", argv[i]);
481 if (NULL != args_impl->
enclave) {
482 RCUTILS_LOG_DEBUG_NAMED(
483 ROS_PACKAGE_NAME,
"Overriding security enclave : %s\n",
485 allocator.deallocate(args_impl->
enclave, allocator.state);
489 argv[i + 1], allocator, &args_impl->
enclave))
491 RCUTILS_LOG_DEBUG_NAMED(
492 ROS_PACKAGE_NAME,
"Got enclave: %s\n",
497 rcl_error_string_t prev_error_string = rcl_get_error_string();
499 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
500 "Couldn't parse enclave name: '%s %s'. Error: %s", argv[i], argv[i + 1],
501 prev_error_string.str);
503 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
504 "Couldn't parse trailing %s flag. No enclave path provided.", argv[i]);
510 RCUTILS_LOG_DEBUG_NAMED(
511 ROS_PACKAGE_NAME,
"Arg %d (%s) is not a %s flag.",
515 ret = _rcl_parse_disabling_flag(
518 RCUTILS_LOG_DEBUG_NAMED(
519 ROS_PACKAGE_NAME,
"Disable log stdout ? %s\n",
523 RCUTILS_LOG_DEBUG_NAMED(
525 "Couldn't parse arg %d (%s) as %s%s or %s%s flag. Error: %s",
531 ret = _rcl_parse_disabling_flag(
534 RCUTILS_LOG_DEBUG_NAMED(
535 ROS_PACKAGE_NAME,
"Disable log rosout ? %s\n",
539 RCUTILS_LOG_DEBUG_NAMED(
541 "Couldn't parse arg %d (%s) as %s%s or %s%s flag. Error: %s",
547 ret = _rcl_parse_disabling_flag(
550 RCUTILS_LOG_DEBUG_NAMED(
551 ROS_PACKAGE_NAME,
"Disable log external lib ? %s\n",
555 RCUTILS_LOG_DEBUG_NAMED(
557 "Couldn't parse arg %d (%s) as %s%s or %s%s flag. Error: %s",
568 parsing_ros_args =
true;
575 if (
RCL_RET_OK == _rcl_parse_remap_rule(argv[i], allocator, rule)) {
576 RCUTILS_LOG_WARN_NAMED(
578 "Found remap rule '%s'. This syntax is deprecated. Use '%s %s %s' instead.",
580 RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME,
"Got remap rule : %s\n", argv[i + 1]);
584 RCUTILS_LOG_DEBUG_NAMED(
586 "Couldn't parse arg %d (%s) as a remap rule in its deprecated form. Error: %s",
587 i, argv[i], rcl_get_error_string().str);
599 allocator.deallocate(args_impl->
remap_rules, allocator.state);
602 rcl_remap_t * new_remap_rules = allocator.reallocate(
606 if (NULL == new_remap_rules) {
618 char ** new_parameter_files = allocator.reallocate(
622 if (NULL == new_parameter_files) {
652 allocator.deallocate(args_impl->
unparsed_args, allocator.state);
672 if (NULL != args_impl) {
675 RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME,
"Failed to fini arguments after earlier failure");
685 if (NULL == args || NULL == args->
impl) {
695 int ** output_unparsed_indices)
702 *output_unparsed_indices = NULL;
704 *output_unparsed_indices = allocator.allocate(
706 if (NULL == *output_unparsed_indices) {
720 if (NULL == args || NULL == args->
impl) {
730 int ** output_unparsed_ros_indices)
737 *output_unparsed_ros_indices = NULL;
739 *output_unparsed_ros_indices = allocator.allocate(
741 if (NULL == *output_unparsed_ros_indices) {
757 return default_arguments;
762 const char *
const * argv,
766 const char *** nonros_argv)
772 if (NULL != *nonros_argv) {
773 RCL_SET_ERROR_MSG(
"Output nonros_argv pointer is not null. May leak memory.");
778 if (*nonros_argc < 0) {
779 RCL_SET_ERROR_MSG(
"Failed to get unparsed non ROS specific arguments count.");
781 }
else if (*nonros_argc > 0) {
786 if (0 == *nonros_argc) {
790 int * unparsed_indices = NULL;
797 size_t alloc_size =
sizeof(
char *) * *nonros_argc;
798 *nonros_argv = allocator.allocate(alloc_size, allocator.state);
799 if (NULL == *nonros_argv) {
800 allocator.deallocate(unparsed_indices, allocator.state);
803 for (
int i = 0; i < *nonros_argc; ++i) {
804 (*nonros_argv)[i] = argv[unparsed_indices[i]];
807 allocator.deallocate(unparsed_indices, allocator.state);
822 if (NULL != args_out->
impl) {
823 RCL_SET_ERROR_MSG(
"args_out must be zero initialized");
829 rcl_ret_t ret = _rcl_allocate_initialized_arguments_impl(args_out, &allocator);
840 RCL_SET_ERROR_MSG(
"Error while finalizing arguments due to another error");
856 RCL_SET_ERROR_MSG(
"Error while finalizing arguments due to another error");
872 RCL_SET_ERROR_MSG(
"Error while finalizing arguments due to another error");
882 RCL_SET_ERROR_MSG(
"Error while finalizing arguments due to another error");
902 RCL_SET_ERROR_MSG(
"Error while finalizing arguments due to another error");
911 RCL_SET_ERROR_MSG(
"Error while finalizing arguments due to another error");
918 char * enclave_copy = rcutils_strdup(args->
impl->
enclave, allocator);
921 RCL_SET_ERROR_MSG(
"Error while finalizing arguments due to another error");
923 RCL_SET_ERROR_MSG(
"Error while copying enclave argument");
943 RCUTILS_LOG_ERROR_NAMED(
945 "Failed to finalize remap rule while finalizing arguments. Continuing...");
955 ret = log_levels_ret;
956 RCUTILS_LOG_ERROR_NAMED(
958 "Failed to finalize log levels while finalizing arguments. Continuing...");
995 RCL_SET_ERROR_MSG(
"rcl_arguments_t finalized twice");
1005 _rcl_parse_remap_fully_qualified_namespace(
1011 assert(NULL != lex_lookahead);
1047 assert(NULL != lex_lookahead);
1059 RCL_SET_ERROR_MSG(
"Backreferences are not implemented");
1076 _rcl_parse_remap_replacement_name(
1084 assert(NULL != lex_lookahead);
1085 assert(NULL != rule);
1088 if (NULL == replacement_start) {
1089 RCL_SET_ERROR_MSG(
"failed to get start of replacement");
1106 ret = _rcl_parse_remap_replacement_token(lex_lookahead);
1119 ret = _rcl_parse_remap_replacement_token(lex_lookahead);
1131 size_t length = (size_t)(replacement_end - replacement_start);
1135 RCL_SET_ERROR_MSG(
"failed to copy replacement");
1154 assert(NULL != lex_lookahead);
1164 RCL_SET_ERROR_MSG(
"Wildcard '*' is not implemented");
1167 RCL_SET_ERROR_MSG(
"Wildcard '**' is not implemented");
1170 RCL_SET_ERROR_MSG(
"Expecting token or wildcard");
1183 _rcl_parse_resource_match(
1186 char ** resource_match)
1192 assert(NULL != lex_lookahead);
1193 assert(rcutils_allocator_is_valid(&allocator));
1194 assert(NULL != resource_match);
1195 assert(NULL == *resource_match);
1198 if (NULL == match_start) {
1199 RCL_SET_ERROR_MSG(
"failed to get start of match");
1216 ret = _rcl_parse_resource_match_token(lex_lookahead);
1229 ret = _rcl_parse_resource_match_token(lex_lookahead);
1241 const size_t length = (size_t)(match_end - match_start);
1242 *resource_match = rcutils_strndup(match_start, length, allocator);
1243 if (NULL == *resource_match) {
1244 RCL_SET_ERROR_MSG(
"failed to copy match");
1259 assert(NULL != lex_lookahead);
1267 RCL_SET_ERROR_MSG(
"Wildcard '*' is not implemented");
1270 RCL_SET_ERROR_MSG(
"Wildcard '**' is not implemented");
1273 RCL_SET_ERROR_MSG(
"Expecting token or wildcard");
1298 _rcl_parse_param_name(
1307 assert(NULL != lex_lookahead);
1308 assert(rcutils_allocator_is_valid(&allocator));
1309 assert(NULL != param_name);
1310 assert(NULL == *param_name);
1313 if (NULL == name_start) {
1314 RCL_SET_ERROR_MSG(
"failed to get start of param name");
1319 ret = _rcl_parse_param_name_token(lex_lookahead);
1332 ret = _rcl_parse_param_name_token(lex_lookahead);
1344 const size_t length = (size_t)(name_end - name_start);
1345 *param_name = rcutils_strndup(name_start, length, allocator);
1346 if (NULL == *param_name) {
1347 RCL_SET_ERROR_MSG(
"failed to copy param name");
1361 _rcl_parse_remap_match_name(
1369 assert(NULL != lex_lookahead);
1370 assert(NULL != rule);
1378 rule->
impl->
type = RCL_SERVICE_REMAP;
1381 rule->
impl->
type = RCL_TOPIC_REMAP;
1384 rule->
impl->
type = (RCL_TOPIC_REMAP | RCL_SERVICE_REMAP);
1390 ret = _rcl_parse_resource_match(
1404 _rcl_parse_remap_name_remap(
1411 assert(NULL != lex_lookahead);
1412 assert(NULL != rule);
1415 ret = _rcl_parse_remap_match_name(lex_lookahead, rule);
1425 ret = _rcl_parse_remap_replacement_name(lex_lookahead, rule);
1439 _rcl_parse_remap_namespace_replacement(
1446 assert(NULL != lex_lookahead);
1447 assert(NULL != rule);
1461 if (NULL == ns_start) {
1462 RCL_SET_ERROR_MSG(
"failed to get start of namespace");
1465 ret = _rcl_parse_remap_fully_qualified_namespace(lex_lookahead);
1469 RCUTILS_LOG_WARN_NAMED(
1470 ROS_PACKAGE_NAME,
"Namespace not remapped to a fully qualified name (found: %s)", ns_start);
1478 RCUTILS_LOG_WARN_NAMED(
1479 ROS_PACKAGE_NAME,
"Namespace not remapped to a fully qualified name (found: %s)", ns_start);
1485 size_t length = (size_t)(ns_end - ns_start);
1488 RCL_SET_ERROR_MSG(
"failed to copy namespace");
1492 rule->
impl->
type = RCL_NAMESPACE_REMAP;
1502 _rcl_parse_remap_nodename_replacement(
1507 const char * node_name;
1511 assert(NULL != lex_lookahead);
1512 assert(NULL != rule);
1528 RCUTILS_LOG_WARN_NAMED(
1529 ROS_PACKAGE_NAME,
"Node name not remapped to invalid name: '%s'", node_name);
1538 RCL_SET_ERROR_MSG(
"failed to allocate node name");
1542 rule->
impl->
type = RCL_NODENAME_REMAP;
1549 _rcl_parse_nodename_prefix(
1555 const char * token = NULL;
1558 assert(NULL != lex_lookahead);
1559 assert(rcutils_allocator_is_valid(&allocator));
1560 assert(NULL != node_name);
1561 assert(NULL == *node_name);
1575 *node_name = rcutils_strndup(token, length, allocator);
1576 if (NULL == *node_name) {
1577 RCL_SET_ERROR_MSG(
"failed to allocate node name");
1591 _rcl_parse_remap_nodename_prefix(
1596 assert(NULL != lex_lookahead);
1597 assert(NULL != rule);
1599 rcl_ret_t ret = _rcl_parse_nodename_prefix(
1618 _rcl_parse_remap_begin_remap_rule(
1627 assert(NULL != lex_lookahead);
1628 assert(NULL != rule);
1636 ret = _rcl_parse_remap_nodename_prefix(lex_lookahead, rule);
1649 ret = _rcl_parse_remap_nodename_replacement(lex_lookahead, rule);
1654 ret = _rcl_parse_remap_namespace_replacement(lex_lookahead, rule);
1659 ret = _rcl_parse_remap_name_remap(lex_lookahead, rule);
1675 _rcl_parse_log_level_name(
1678 char ** logger_name)
1683 assert(NULL != lex_lookahead);
1684 assert(rcutils_allocator_is_valid(allocator));
1685 assert(NULL != logger_name);
1686 assert(NULL == *logger_name);
1689 if (NULL == name_start) {
1690 RCL_SET_ERROR_MSG(
"failed to get start of logger name");
1718 const size_t length = (size_t)(name_end - name_start);
1719 *logger_name = rcutils_strndup(name_start, length, *allocator);
1720 if (NULL == *logger_name) {
1721 RCL_SET_ERROR_MSG(
"failed to copy logger name");
1729 _rcl_parse_log_level(
1740 char * logger_name = NULL;
1742 rcutils_ret_t rcutils_ret = RCUTILS_RET_OK;
1751 ret = _rcl_parse_log_level_name(&lex_lookahead, allocator, &logger_name);
1753 if (strlen(logger_name) == 0) {
1754 RCL_SET_ERROR_MSG(
"Argument has an invalid logger item that name is empty");
1765 const char * level_token;
1766 size_t level_token_length;
1780 rcutils_ret = rcutils_logging_severity_level_from_string(
1781 level_token, *allocator, &level);
1782 if (RCUTILS_RET_OK == rcutils_ret) {
1790 rcutils_ret = rcutils_logging_severity_level_from_string(
1791 arg, *allocator, &level);
1792 if (RCUTILS_RET_OK == rcutils_ret) {
1795 RCUTILS_LOG_DEBUG_NAMED(
1796 ROS_PACKAGE_NAME,
"Minimum default log level will be replaced from %d to %d",
1805 if (RCUTILS_RET_OK != rcutils_ret) {
1806 RCL_SET_ERROR_MSG(
"Argument does not use a valid severity level");
1812 allocator->deallocate(logger_name, allocator->state);
1817 RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME,
"Failed to fini lookahead2 after error occurred");
1827 _rcl_parse_remap_rule(
1837 if (NULL == output_rule->
impl) {
1841 output_rule->
impl->
type = RCL_UNKNOWN_REMAP;
1850 ret = _rcl_parse_remap_begin_remap_rule(&lex_lookahead, output_rule);
1855 RCUTILS_LOG_ERROR_NAMED(
1856 ROS_PACKAGE_NAME,
"Failed to fini lookahead2 after error occurred");
1868 RCUTILS_LOG_ERROR_NAMED(
1869 ROS_PACKAGE_NAME,
"Failed to fini remap rule after error occurred");
1876 _rcl_parse_param_rule(
1878 rcl_params_t * params)
1892 char * node_name = NULL;
1893 char * param_name = NULL;
1902 ret = _rcl_parse_nodename_prefix(&lex_lookahead, params->allocator, &node_name);
1910 node_name = rcutils_strdup(
"/**", params->allocator);
1911 if (NULL == node_name) {
1919 ret = _rcl_parse_param_name(&lex_lookahead, params->allocator, ¶m_name);
1934 if (!rcl_parse_yaml_value(node_name, param_name, yaml_value, params)) {
1940 params->allocator.deallocate(param_name, params->allocator.state);
1941 params->allocator.deallocate(node_name, params->allocator.state);
1944 RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME,
"Failed to fini lookahead2 after error occurred");
1953 _rcl_parse_param_file(
1956 rcl_params_t * params,
1962 *param_file = rcutils_strdup(arg, allocator);
1963 if (NULL == *param_file) {
1964 RCL_SET_ERROR_MSG(
"Failed to allocate memory for parameters file path");
1967 if (!rcl_parse_yaml_file(*param_file, params)) {
1968 allocator.deallocate(*param_file, allocator.state);
1977 _rcl_parse_external_log_config_file(
1980 char ** log_config_file)
1985 *log_config_file = rcutils_strdup(arg, allocator);
1987 if (NULL == *log_config_file) {
1988 RCL_SET_ERROR_MSG(
"Failed to allocate memory for external log config file");
2003 *enclave = rcutils_strdup(arg, allocator);
2004 if (NULL == *enclave) {
2005 RCL_SET_ERROR_MSG(
"Failed to allocate memory for enclave name");
2012 _rcl_parse_disabling_flag(
2014 const char * suffix,
2021 const size_t enable_prefix_len = strlen(RCL_ENABLE_FLAG_PREFIX);
2023 strncmp(RCL_ENABLE_FLAG_PREFIX, arg, enable_prefix_len) == 0 &&
2024 strcmp(suffix, arg + enable_prefix_len) == 0)
2030 const size_t disable_prefix_len = strlen(RCL_DISABLE_FLAG_PREFIX);
2032 strncmp(RCL_DISABLE_FLAG_PREFIX, arg, disable_prefix_len) == 0 &&
2033 strcmp(suffix, arg + disable_prefix_len) == 0)
2039 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
2040 "Argument is not a %s%s nor a %s%s flag.",
2041 RCL_ENABLE_FLAG_PREFIX, suffix,
2042 RCL_DISABLE_FLAG_PREFIX, suffix);
2050 if (NULL == args->
impl) {
#define RCL_CHECK_ALLOCATOR_WITH_MSG(allocator, msg, fail_statement)
Check that the given allocator is initialized, or fail with a message.
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
RCL_PUBLIC RCL_WARN_UNUSED 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.
#define RCL_ROS_ARGS_EXPLICIT_END_TOKEN
The token that delineates the explicit end of ROS arguments.
RCL_PUBLIC RCL_WARN_UNUSED int rcl_arguments_get_count_unparsed(const rcl_arguments_t *args)
Return the number of arguments that were not ROS specific arguments.
#define RCL_LOG_LEVEL_FLAG
The ROS flag that precedes the ROS logging level to set.
#define RCL_LOG_ROSOUT_FLAG_SUFFIX
RCL_PUBLIC RCL_WARN_UNUSED 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.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_arguments_copy(const rcl_arguments_t *args, rcl_arguments_t *args_out)
Copy one arguments structure into another.
#define RCL_PARAM_FLAG
The ROS flag that precedes the setting of a ROS parameter.
RCL_PUBLIC RCL_WARN_UNUSED 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.
RCL_PUBLIC RCL_WARN_UNUSED 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.
#define RCL_ROS_ARGS_FLAG
The command-line flag that delineates the start of ROS arguments.
#define RCL_LOG_EXT_LIB_FLAG_SUFFIX
#define RCL_SHORT_PARAM_FLAG
The short version of the ROS flag that precedes the setting of a ROS parameter.
#define RCL_ENCLAVE_FLAG
The ROS flag that precedes the name of a ROS security enclave.
#define RCL_LOG_STDOUT_FLAG_SUFFIX
RCL_PUBLIC RCL_WARN_UNUSED 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.
#define RCL_REMAP_FLAG
The ROS flag that precedes a ROS remapping rule.
#define RCL_EXTERNAL_LOG_CONFIG_FLAG
The ROS flag that precedes the name of a configuration file to configure logging.
#define RCL_SHORT_REMAP_FLAG
The short version of the ROS flag that precedes a ROS remapping rule.
#define RCL_SHORT_ENCLAVE_FLAG
The short version of the ROS flag that precedes the name of a ROS security enclave.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_arguments_fini(rcl_arguments_t *args)
Reclaim resources held inside rcl_arguments_t structure.
RCL_PUBLIC RCL_WARN_UNUSED int rcl_arguments_get_param_files_count(const rcl_arguments_t *args)
Return the number of parameter yaml files given in the arguments.
RCL_PUBLIC RCL_WARN_UNUSED 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.
RCL_PUBLIC RCL_WARN_UNUSED int rcl_arguments_get_count_unparsed_ros(const rcl_arguments_t *args)
Return the number of ROS specific arguments that were not successfully parsed.
#define RCL_PARAM_FILE_FLAG
The ROS flag that precedes a path to a file containing ROS parameters.
RCL_PUBLIC RCL_WARN_UNUSED rcl_arguments_t rcl_get_zero_initialized_arguments(void)
Return a rcl_arguments_t struct with members initialized to NULL.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_remove_ros_arguments(const char *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.
@ RCL_LEXEME_TOKEN
a name between slashes, must match (([a-zA-Z](_)?)|_)([0-9a-zA-Z](_)?)*
@ RCL_LEXEME_EOF
Indicates end of input has been reached.
@ RCL_LEXEME_URL_TOPIC
rostopic://
@ RCL_LEXEME_URL_SERVICE
rosservice://
@ RCL_LEXEME_TILDE_SLASH
~/
@ RCL_LEXEME_FORWARD_SLASH
/
@ RCL_LEXEME_NODE
__node or __name
@ RCL_LEXEME_WILD_MULTI
**
enum rcl_lexeme_e rcl_lexeme_t
Type of lexeme found by lexical analysis.
RCL_PUBLIC RCL_WARN_UNUSED rcl_lexer_lookahead2_t rcl_get_zero_initialized_lexer_lookahead2()
Get a zero initialized rcl_lexer_lookahead2_t instance.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_lexer_lookahead2_fini(rcl_lexer_lookahead2_t *buffer)
Finalize an instance of an rcl_lexer_lookahead2_t structure.
RCL_PUBLIC RCL_WARN_UNUSED const char * rcl_lexer_lookahead2_get_text(const rcl_lexer_lookahead2_t *buffer)
Get the text at the point where it is currently being analyzed.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_lexer_lookahead2_peek2(rcl_lexer_lookahead2_t *buffer, rcl_lexeme_t *next_type1, rcl_lexeme_t *next_type2)
Look ahead at the next two lexemes in the string.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_lexer_lookahead2_accept(rcl_lexer_lookahead2_t *buffer, const char **lexeme_text, size_t *lexeme_text_length)
Accept a lexeme and advance analysis.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_lexer_lookahead2_expect(rcl_lexer_lookahead2_t *buffer, rcl_lexeme_t type, const char **lexeme_text, size_t *lexeme_text_length)
Require the next lexeme to be a certain type and advance analysis.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_lexer_lookahead2_peek(rcl_lexer_lookahead2_t *buffer, rcl_lexeme_t *next_type)
Look ahead at the next lexeme in the string.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_lexer_lookahead2_init(rcl_lexer_lookahead2_t *buffer, const char *text, rcl_allocator_t allocator)
Initialize an rcl_lexer_lookahead2_t instance.
RCL_PUBLIC rcl_ret_t rcl_log_levels_fini(rcl_log_levels_t *log_levels)
Reclaim resources held inside rcl_log_levels_t structure.
enum RCUTILS_LOG_SEVERITY rcl_log_severity_t
typedef for RCUTILS_LOG_SEVERITY;
RCL_PUBLIC RCL_WARN_UNUSED rcl_log_levels_t rcl_get_zero_initialized_log_levels()
Return a rcl_log_levels_t struct with members initialized to zero value.
RCL_PUBLIC rcl_ret_t rcl_log_levels_add_logger_setting(rcl_log_levels_t *log_levels, const char *logger_name, rcl_log_severity_t log_level)
Add logger setting with a name and a level.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_log_levels_init(rcl_log_levels_t *log_levels, const rcl_allocator_t *allocator, size_t logger_count)
Initialize a log levels structure.
RCL_PUBLIC rcl_ret_t rcl_log_levels_shrink_to_size(rcl_log_levels_t *log_levels)
Shrink log levels structure.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_log_levels_copy(const rcl_log_levels_t *src, rcl_log_levels_t *dst)
Copy one log levels structure into another.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_remap_fini(rcl_remap_t *remap)
Reclaim resources held inside rcl_remap_t structure.
RCL_PUBLIC RCL_WARN_UNUSED rcl_remap_t rcl_get_zero_initialized_remap(void)
Return a rcl_remap_t struct with members initialized to NULL.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_remap_copy(const rcl_remap_t *rule, rcl_remap_t *rule_out)
Copy one remap structure into another.
char * external_log_config_file
A file used to configure the external logging library.
rcl_log_levels_t log_levels
Log levels parsed from arguments.
rcl_params_t * parameter_overrides
Parameter override rules parsed from arguments.
int num_unparsed_args
Length of unparsed_args.
int num_param_files_args
Length of parameter_files.
bool log_rosout_disabled
A boolean value indicating if the rosout topic handler should be used for log output.
bool log_stdout_disabled
A boolean value indicating if the standard out handler should be used for log output.
rcl_allocator_t allocator
Allocator used to allocate objects in this struct.
int * unparsed_args
Array of indices to non-ROS arguments.
int * unparsed_ros_args
Array of indices to unknown ROS specific arguments.
char * enclave
Enclave to be used.
bool log_ext_lib_disabled
A boolean value indicating if the external lib handler should be used for log output.
rcl_remap_t * remap_rules
Array of rules for name remapping.
int num_remap_rules
Length of remap_rules.
int num_unparsed_ros_args
Length of unparsed_ros_args.
char ** parameter_files
Array of yaml parameter file paths.
Hold output of parsing command line arguments.
rcl_arguments_impl_t * impl
Private implementation pointer.
Track lexical analysis and allow looking ahead 2 lexemes.
Hold default logger level and other logger setting.
rcl_allocator_t allocator
Allocator used to allocate objects in this struct.
rcl_logger_setting_t * logger_settings
Array of logger setting.
rcl_log_severity_t default_logger_level
Minimum default logger level severity.
char * replacement
Replacement portion of a rule.
char * node_name
A node name that this rule is limited to, or NULL if it applies to any node.
rcl_allocator_t allocator
Allocator used to allocate objects in this struct.
char * match
Match portion of a rule, or NULL if node name or namespace replacement.
rcl_remap_type_t type
Bitmask indicating what type of rule this is.
rcl_remap_impl_t * impl
Private implementation pointer.
#define RCL_RET_INVALID_LOG_LEVEL_RULE
Argument is not a valid log level rule.
#define RCL_RET_INVALID_PARAM_RULE
Argument is not a valid parameter rule.
#define RCL_RET_WRONG_LEXEME
Expected one type of lexeme but got another.
#define RCL_RET_INVALID_ROS_ARGS
Found invalid ros argument while parsing.
#define RCL_RET_INVALID_REMAP_RULE
Argument is not a valid remap rule.
#define RCL_RET_OK
Success return code.
#define RCL_RET_BAD_ALLOC
Failed to allocate memory return code.
#define RCL_RET_INVALID_ARGUMENT
Invalid argument return code.
#define RCL_RET_ERROR
Unspecified error return code.
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.