From 336e78ca624de7acf2b4c2cc9d961ddc339ccdc3 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 5 Jul 2019 10:07:57 +0200 Subject: [PATCH] Refactoring of commit 1ebb8e111d904fea559e48ec193c1f7c5dee2245. --- src/surf/link_wifi.cpp | 11 ++++++++++- src/surf/link_wifi.hpp | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/surf/link_wifi.cpp b/src/surf/link_wifi.cpp index 761feaa61f..fa99474e71 100644 --- a/src/surf/link_wifi.cpp +++ b/src/surf/link_wifi.cpp @@ -9,9 +9,18 @@ namespace simgrid { namespace kernel { namespace resource { +NetworkWifiLink::NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector bandwidths, + s4u::Link::SharingPolicy policy, lmm::System* system) + : NetworkCm02Link(model, name, 0, 0, policy, system) +{ + for (auto bandwith : bandwidths) { + bandwidths_.push_back({bandwith, 1.0, nullptr}); + } +} + void NetworkWifiLink::set_host_rate(sg_host_t host, int rate_level) { - host_rates.insert(std::make_pair(host->get_name(), rate_level)); + host_rates_.insert(std::make_pair(host->get_name(), rate_level)); } } // namespace resource } // namespace kernel diff --git a/src/surf/link_wifi.hpp b/src/surf/link_wifi.hpp index 20f41791cd..9aa5d914be 100644 --- a/src/surf/link_wifi.hpp +++ b/src/surf/link_wifi.hpp @@ -17,12 +17,18 @@ namespace resource { class NetworkWifiLink : public NetworkCm02Link { /** @brief Hold every rates association between host and links (host name, rates id) */ - std::map host_rates; + std::map host_rates_; /** @brief Hold every rates available for this Access Point */ // double* rates; FIXME: unused + /** @brief A link can have several bandwith attach to it (mostly use by wifi model) */ + std::vector bandwidths_; + public: + NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector bandwidths, + s4u::Link::SharingPolicy policy, lmm::System* system); + void set_host_rate(sg_host_t host, int rate_level); }; -- 2.20.1