Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move globals to EngineImpl
[simgrid.git] / src / surf / disk_s19.cpp
index c1e4bde..12722e7 100644 (file)
@@ -7,6 +7,7 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
+#include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "src/surf/xml/platf.hpp"
 #include "surf/surf.hpp"
@@ -19,10 +20,9 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_disk);
 
 void surf_disk_model_init_default()
 {
-  /* FIXME[donassolo]: this smells bad, but works
-   * (the constructor saves its pointer in all_existing_models and models_by_type :O).
-   * We need a manager for these models */
-  new simgrid::kernel::resource::DiskS19Model();
+  auto disk_model = std::make_unique<simgrid::kernel::resource::DiskS19Model>();
+  simgrid::kernel::EngineImpl::get_instance()->add_model(simgrid::kernel::resource::Model::Type::DISK,
+                                                         std::move(disk_model), true);
 }
 
 namespace simgrid {
@@ -31,8 +31,6 @@ namespace resource {
 
 DiskS19Model::DiskS19Model()
 {
-  all_existing_models.push_back(this);
-  models_by_type[simgrid::kernel::resource::Model::Type::DISK].push_back(this);
 }
 
 DiskImpl* DiskS19Model::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)