- for (auto const& aliasname : aliases)
- simgrid_config->alias(realname, aliasname);
-}
-
-// ***** declare_flag *****
-
-template <class T>
-XBT_PUBLIC void declare_flag(const char* name, const char* description, T value, std::function<void(const T&)> callback)
-{
- if (simgrid_config == nullptr)
- simgrid_config = xbt_cfg_new();
- simgrid_config->register_option<T>(name, description, std::move(value), std::move(callback));
-}
-
-template XBT_PUBLIC void declare_flag(const char* name, const char* description, int value,
- std::function<void(int const&)> callback);
-template XBT_PUBLIC void declare_flag(const char* name, const char* description, double value,
- std::function<void(double const&)> callback);
-template XBT_PUBLIC void declare_flag(const char* name, const char* description, bool value,
- std::function<void(bool const&)> callback);
-template XBT_PUBLIC void declare_flag(const char* name, const char* description, std::string value,
- std::function<void(std::string const&)> callback);
-}
-}
-
-// ***** C bindings *****
-
-xbt_cfg_t xbt_cfg_new()
-{
- return new simgrid::config::Config();
-}
-void xbt_cfg_free(xbt_cfg_t * cfg) { delete *cfg; }
-
-void xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cfg)
-{
- cfg->dump(name, indent);
-}
-
-/*----[ Registering stuff ]-----------------------------------------------*/
-
-void xbt_cfg_register_double(const char *name, double default_value,
- xbt_cfg_cb_t cb_set, const char *desc)
-{
- if (simgrid_config == nullptr)
- simgrid_config = xbt_cfg_new();
- simgrid_config->register_option<double>(name, desc, default_value, cb_set);
-}
-
-void xbt_cfg_register_int(const char *name, int default_value,xbt_cfg_cb_t cb_set, const char *desc)
-{
- if (simgrid_config == nullptr)
- simgrid_config = xbt_cfg_new();
- simgrid_config->register_option<int>(name, desc, default_value, cb_set);
-}
-
-void xbt_cfg_register_string(const char *name, const char *default_value, xbt_cfg_cb_t cb_set, const char *desc)
-{
- if (simgrid_config == nullptr)
- simgrid_config = xbt_cfg_new();
- simgrid_config->register_option<std::string>(name, desc, default_value ? default_value : "", cb_set);
-}
-
-void xbt_cfg_register_boolean(const char *name, const char*default_value,xbt_cfg_cb_t cb_set, const char *desc)
-{
- if (simgrid_config == nullptr)
- simgrid_config = xbt_cfg_new();
- simgrid_config->register_option<bool>(name, desc, simgrid::config::parse_bool(default_value), cb_set);
-}
-
-void xbt_cfg_register_alias(const char *realname, const char *aliasname)
-{
- if (simgrid_config == nullptr)
- simgrid_config = xbt_cfg_new();
- simgrid_config->alias(realname, aliasname);
-}
-
-void xbt_cfg_aliases()
-{
- simgrid_config->show_aliases();
-}
-void xbt_cfg_help()
-{
- simgrid_config->help();
-}
-
-/*----[ Setting ]---------------------------------------------------------*/
-
-/** @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());