From: Frederic Suter Date: Wed, 10 Jul 2019 14:30:21 +0000 (+0200) Subject: please users X-Git-Tag: v3.24~344 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7973bd18cc5c47be83e6032a4018838fd99ffc65 please users --- diff --git a/include/xbt/config.h b/include/xbt/config.h index e7c566ac87..486c5f7305 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -64,15 +64,19 @@ typedef void* xbt_cfg_t; SG_BEGIN_DECL() /* Set the value of the cell @a name in @a cfg with the provided value.*/ -XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_value") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_value or sg_cfg_set_int") XBT_PUBLIC void xbt_cfg_set_int(const char* name, int val); -XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_value") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_value or sg_cfg_set_double") XBT_PUBLIC void xbt_cfg_set_double(const char* name, double val); -XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_value") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_value or sg_cfg_set_boolean") XBT_PUBLIC void xbt_cfg_set_boolean(const char* name, const char* val); -XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_value") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::set_valueor sg_cfg_set_string") XBT_PUBLIC void xbt_cfg_set_string(const char* name, const char* val); +XBT_PUBLIC void sg_cfg_set_int(const char* name, int val); +XBT_PUBLIC void sg_cfg_set_double(const char* name, double val); +XBT_PUBLIC void sg_cfg_set_boolean(const char* name, const char* val); +XBT_PUBLIC void sg_cfg_set_string(const char* name, const char* val); /* @} */ /** @defgroup XBT_cfg_decl Configuration type declaration and memory management @@ -99,13 +103,16 @@ typedef void (*xbt_cfg_cb_t)(const char* name); * @{ */ -XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::get_value") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::get_value or sg_cfg_get_int") XBT_PUBLIC int xbt_cfg_get_int(const char* name); -XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::get_value") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::get_value or sg_cfg_get_double") XBT_PUBLIC double xbt_cfg_get_double(const char* name); -XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::get_value") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::config::get_value or sg_cfg_get_boolean") XBT_PUBLIC int xbt_cfg_get_boolean(const char* name); +XBT_PUBLIC int sg_cfg_get_int(const char* name); +XBT_PUBLIC double sg_cfg_get_double(const char* name); +XBT_PUBLIC int sg_cfg_get_boolean(const char* name); /** @} */ SG_END_DECL() diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index f70eec1947..c50e8057a1 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -495,6 +495,11 @@ void help() * @param value the value of the variable */ void xbt_cfg_set_int(const char *key, int value) +{ + sg_cfg_set_int(key, value); +} + +void sg_cfg_set_int(const char* key, int value) { (*simgrid_config)[key].set_value(value); } @@ -505,6 +510,11 @@ void xbt_cfg_set_int(const char *key, int value) * @param value the double to set */ void xbt_cfg_set_double(const char *key, double value) +{ + sg_cfg_set_double(key, value); +} + +void sg_cfg_set_double(const char* key, double value) { (*simgrid_config)[key].set_value(value); } @@ -516,6 +526,11 @@ void xbt_cfg_set_double(const char *key, double value) * */ void xbt_cfg_set_string(const char* key, const char* value) +{ + sg_cfg_set_string(key, value); +} + +void sg_cfg_set_string(const char* key, const char* value) { (*simgrid_config)[key].set_value(value); } @@ -526,6 +541,11 @@ void xbt_cfg_set_string(const char* key, const char* value) * @param value the value of the variable */ void xbt_cfg_set_boolean(const char *key, const char *value) +{ + sg_cfg_set_boolean(key, value); +} + +void sg_cfg_set_boolean(const char* key, const char* value) { (*simgrid_config)[key].set_value(simgrid::config::parse_bool(value)); } @@ -538,6 +558,11 @@ void xbt_cfg_set_boolean(const char *key, const char *value) * Returns the first value from the config set under the given name. */ int xbt_cfg_get_int(const char *key) +{ + return sg_cfg_get_int(key); +} + +int sg_cfg_get_int(const char* key) { return (*simgrid_config)[key].get_value(); } @@ -549,6 +574,11 @@ int xbt_cfg_get_int(const char *key) * Returns the first value from the config set under the given name. */ double xbt_cfg_get_double(const char *key) +{ + return sg_cfg_get_double(key); +} + +double sg_cfg_get_double(const char* key) { return (*simgrid_config)[key].get_value(); } @@ -561,6 +591,11 @@ double xbt_cfg_get_double(const char *key) * If there is more than one value, it will issue a warning. */ int xbt_cfg_get_boolean(const char *key) +{ + return sg_cfg_get_boolean(key); +} + +int sg_cfg_get_boolean(const char* key) { return (*simgrid_config)[key].get_value() ? 1 : 0; }