-void xbt_cfg_help(void)
-{
- xbt_dict_cursor_t dict_cursor;
- unsigned int dynar_cursor;
- xbt_cfgelm_t variable;
- char *name;
- xbt_dynar_t names = xbt_dynar_new(sizeof(char *), NULL);
-
- xbt_dict_foreach((xbt_dict_t )simgrid_config, dict_cursor, name, variable)
- xbt_dynar_push(names, &name);
- xbt_dynar_sort_strings(names);
-
- xbt_dynar_foreach(names, dynar_cursor, name) {
- int size;
- variable = (xbt_cfgelm_t) xbt_dict_get((xbt_dict_t )simgrid_config, name);
- if (variable->type == xbt_cfgelm_alias)
- continue;
-
- printf(" %s: %s\n", name, variable->desc.c_str());
- printf(" Type: %s; ", xbt_cfgelm_type_name[variable->type]);
- size = xbt_dynar_length(variable->content);
- printf("Current value: ");
-
- if (size != 1)
- printf(size == 0 ? "n/a\n" : "{ ");
- for (int i = 0; i < size; i++) {
- const char *sep = (size == 1 ? "\n" : (i < size - 1 ? ", " : " }\n"));
-
- switch (variable->type) {
- case xbt_cfgelm_int:
- printf("%d%s", xbt_dynar_get_as(variable->content, i, int), sep);
- break;
- case xbt_cfgelm_double:
- printf("%f%s", xbt_dynar_get_as(variable->content, i, double), sep);
- break;
- case xbt_cfgelm_string:
- printf("'%s'%s", xbt_dynar_get_as(variable->content, i, char *), sep);
- break;
- case xbt_cfgelm_boolean: {
- int b = xbt_dynar_get_as(variable->content, i, int);
- const char *bs = b ? xbt_cfgelm_boolean_values[0].true_val: xbt_cfgelm_boolean_values[0].false_val;
- if (b == 0 || b == 1)
- printf("'%s'%s", bs, sep);
- else
- printf("'%s/%d'%s", bs, b, sep);
- break;
- }
- default:
- printf("Invalid type!!%s", sep);
- break;
- }
- }
+void Config::help()
+{
+ for (auto const& elm : options) {
+ simgrid::config::ConfigurationElement* variable = this->options.at(elm.first);
+ printf(" %s: %s\n", elm.first.c_str(), variable->getDescription().c_str());
+ printf(" Type: %s; ", variable->getTypeName());
+ printf("Current value: %s\n", variable->getStringValue().c_str());