Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
s4u Engine: expose get_all_models, get_model_list
authormsimonin <matthieu.simonin@inria.fr>
Wed, 10 Mar 2021 15:40:09 +0000 (16:40 +0100)
committermsimonin <matthieu.simonin@inria.fr>
Wed, 10 Mar 2021 15:47:25 +0000 (16:47 +0100)
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`.

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

index 30ecfd2..9397c3f 100644 (file)
@@ -138,6 +138,12 @@ public:
    */
   void add_model(simgrid::kernel::resource::Model::Type type, std::shared_ptr<simgrid::kernel::resource::Model> model);
 
+  /** @brief Get list of models created for a resource type */
+  const std::vector<simgrid::kernel::resource::Model*>& get_model_list(simgrid::kernel::resource::Model::Type type);
+
+  /** @brief Get list of all models managed by this engine */
+  const std::vector<std::shared_ptr<simgrid::kernel::resource::Model>>& get_all_models();
+
   /** @brief Retrieves all netzones of the type indicated by the template argument */
   template <class T> std::vector<T*> get_filtered_netzones() const
   {
index 2450270..9959d37 100644 (file)
@@ -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<simgrid::kernel::resource::Model*>& Engine::get_model_list(simgrid::kernel::resource::Model::Type type)
+{
+  return pimpl->get_model_list(type);
+}
+
+const std::vector<std::shared_ptr<simgrid::kernel::resource::Model>>& Engine::get_all_models()
+{
+  return pimpl->get_all_models();
+}
+
 /**
  * Creates a new platform, including hosts, links, and the routing table.
  *