Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Further factorization: introduce ModuleGroup::init_from_flag_value()
[simgrid.git] / src / simgrid / module.cpp
index 70b857f..28647f3 100644 (file)
@@ -20,6 +20,7 @@ using namespace simgrid;
 void ModuleGroup::create_flag(const std::string& opt_name, const std::string& descr, const std::string& default_value,
                               bool init_now)
 {
+  opt_name_               = opt_name;
   std::string description = descr + ". Possible values (other compilation flags may activate more " + get_kind() +
                             "s): " + existing_values() +
                             ".\n       (use 'help' as a value to see the long description of each one)";
@@ -42,6 +43,10 @@ void ModuleGroup::create_flag(const std::string& opt_name, const std::string& de
           by_name(value); // Simply ensure that this value exists, it will be picked up later
       });
 }
+void ModuleGroup::init_from_flag_value()
+{
+  by_name(simgrid::config::get_value<std::string>(opt_name_)).init();
+}
 
 ModuleGroup& ModuleGroup::add(const char* id, const char* desc, std::function<void()> init)
 {