X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8db180ab71dc8057154417c17b5c9c006f91626a..9afa0d0db01da2ae64e48fb594cc87c186dde192:/examples/cpp/network-wifi/s4u-network-wifi.cpp diff --git a/examples/cpp/network-wifi/s4u-network-wifi.cpp b/examples/cpp/network-wifi/s4u-network-wifi.cpp index 703fe239e4..13eae66730 100644 --- a/examples/cpp/network-wifi/s4u-network-wifi.cpp +++ b/examples/cpp/network-wifi/s4u-network-wifi.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -10,15 +10,16 @@ */ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_network_wifi, "Messages specific for this s4u example"); +namespace sg4 = simgrid::s4u; -static void sender(simgrid::s4u::Mailbox* mailbox, int data_size) +static void sender(sg4::Mailbox* mailbox, int data_size) { XBT_INFO("Send a message to the other station."); static std::string message = "message"; mailbox->put(&message, data_size); XBT_INFO("Done."); } -static void receiver(simgrid::s4u::Mailbox* mailbox) +static void receiver(sg4::Mailbox* mailbox) { XBT_INFO("Wait for a message."); mailbox->get(); @@ -27,21 +28,21 @@ static void receiver(simgrid::s4u::Mailbox* mailbox) int main(int argc, char* argv[]) { - simgrid::s4u::Engine e(&argc, argv); + sg4::Engine e(&argc, argv); xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s platform.xml deployment.xml\n", argv[0], argv[0]); e.load_platform(argv[1]); /* Exchange a message between the 2 stations */ - auto mailbox = simgrid::s4u::Mailbox::by_name("mailbox"); - auto station1 = e.host_by_name("Station 1"); - auto station2 = e.host_by_name("Station 2"); - simgrid::s4u::Actor::create("sender", station1, sender, mailbox, 1e7); - simgrid::s4u::Actor::create("receiver", station2, receiver, mailbox); + auto* mailbox = sg4::Mailbox::by_name("mailbox"); + auto* station1 = e.host_by_name("Station 1"); + auto* station2 = e.host_by_name("Station 2"); + sg4::Actor::create("sender", station1, sender, mailbox, 1e7); + sg4::Actor::create("receiver", station2, receiver, mailbox); /* Declare that the stations are not at the same distance from their AP */ - auto ap = e.link_by_name("AP1"); + const auto* ap = e.link_by_name("AP1"); ap->set_host_wifi_rate(station1, 1); // The host "Station 1" uses the second level of bandwidths on that AP ap->set_host_wifi_rate(station2, 0); // This is perfectly useless as level 0 is used by default