Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make single argument constructor LinkInRoute::LinkInRoute(const Link*) explicit.
[simgrid.git] / examples / cpp / comm-serialize / s4u-comm-serialize.cpp
index 41e4433..8691b45 100644 (file)
@@ -80,7 +80,7 @@ public:
       pending_comms.emplace_back(mbox->get_async<std::string>(pending_msgs[i].get()));
     }
     while (not pending_comms.empty()) {
-      int index        = sg4::Comm::wait_any(pending_comms);
+      ssize_t index    = sg4::Comm::wait_any(pending_comms);
       std::string* msg = *pending_msgs[index];
       XBT_INFO("I got '%s'.", msg->c_str());
       /* cleanup memory and remove from vectors */
@@ -104,14 +104,12 @@ int main(int argc, char* argv[])
   auto* receiver = zone->create_host("receiver", 1)->seal();
 
   /* create split-duplex link1 (UP/DOWN), limiting the number of concurrent flows in it for 2 */
-  auto* link_up   = zone->create_link("link1_up", 10e9)->set_latency(10e-6)->set_concurrency_limit(2)->seal();
-  auto* link_down = zone->create_link("link1_down", 10e9)->set_latency(10e-6)->set_concurrency_limit(2)->seal();
+  const auto* link =
+      zone->create_split_duplex_link("link1", 10e9)->set_latency(10e-6)->set_concurrency_limit(2)->seal();
 
   /* create routes between nodes */
-  zone->add_route(sender->get_netpoint(), receiver->get_netpoint(), nullptr, nullptr, std::vector<sg4::Link*>{link_up},
-                  false);
-  zone->add_route(receiver->get_netpoint(), sender->get_netpoint(), nullptr, nullptr,
-                  std::vector<sg4::Link*>{link_down}, false);
+  zone->add_route(sender->get_netpoint(), receiver->get_netpoint(), nullptr, nullptr,
+                  {{link, sg4::LinkInRoute::Direction::UP}}, true);
   zone->seal();
 
   /* create actors Sender/Receiver */