-/*----[ Registering stuff ]-----------------------------------------------*/
-/** @brief Register an element within a config set
- *
- * @param cfg the config set
- * @param name the name of the config element
- * @param desc a description for this item (used by xbt_cfg_help())
- * @param type the type of the config element
- * @param cb_set callback function called when a value is set
- */
-static void xbt_cfg_register(
- xbt_cfg_t * cfg, const char *name, const char *desc, e_xbt_cfgelm_type_t type,
- xbt_cfg_cb_t cb_set,
- std::function<void(const char* value)> callback = std::function<void(const char* value)>())
-{
- if (*cfg == NULL)
- *cfg = xbt_cfg_new();
- xbt_assert(type >= xbt_cfgelm_int && type <= xbt_cfgelm_boolean,
- "type of %s not valid (%d should be between %d and %d)",
- name, (int)type, xbt_cfgelm_int, xbt_cfgelm_boolean);
-
- xbt_cfgelm_t res = (xbt_cfgelm_t) xbt_dict_get_or_null((xbt_dict_t) * cfg, name);
- xbt_assert(NULL == res, "Refusing to register the config element '%s' twice.", name);
-
- res = new s_xbt_cfgelm_t();
- XBT_DEBUG("Register cfg elm %s (%s) (%s (=%d) @%p in set %p)",
- name, desc, xbt_cfgelm_type_name[type], (int)type, res, *cfg);
- res->type = type;
- if (desc)
- res->desc = desc;
- res->cb_set = cb_set;
- res->callback = std::move(callback);
-
- switch (type) {
- case xbt_cfgelm_int:
- res->content = xbt_dynar_new(sizeof(int), NULL);
- break;
- case xbt_cfgelm_double:
- res->content = xbt_dynar_new(sizeof(double), NULL);
- break;
- case xbt_cfgelm_string:
- res->content = xbt_dynar_new(sizeof(char *), xbt_free_ref);
- break;
- case xbt_cfgelm_boolean:
- res->content = xbt_dynar_new(sizeof(int), NULL);
- break;
- default:
- XBT_ERROR("%d is an invalid type code", (int)type);
- break;
- }
-
- xbt_dict_set((xbt_dict_t) * cfg, name, res, NULL);
-}
-
-void xbt_cfg_register_double(const char *name, double default_value,xbt_cfg_cb_t cb_set, const char *desc){
- xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_double,cb_set);
- xbt_cfg_setdefault_double(name, default_value);
-}
-void xbt_cfg_register_int(const char *name, int default_value,xbt_cfg_cb_t cb_set, const char *desc) {
- xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_int,cb_set);
- xbt_cfg_setdefault_int(name, default_value);
-}
-void xbt_cfg_register_string(const char *name, const char *default_value, xbt_cfg_cb_t cb_set, const char *desc){
- xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_string,cb_set);
- xbt_cfg_setdefault_string(name, default_value);
-}
-void xbt_cfg_register_boolean(const char *name, const char*default_value,xbt_cfg_cb_t cb_set, const char *desc){
- xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_boolean,cb_set);
- xbt_cfg_setdefault_boolean(name, default_value);
-}
-
-void xbt_cfg_register_alias(const char *newname, const char *oldname)
-{
- if (simgrid_config == NULL)
- simgrid_config = xbt_cfg_new();