Logo AND Algorithmique Numérique Distribuée

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