#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Mailbox.hpp"
#include "simgrid/s4u/NetZone.hpp"
-#include "simgrid/s4u/Storage.hpp"
#include "simgrid/simix.h"
#include "src/instr/instr_private.hpp"
#include "src/kernel/EngineImpl.hpp"
#include "src/simix/smx_private.hpp" // For access to simix_global->process_list
-#include "src/surf/StorageImpl.hpp"
#include "src/surf/network_interface.hpp"
#include "surf/surf.hpp" // routing_platf. FIXME:KILLME. SOON
#include <simgrid/Exception.hpp>
return SIMIX_get_clock();
}
+void Engine::add_model(std::shared_ptr<kernel::resource::Model> model,
+ const std::vector<kernel::resource::Model*>& dependencies)
+{
+ simgrid::kernel::actor::simcall([this, &model, &dependencies] { pimpl->add_model(std::move(model), dependencies); });
+}
+
+const std::vector<simgrid::kernel::resource::Model*>& 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
{
/** Registers a function as the default main function of actors
*
* It will be used as fallback when the function requested from the deployment file was not registered.
- * It is used for trace-based simulations (see examples/s4u/replay-comms and similar).
+ * It is used for trace-based simulations (see examples/cpp/replay-comms and similar).
*/
void Engine::register_default(const std::function<void(int, char**)>& code)
{
/** 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
{
pimpl->links_.erase(name);
}
-/** @brief Returns the amount of storages in the platform */
-size_t Engine::get_storage_count() const
-{
- return pimpl->storages_.size();
-}
-
-/** @brief Returns the list of all storages found in the platform */
-std::vector<Storage*> Engine::get_all_storages() const
-{
- std::vector<Storage*> res;
- for (auto const& kv : pimpl->storages_)
- res.push_back(kv.second->get_iface());
- return res;
-}
-
-/** @brief Find a storage from its name.
- *
- * @throw std::invalid_argument if the searched storage does not exist.
- */
-Storage* Engine::storage_by_name(const std::string& name) const
-{
- auto storage = pimpl->storages_.find(name);
- if (storage == pimpl->storages_.end())
- throw std::invalid_argument(std::string("Storage not found: ") + name);
- return storage->second->get_iface();
-}
-
-/** @brief Find a storage from its name (or nullptr if that storage does not exist) */
-Storage* Engine::storage_by_name_or_null(const std::string& name) const
-{
- auto storage = pimpl->storages_.find(name);
- return storage == pimpl->storages_.end() ? nullptr : storage->second->get_iface();
-}
-
-void Engine::storage_register(const std::string& name, const Storage* storage)
-{
- pimpl->storages_[name] = storage->get_impl();
-}
-
-void Engine::storage_unregister(const std::string& name)
-{
- pimpl->storages_.erase(name);
-}
-
/** @brief Returns the amount of links in the platform */
size_t Engine::get_link_count() 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)
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<kernel::routing::NetPoint*> Engine::get_all_netpoints() const
{
std::vector<kernel::routing::NetPoint*> res;