Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use typed Mailbox::get<>() instead of using static_cast everywhere.
[simgrid.git] / teshsuite / s4u / storage_client_server / storage_client_server.cpp
index f633892..d676ff5 100644 (file)
@@ -51,8 +51,8 @@ static void hsm_put(const std::string& remote_host, const std::string& src, cons
 
   // Send file
   XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::get_cname(), read_size, remote_host.c_str());
-  std::string* payload             = new std::string(simgrid::xbt::string_printf("%s %llu", dest.c_str(), read_size));
-  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(remote_host);
+  auto* payload = new std::string(simgrid::xbt::string_printf("%s %llu", dest.c_str(), read_size));
+  auto* mailbox = simgrid::s4u::Mailbox::by_name(remote_host);
   mailbox->put(payload, read_size);
   simgrid::s4u::this_actor::sleep_for(.4);
 }
@@ -61,7 +61,7 @@ static void display_disk_content(const simgrid::s4u::Disk* disk)
 {
   XBT_INFO("*** Dump a disk ***");
   XBT_INFO("Print the content of the disk: %s", disk->get_cname());
-  const std::map<std::string, sg_size_t>* content = disk->extension<simgrid::s4u::FileSystemDiskExt>()->get_content();
+  const auto* content = disk->extension<simgrid::s4u::FileSystemDiskExt>()->get_content();
   if (not content->empty()) {
     for (auto const& entry : *content)
       XBT_INFO("  %s size: %llu bytes", entry.first.c_str(), entry.second);
@@ -127,7 +127,7 @@ static void server()
 
   XBT_INFO("Server waiting for transfers ...");
   while (true) {
-    const std::string* msg = static_cast<std::string*>(mailbox->get());
+    const std::string* msg = mailbox->get<std::string>();
     if (*msg == "finalize") { // Shutdown ...
       delete msg;
       break;