X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0bfafcab47ae9cd7856bd8d129404c33079d6afe..fa87b694ef63aa4f3193029f4705cc3d96492f04:/src/s4u/s4u_Engine.cpp diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index 0cfdc0754f..2d94c66d87 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -73,12 +73,23 @@ double Engine::get_clock() return SIMIX_get_clock(); } +void Engine::add_model(std::shared_ptr model, + const std::vector& dependencies) +{ + simgrid::kernel::actor::simcall([this, &model, &dependencies] { pimpl->add_model(std::move(model), dependencies); }); +} + +const std::vector& Engine::get_all_models() const +{ + return pimpl->get_all_models(); +} + /** * Creates a new platform, including hosts, links, and the routing table. * - * \rst + * @beginrst * See also: :ref:`platform`. - * \endrst + * @endrst */ void Engine::load_platform(const std::string& platf) const { @@ -139,9 +150,9 @@ void Engine::register_function(const std::string& name, const kernel::actor::Act /** Load a deployment file and launch the actors that it contains * - * \rst + * @beginrst * See also: :ref:`deploy`. - * \endrst + * @endrst */ void Engine::load_deployment(const std::string& deploy) const { @@ -297,7 +308,9 @@ void Engine::run() const /** @brief Retrieve the root netzone, containing all others */ s4u::NetZone* Engine::get_netzone_root() const { - return pimpl->netzone_root_->get_iface(); + if (pimpl->netzone_root_) + return pimpl->netzone_root_->get_iface(); + return nullptr; } /** @brief Set the root netzone, containing all others. Once set, it cannot be changed. */ void Engine::set_netzone_root(const s4u::NetZone* netzone) @@ -333,6 +346,15 @@ kernel::routing::NetPoint* Engine::netpoint_by_name_or_null(const std::string& n return netp == pimpl->netpoints_.end() ? nullptr : netp->second; } +kernel::routing::NetPoint* Engine::netpoint_by_name(const std::string& name) const +{ + auto netp = netpoint_by_name_or_null(name); + if (netp == nullptr) { + throw std::invalid_argument(std::string("Netpoint not found: %s") + name); + } + return netp; +} + std::vector Engine::get_all_netpoints() const { std::vector res;