From: Bruno Donassolo Date: Tue, 9 Mar 2021 17:28:59 +0000 (+0100) Subject: Hotfix: expose add_model method in s4u::Engine X-Git-Tag: v3.27~193^2 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/559087964bf37d1f943ca5f7da5a1212b7f762a6 Hotfix: expose add_model method in s4u::Engine Expose the add_model API to external users. --- diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index 83df843097..d293c9f5f1 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -10,6 +10,7 @@ #include +#include #include #include @@ -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 model); + /** @brief Retrieves all netzones of the type indicated by the template argument */ template std::vector get_filtered_netzones() const { diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index bf90ae3c4c..6bc9b005a1 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -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 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. *