Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use ordered map when order is needed
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 8 Jun 2017 06:45:03 +0000 (08:45 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 8 Jun 2017 06:45:03 +0000 (08:45 +0200)
include/simgrid/s4u/Storage.hpp
src/s4u/s4u_storage.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp
teshsuite/s4u/storage_client_server/storage_client_server.tesh

index 85c16ae..12bfe85 100644 (file)
@@ -17,7 +17,7 @@
 namespace simgrid {
 namespace s4u {
 
-std::unordered_map<std::string, Storage*>* allStorages();
+std::map<std::string, Storage*>* allStorages();
 
 XBT_PUBLIC_CLASS Storage
 {
index e3e776c..5e9d200 100644 (file)
 
 namespace simgrid {
 namespace s4u {
-std::unordered_map<std::string, Storage*>* allStorages()
+std::map<std::string, Storage*>* allStorages()
 {
   std::unordered_map<std::string, surf::StorageImpl*>* map = surf::StorageImpl::storagesMap();
-  std::unordered_map<std::string, Storage*>* res           = new std::unordered_map<std::string, Storage*>;
+  std::map<std::string, Storage*>* res                     = new std::map<std::string, Storage*>;
   for (auto s : *map)
     res->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface
 
index b801f7c..b2fdc63 100644 (file)
@@ -95,7 +95,7 @@ static void get_set_storage_data(const char* storage_name)
 
 static void dump_platform_storages()
 {
-  std::unordered_map<std::string, simgrid::s4u::Storage*>* storages = simgrid::s4u::allStorages();
+  std::map<std::string, simgrid::s4u::Storage*>* storages = simgrid::s4u::allStorages();
 
   for (auto storage : *storages) {
     XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->host());
index c183aa2..d334f6b 100644 (file)
@@ -102,7 +102,7 @@ $ ./storage_client_server$EXEEXT ${srcdir:=.}/../../../examples/platforms/storag
 > [  1.207952] (server@alice)  \Windows\winhlp32.exe size: 10752 bytes
 > [  1.207952] (server@alice)  \Windows\write.exe size: 10752 bytes
 > [  1.207952] (server@alice) Storage Disk1 is attached to bob
-> [  1.207952] (server@alice) Storage Disk3 is attached to carl
 > [  1.207952] (server@alice) Storage Disk2 is attached to alice
+> [  1.207952] (server@alice) Storage Disk3 is attached to carl
 > [  1.207952] (server@alice) Storage Disk4 is attached to denise
 > [  1.207952] (maestro@) Simulated time: 1.20795