Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Hotfix: expose add_model method in s4u::Engine
authorBruno Donassolo <bruno.donassolo@inria.fr>
Tue, 9 Mar 2021 17:28:59 +0000 (18:28 +0100)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Tue, 9 Mar 2021 17:30:37 +0000 (18:30 +0100)
Expose the add_model API to external users.

include/simgrid/s4u/Engine.hpp
src/s4u/s4u_Engine.cpp

index 83df843..d293c9f 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <simgrid/forward.h>
 
+#include <simgrid/kernel/resource/Model.hpp>
 #include <simgrid/s4u/NetZone.hpp>
 
 #include <string>
@@ -129,6 +130,14 @@ public:
 
   NetZone* netzone_by_name_or_null(const std::string& name) const;
 
+  /**
+   * @brief Add a model to engine list
+   *
+   * @param type Model type (network, disk, etc)
+   * @param model Pointer to model
+   */
+  void add_model(simgrid::kernel::resource::Model::Type type, std::unique_ptr<simgrid::kernel::resource::Model> model);
+
   /** @brief Retrieves all netzones of the type indicated by the template argument */
   template <class T> std::vector<T*> get_filtered_netzones() const
   {
index bf90ae3..6bc9b00 100644 (file)
@@ -73,6 +73,11 @@ double Engine::get_clock()
   return SIMIX_get_clock();
 }
 
+void Engine::add_model(simgrid::kernel::resource::Model::Type type,
+                       std::unique_ptr<simgrid::kernel::resource::Model> model)
+{
+  simgrid::kernel::actor::simcall([this, type, &model] { pimpl->add_model(type, std::move(model)); });
+}
 /**
  * Creates a new platform, including hosts, links, and the routing table.
  *