Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference parameters in src/surf/.
[simgrid.git] / src / surf / network_cm02.cpp
index 4c04ee8..d9e3a7e 100644 (file)
@@ -104,7 +104,6 @@ LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vect
 void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
 {
   while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) {
-
     auto* action = static_cast<NetworkCm02Action*>(get_action_heap().pop());
     XBT_DEBUG("Something happened to action %p", action);
 
@@ -242,14 +241,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
     if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
       NetworkWifiLink* wifi_link = static_cast<NetworkWifiLink*>(link);
 
-      double rate = wifi_link->get_host_rate(src);
-      if (rate == -1)
-        rate = wifi_link->get_host_rate(dst);
-      xbt_assert(rate != -1,
+      double wifi_rate = wifi_link->get_host_rate(src);
+      if (wifi_rate == -1.0)
+        wifi_rate = wifi_link->get_host_rate(dst);
+      xbt_assert(wifi_rate != -1.0,
                  "None of the source (%s) or destination (%s) is connected to the Access Point '%s'. "
                  "Please use set_host_rate() on all stations.",
                  src->get_cname(), dst->get_cname(), link->get_cname());
-      get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / rate);
+      get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / wifi_rate);
 
     } else {
       get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0);
@@ -306,7 +305,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& nam
   if (policy == s4u::Link::SharingPolicy::FATPIPE)
     get_constraint()->unshare();
 
-  simgrid::s4u::Link::on_creation(this->piface_);
+  simgrid::s4u::Link::on_creation(*get_iface());
 }
 
 void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
@@ -346,7 +345,7 @@ void NetworkCm02Link::set_bandwidth(double value)
   if (sg_weight_S_parameter > 0) {
     double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);
 
-    kernel::lmm::Variable* var;
+    const kernel::lmm::Variable* var;
     const kernel::lmm::Element* elem     = nullptr;
     const kernel::lmm::Element* nextelem = nullptr;
     int numelem                  = 0;
@@ -362,7 +361,7 @@ void NetworkCm02Link::set_bandwidth(double value)
 void NetworkCm02Link::set_latency(double value)
 {
   double delta                 = value - latency_.peak;
-  kernel::lmm::Variable* var   = nullptr;
+  const kernel::lmm::Variable* var;
   const kernel::lmm::Element* elem     = nullptr;
   const kernel::lmm::Element* nextelem = nullptr;
   int numelem                  = 0;