From: msimonin Date: Wed, 10 Mar 2021 15:40:09 +0000 (+0100) Subject: s4u Engine: expose get_all_models, get_model_list X-Git-Tag: v3.27~179^2 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/082ed926323cda37d5f5cdfe5fdeb06c7884d036 s4u Engine: expose get_all_models, get_model_list Before e22da6010c6499813ff88c76041cf499ffbf2b67 the list of models could be accessed using the global `all_existing_models` This patch exposes two methods to get the list of models in the s4u::Engine, they wrap those of `EngineImpl`. --- diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index 30ecfd2646..9397c3feab 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -138,6 +138,12 @@ public: */ void add_model(simgrid::kernel::resource::Model::Type type, std::shared_ptr model); + /** @brief Get list of models created for a resource type */ + const std::vector& get_model_list(simgrid::kernel::resource::Model::Type type); + + /** @brief Get list of all models managed by this engine */ + const std::vector>& get_all_models(); + /** @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 24502707f1..9959d37ea6 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -78,6 +78,18 @@ void Engine::add_model(simgrid::kernel::resource::Model::Type type, { simgrid::kernel::actor::simcall([this, type, &model] { pimpl->add_model(type, std::move(model)); }); } + +/** @brief Get list of models created for a resource type */ +const std::vector& Engine::get_model_list(simgrid::kernel::resource::Model::Type type) +{ + return pimpl->get_model_list(type); +} + +const std::vector>& Engine::get_all_models() +{ + return pimpl->get_all_models(); +} + /** * Creates a new platform, including hosts, links, and the routing table. *