-/** @brief Add values parsed from a string into a config set
- *
- * @param options a string containing the content to add to the config set. This is a '\\t',' ' or '\\n' or ','
- * separated list of variables. Each individual variable is like "[name]:[value]" where [name] is the name of an
- * already registered variable, and [value] conforms to the data type under which this variable was registered.
- *
- * @todo This is a crude manual parser, it should be a proper lexer.
- */
-void xbt_cfg_set_parse(const char *options)
-{
- if (not options || not strlen(options)) { /* nothing to do */
- return;
- }
-
- XBT_DEBUG("List to parse and set:'%s'", options);
- std::string optionlist(options);
- while (not optionlist.empty()) {
- XBT_DEBUG("Still to parse and set: '%s'", optionlist.c_str());
-
- // skip separators
- size_t pos = optionlist.find_first_not_of(" \t\n,");
- optionlist.erase(0, pos);
- // find option
- pos = optionlist.find_first_of(" \t\n,");
- std::string name = optionlist.substr(0, pos);
- optionlist.erase(0, pos);
- XBT_DEBUG("parse now:'%s'; parse later:'%s'", name.c_str(), optionlist.c_str());
-
- if (name.empty())
- continue;
-
- pos = name.find(':');
- xbt_assert(pos != std::string::npos, "Option '%s' badly formatted. Should be of the form 'name:value'",
- name.c_str());
-
- std::string val = name.substr(pos + 1);
- name.erase(pos);
-
- const std::string path("path");
- if (name.compare(0, path.length(), path) != 0)
- XBT_INFO("Configuration change: Set '%s' to '%s'", name.c_str(), val.c_str());
-
- (*simgrid_config)[name.c_str()].set_string_value(val.c_str());
- }
-}
-
-/** @brief Set the value of a variable, using the string representation of that value
- *
- * @param key name of the variable to modify
- * @param value string representation of the value to set
- */
-
-void xbt_cfg_set_as_string(const char *key, const char *value)
-{
- (*simgrid_config)[key].set_string_value(value);
-}
-
-/** @brief Set an integer value to \a name within \a cfg if it wasn't changed yet
- *
- * This is useful to change the default value of a variable while allowing
- * users to override it with command line arguments
- */
-void xbt_cfg_setdefault_int(const char *key, int value)
-{
- (*simgrid_config)[key].set_default_value<int>(value);
-}
-
-/** @brief Set an integer value to \a name within \a cfg if it wasn't changed yet
- *
- * This is useful to change the default value of a variable while allowing
- * users to override it with command line arguments
- */
-void xbt_cfg_setdefault_double(const char *key, double value)
-{
- (*simgrid_config)[key].set_default_value<double>(value);
-}
-
-/** @brief Set a string value to \a name within \a cfg if it wasn't changed yet
- *
- * This is useful to change the default value of a variable while allowing
- * users to override it with command line arguments
- */
-void xbt_cfg_setdefault_string(const char *key, const char *value)
-{
- (*simgrid_config)[key].set_default_value<std::string>(value ? value : "");
-}
-
-/** @brief Set an boolean value to \a name within \a cfg if it wasn't changed yet
- *
- * This is useful to change the default value of a variable while allowing
- * users to override it with command line arguments
- */
-void xbt_cfg_setdefault_boolean(const char *key, const char *value)
-{
- (*simgrid_config)[key].set_default_value<bool>(simgrid::config::parse_bool(value));
-}
-