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"
17 EngineImpl::EngineImpl() = default;
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
23 * that the output is reproducible: we don't want to kill them in the
24 * pointer order as it could be platform-dependent, which would break
27 std::vector<std::string> names;
28 for (auto const& kv : hosts_)
29 names.push_back(kv.second->get_name());
31 std::sort(names.begin(), names.end());
33 for (auto const& name : names)
34 hosts_.at(name)->destroy();
36 /* Also delete the other data */
38 for (auto const& kv : netpoints_)
41 for (auto const& kv : storages_)
43 kv.second->getImpl()->destroy();