Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify disk management
[simgrid.git] / src / kernel / EngineImpl.cpp
1 /* Copyright (c) 2016-2019. The SimGrid Team. All rights reserved.          */
2
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. */
5
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/kernel/resource/DiskImpl.hpp"
11 #include "src/surf/StorageImpl.hpp"
12 #include "src/surf/network_interface.hpp"
13
14 namespace simgrid {
15 namespace kernel {
16
17 EngineImpl::~EngineImpl()
18 {
19   /* Since hosts_ is a std::map, the hosts are destroyed in the lexicographic order, which ensures that the output is
20    * reproducible.
21    */
22   while (not hosts_.empty())
23     hosts_.begin()->second->destroy();
24
25   /* Also delete the other data */
26   delete netzone_root_;
27   for (auto const& kv : netpoints_)
28     delete kv.second;
29
30   for (auto const& kv : storages_)
31     if (kv.second)
32       kv.second->get_impl()->destroy();
33
34   for (auto const& kv : links_)
35     if (kv.second)
36       kv.second->get_impl()->destroy();
37 }
38 }
39 }