1 /* Copyright (c) 2016-2018. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "src/kernel/EngineImpl.hpp"
7 #include "simgrid/kernel/routing/NetPoint.hpp"
8 #include "simgrid/kernel/routing/NetZoneImpl.hpp"
9 #include "simgrid/s4u/Host.hpp"
10 #include "src/surf/StorageImpl.hpp"
11 #include "src/surf/network_interface.hpp"
18 EngineImpl::EngineImpl() = default;
19 EngineImpl::~EngineImpl()
21 /* copy all names to not modify the map while iterating over it.
23 * Plus, the hosts are destroyed in the lexicographic order to ensure
24 * that the output is reproducible: we don't want to kill them in the
25 * pointer order as it could be platform-dependent, which would break
28 std::vector<std::string> names;
29 for (auto const& kv : hosts_)
30 names.push_back(kv.second->get_name());
32 std::sort(names.begin(), names.end());
34 for (auto const& name : names)
35 hosts_.at(name)->destroy();
37 /* Also delete the other data */
39 for (auto const& kv : netpoints_)
42 for (auto const& kv : storages_)
44 kv.second->get_impl()->destroy();
46 for (auto const& kv : links_)
48 kv.second->get_impl()->destroy();