Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill undefined declaration.
[simgrid.git] / src / xbt / config.cpp
index 2990351..2caa254 100644 (file)
@@ -35,8 +35,6 @@ XBT_EXPORT_NO_IMPORT xbt_cfg_t simgrid_config = nullptr;
 namespace simgrid {
 namespace config {
 
-missing_key_error::~missing_key_error() = default;
-
 namespace {
 
 const char* true_values[] = {
@@ -272,8 +270,6 @@ public:
   Config& operator=(Config const&) = delete;
 
   ConfigurationElement& operator[](const char* name);
-  template<class T>
-  TypedConfigurationElement<T>& getTyped(const char* name);
   void alias(const char* realname, const char* aliasname);
 
   template<class T, class... A>
@@ -359,14 +355,11 @@ void Config::dump(const char *name, const char *indent)
   fflush(stdout);
 }
 
-/** @brief Displays the declared aliases and their description */
+/** @brief Displays the declared aliases and their replacement */
 void Config::showAliases()
 {
-  bool old_warn_for_aliases = false;
-  std::swap(warn_for_aliases, old_warn_for_aliases);
   for (auto const& elm : aliases)
-    printf("   %s: %s\n", elm.first.c_str(), (*this)[elm.first.c_str()].getDescription().c_str());
-  std::swap(warn_for_aliases, old_warn_for_aliases);
+    printf("   %-40s %s\n", elm.first.c_str(), elm.second->getKey().c_str());
 }
 
 /** @brief Displays the declared options and their description */
@@ -394,9 +387,10 @@ template XBT_PUBLIC std::string const& getConfig<std::string>(const char* name);
 
 // ***** alias *****
 
-void alias(const char* realname, const char* aliasname)
+void alias(const char* realname, std::initializer_list<const char*> aliases)
 {
-  simgrid_config->alias(realname, aliasname);
+  for (auto const& aliasname : aliases)
+    simgrid_config->alias(realname, aliasname);
 }
 
 // ***** declareFlag *****
@@ -692,9 +686,9 @@ static void make_set()
 {
   simgrid_config = nullptr;
   xbt_log_threshold_set(&_XBT_LOGV(xbt_cfg), xbt_log_priority_critical);
-  xbt_cfg_register_int("speed", 0, nullptr, "");
-  xbt_cfg_register_string("peername", "", nullptr, "");
-  xbt_cfg_register_string("user", "", nullptr, "");
+  simgrid::config::declareFlag<int>("speed", "description", 0);
+  simgrid::config::declareFlag<std::string>("peername", "description", "");
+  simgrid::config::declareFlag<std::string>("user", "description", "");
 }                               /* end_of_make_set */
 
 XBT_TEST_UNIT("memuse", test_config_memuse, "Alloc and free a config set")