Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Convert xbt_cfg_is_default_value -> simgrid::config::is_default.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 12:11:59 +0000 (14:11 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 16:13:31 +0000 (18:13 +0200)
include/xbt/config.h
include/xbt/config.hpp
src/simix/smx_context.cpp
src/smpi/internals/smpi_global.cpp
src/surf/cpu_cas01.cpp
src/surf/network_cm02.cpp
src/surf/sg_platf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/config.cpp

index 03fcda0..7cd6b61 100644 (file)
@@ -94,7 +94,8 @@ XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::set_default<std::string>
     void xbt_cfg_setdefault_string(const char* name, const char* val);
 
 /** @brief Return if configuration is set by default*/
-XBT_PUBLIC int xbt_cfg_is_default_value(const char* name);
+XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::is_default") XBT_PUBLIC
+    int xbt_cfg_is_default_value(const char* name);
 
 /* @} */
 
index 202bb4a..c9fe865 100644 (file)
@@ -52,6 +52,8 @@ extern template XBT_PUBLIC void set_default<double>(const char* name, double val
 extern template XBT_PUBLIC void set_default<bool>(const char* name, bool value);
 extern template XBT_PUBLIC void set_default<std::string>(const char* name, std::string value);
 
+XBT_PUBLIC bool is_default(const char* name);
+
 // Set config
 
 template <class T> XBT_PUBLIC void set_value(const char* name, T value);
index e5d27c3..55bb5e8 100644 (file)
@@ -97,8 +97,8 @@ void SIMIX_context_mod_init()
 {
   xbt_assert(simix_global->context_factory == nullptr);
 
-  smx_context_stack_size_was_set = not xbt_cfg_is_default_value("contexts/stack-size");
-  smx_context_guard_size_was_set = not xbt_cfg_is_default_value("contexts/guard-size");
+  smx_context_stack_size_was_set = not simgrid::config::is_default("contexts/stack-size");
+  smx_context_guard_size_was_set = not simgrid::config::is_default("contexts/guard-size");
 
 #if HAVE_THREAD_CONTEXTS && not HAVE_THREAD_LOCAL_STORAGE
   /* the __thread storage class is not available on this platform:
index 902237b..21f8e09 100644 (file)
@@ -221,7 +221,7 @@ static void smpi_check_options()
   xbt_assert(simgrid::config::get_value<int>("smpi/async-small-thresh") <=
              simgrid::config::get_value<int>("smpi/send-is-detached-thresh"));
 
-  if (xbt_cfg_is_default_value("smpi/host-speed")) {
+  if (simgrid::config::is_default("smpi/host-speed")) {
     XBT_INFO("You did not set the power of the host running the simulation.  "
              "The timings will certainly not be accurate.  "
              "Use the option \"--cfg=smpi/host-speed:<flops>\" to set its value."
index 315520c..cc47188 100644 (file)
@@ -63,7 +63,7 @@ CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid
   bool select = simgrid::config::get_value<bool>("cpu/maxmin-selective-update");
 
   if (algo == Model::UpdateAlgo::Lazy) {
-    xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"),
+    xbt_assert(select || simgrid::config::is_default("cpu/maxmin-selective-update"),
                "You cannot disable cpu selective update when using the lazy update mechanism");
     select = true;
   }
index b40a6b9..d041c58 100644 (file)
@@ -139,7 +139,7 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b
   bool select       = simgrid::config::get_value<bool>("network/maxmin-selective-update");
 
   if (optim == "Lazy") {
-    xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"),
+    xbt_assert(select || simgrid::config::is_default("network/maxmin-selective-update"),
                "You cannot disable network selective update when using the lazy update mechanism");
     select = true;
   }
index a6fcca8..3f290e7 100644 (file)
@@ -506,8 +506,8 @@ static void surf_config_models_setup()
   std::string storage_model_name = simgrid::config::get_value<std::string>("storage/model");
 
   /* The compound host model is needed when using non-default net/cpu models */
-  if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) &&
-      xbt_cfg_is_default_value("host/model")) {
+  if ((not simgrid::config::is_default("network/model") || not simgrid::config::is_default("cpu/model")) &&
+      simgrid::config::is_default("host/model")) {
     host_model_name = "compound";
     simgrid::config::set_value("host/model", host_model_name);
   }
index 2b692e9..ea98c47 100644 (file)
@@ -865,7 +865,7 @@ void STag_surfxml_config()
 void ETag_surfxml_config()
 {
   for (auto const& elm : *current_property_set) {
-    if (xbt_cfg_is_default_value(elm.first.c_str())) {
+    if (simgrid::config::is_default(elm.first.c_str())) {
       std::string cfg = elm.first + ":" + elm.second;
       xbt_cfg_set_parse(cfg.c_str());
     } else
index 3f5be9a..62d44ec 100644 (file)
@@ -378,6 +378,11 @@ template XBT_PUBLIC void set_default<double>(const char* name, double value);
 template XBT_PUBLIC void set_default<bool>(const char* name, bool value);
 template XBT_PUBLIC void set_default<std::string>(const char* name, std::string value);
 
+bool is_default(const char* name)
+{
+  return (*simgrid_config)[name].is_default();
+}
+
 // ***** set_value *****
 
 template <class T> XBT_PUBLIC void set_value(const char* name, T value)