X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/237fd22b56db7d1c67360c37559ce3aab16a002d..40ee10e13b61bfb28374d96ade010a262b5abd44:/examples/cpp/energy-wifi/s4u-energy-wifi.cpp diff --git a/examples/cpp/energy-wifi/s4u-energy-wifi.cpp b/examples/cpp/energy-wifi/s4u-energy-wifi.cpp index a2d9a7ed23..a9266a30e8 100644 --- a/examples/cpp/energy-wifi/s4u-energy-wifi.cpp +++ b/examples/cpp/energy-wifi/s4u-energy-wifi.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2020-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2020-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. */ @@ -18,14 +18,15 @@ #include "simgrid/s4u/Mailbox.hpp" XBT_LOG_NEW_DEFAULT_CATEGORY(test_wifi, "Wifi energy demo"); +namespace sg4 = simgrid::s4u; static void sender() { // start sending after 5 seconds - simgrid::s4u::this_actor::sleep_until(5); + sg4::this_actor::sleep_until(5); std::string mbName = "MailBoxRCV"; - simgrid::s4u::Mailbox *dst = simgrid::s4u::Mailbox::by_name(mbName); + sg4::Mailbox* dst = sg4::Mailbox::by_name(mbName); int size = 6750000; @@ -39,7 +40,7 @@ static void receiver() { std::string mbName = "MailBoxRCV"; XBT_INFO("RECEIVING on mb %s", mbName.c_str()); - simgrid::s4u::Mailbox *myBox = simgrid::s4u::Mailbox::by_name(mbName); + sg4::Mailbox* myBox = sg4::Mailbox::by_name(mbName); myBox->get(); XBT_INFO("received all messages"); @@ -47,18 +48,18 @@ static void receiver() int main(int argc, char** argv) { - simgrid::s4u::Engine engine(&argc, argv); + sg4::Engine engine(&argc, argv); sg_wifi_energy_plugin_init(); engine.load_platform(argv[1]); // setup WiFi bandwidths - const auto* l = simgrid::s4u::Link::by_name("AP1"); - l->set_host_wifi_rate(simgrid::s4u::Host::by_name("Station 1"), 0); - l->set_host_wifi_rate(simgrid::s4u::Host::by_name("Station 2"), 0); + const auto* l = engine.link_by_name("AP1"); + l->set_host_wifi_rate(engine.host_by_name("Station 1"), 0); + l->set_host_wifi_rate(engine.host_by_name("Station 2"), 0); // create the two actors for the test - simgrid::s4u::Actor::create("act0", simgrid::s4u::Host::by_name("Station 1"), sender); - simgrid::s4u::Actor::create("act1", simgrid::s4u::Host::by_name("Station 2"), receiver); + sg4::Actor::create("act0", engine.host_by_name("Station 1"), sender); + sg4::Actor::create("act1", engine.host_by_name("Station 2"), receiver); engine.run();