1 /* Copyright (c) 2016-2019. 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()
20 /* copy all names to not modify the map while iterating over it.
22 * Plus, the hosts are destroyed in the lexicographic order to ensure that the output is reproducible: we don't want
23 * to kill them in the pointer order as it could be platform-dependent, which would break the tests.
25 std::vector<std::string> names;
26 for (auto const& kv : hosts_)
27 names.push_back(kv.second->get_name());
29 std::sort(names.begin(), names.end());
31 for (auto const& name : names)
32 hosts_.at(name)->destroy();
34 /* Also delete the other data */
36 for (auto const& kv : netpoints_)
39 for (auto const& kv : storages_)
41 kv.second->get_impl()->destroy();
43 for (auto const& kv : links_)
45 kv.second->get_impl()->destroy();