Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adjust code after rebase.
authorBruno Donassolo <bruno.donassolo@inria.fr>
Thu, 4 Mar 2021 14:08:53 +0000 (15:08 +0100)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Tue, 9 Mar 2021 14:17:12 +0000 (15:17 +0100)
surf_network_model doesn't exist anymore

src/surf/network_cm02.cpp
src/surf/network_interface.cpp
src/surf/network_ns3.cpp
src/surf/ptask_L07.cpp

index 5472751..5793cf1 100644 (file)
@@ -100,11 +100,16 @@ NetworkCm02Model::NetworkCm02Model()
 LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
                                         s4u::Link::SharingPolicy policy)
 {
-  if (policy == s4u::Link::SharingPolicy::WIFI)
-    return (new NetworkWifiLink(name, bandwidths, get_maxmin_system()))->set_model(this);
+  LinkImpl* link;
+  if (policy == s4u::Link::SharingPolicy::WIFI) {
+    link = new NetworkWifiLink(name, bandwidths, get_maxmin_system());
+  } else {
+    xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
+    link = new NetworkCm02Link(name, bandwidths[0], policy, get_maxmin_system());
+  }
 
-  xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
-  return (new NetworkCm02Link(name, bandwidths[0], policy, get_maxmin_system()))->set_model(this);
+  link->set_model(this);
+  return link;
 }
 
 void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
index 359e820..c87e5e0 100644 (file)
@@ -153,6 +153,7 @@ void LinkImpl::turn_off()
 
 void LinkImpl::seal()
 {
+  xbt_assert(this->get_model(), "Cannot seal Link(%s) without setting the Network model first", this->get_cname());
   Resource::seal();
   simgrid::s4u::Link::on_creation(*get_iface());
 }
index 7320bf5..80ebc3b 100644 (file)
@@ -333,7 +333,9 @@ LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vecto
                                        s4u::Link::SharingPolicy policy)
 {
   xbt_assert(bandwidths.size() == 1, "ns-3 links must use only 1 bandwidth.");
-  return new LinkNS3(name, bandwidths[0], policy);
+  auto link = new LinkNS3(name, bandwidths[0], policy);
+  link->set_model(this);
+  return link;
 }
 
 Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
index 3fa7c27..6961a27 100644 (file)
@@ -237,7 +237,9 @@ kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name
                                                          s4u::Link::SharingPolicy policy)
 {
   xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth.");
-  return new LinkL07(name, bandwidths[0], policy, get_maxmin_system());
+  auto link = new LinkL07(name, bandwidths[0], policy, get_maxmin_system());
+  link->set_model(this);
+  return link;
 }
 
 /************