static void on_communicate(const simgrid::kernel::resource::NetworkAction& action)
{
XBT_DEBUG("onCommunicate is called");
- for (simgrid::kernel::resource::LinkImpl* link : action.get_links()) {
+ for (auto const* link : action.get_links()) {
if (link == nullptr || link->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI)
continue;
std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::get_instance()->get_all_links();
double total_energy = 0.0; // Total dissipated energy (whole platform)
- for (const auto link : links) {
+ for (auto const* link : links) {
if (link == nullptr || link->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI)
continue;
simgrid::s4u::Link::on_communication_state_change.connect(
[](simgrid::kernel::resource::NetworkAction const& action,
simgrid::kernel::resource::Action::State /* previous */) {
- for (simgrid::kernel::resource::LinkImpl* link : action.get_links()) {
+ for (auto const* link : action.get_links()) {
if (link != nullptr && link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI)
link->get_iface()->extension<LinkEnergy>()->update();
}
[](simgrid::kernel::resource::NetworkAction const& action,
simgrid::kernel::resource::Action::State /* previous */) {
// update WiFi links encountered during the communication
- for (simgrid::kernel::resource::LinkImpl* link : action.get_links()) {
+ for (auto const* link : action.get_links()) {
if (link != nullptr && link->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI) {
link->get_iface()->extension<LinkEnergyWifi>()->update(action);
}
simgrid::s4u::Link::on_communication_state_change.connect(
[](simgrid::kernel::resource::NetworkAction const& action,
simgrid::kernel::resource::Action::State /* previous */) {
- for (simgrid::kernel::resource::LinkImpl* link : action.get_links()) {
+ for (auto const* link : action.get_links()) {
if (link != nullptr && link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI) {
auto link_load = link->get_iface()->extension<LinkLoad>();
if (link_load->is_tracked())
get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(),
1.0 / dst_wifi_link->get_host_rate(dst));
- for (auto const& link : route) {
+ for (auto const* link : route) {
// WIFI links are handled manually just above, so skip them now
if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
xbt_assert(link == src_wifi_link || link == dst_wifi_link,
if (src_wifi_link != nullptr)
get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(),
.05 / src_wifi_link->get_host_rate(src));
- for (auto const& link : back_route)
+ for (auto const* link : back_route)
if (link->get_sharing_policy() != s4u::Link::SharingPolicy::WIFI)
get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), .05);
// Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
return bandwidth_.peak * bandwidth_.scale;
}
-s4u::Link::SharingPolicy LinkImpl::get_sharing_policy()
+s4u::Link::SharingPolicy LinkImpl::get_sharing_policy() const
{
return get_constraint()->get_sharing_policy();
}
virtual void set_latency(double value) = 0;
/** @brief The sharing policy */
- virtual s4u::Link::SharingPolicy get_sharing_policy();
+ virtual s4u::Link::SharingPolicy get_sharing_policy() const;
/** @brief Check if the Link is used */
bool is_used() override;
void set_latency(double) override { THROW_UNIMPLEMENTED; }
void set_bandwidth_profile(profile::Profile* profile) override;
void set_latency_profile(profile::Profile* profile) override;
- s4u::Link::SharingPolicy get_sharing_policy() override {return sharing_policy_;}
+ s4u::Link::SharingPolicy get_sharing_policy() const override { return sharing_policy_; }
};
/**********
return rate.peak * rate.scale;
}
-s4u::Link::SharingPolicy NetworkWifiLink::get_sharing_policy()
+s4u::Link::SharingPolicy NetworkWifiLink::get_sharing_policy() const
{
return s4u::Link::SharingPolicy::WIFI;
}
/** @brief Get the AP rate associated to the host (or -1 if not associated to the AP) */
double get_host_rate(const s4u::Host* host);
- s4u::Link::SharingPolicy get_sharing_policy() override;
+ s4u::Link::SharingPolicy get_sharing_policy() const override;
void apply_event(kernel::profile::Event*, double) override { THROW_UNIMPLEMENTED; }
void set_bandwidth(double) override { THROW_UNIMPLEMENTED; }
void set_latency(double) override { THROW_UNIMPLEMENTED; }