Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
One method to set netzone's relationship
[simgrid.git] / src / s4u / s4u_Netzone.cpp
index fa6f0c2..dc6f3d4 100644 (file)
@@ -47,9 +47,9 @@ std::vector<NetZone*> NetZone::get_children() const
   return res;
 }
 
-NetZone* NetZone::add_child(const NetZone* new_zone)
+NetZone* NetZone::add_child(NetZone* new_zone)
 {
-  pimpl_->add_child(new_zone->get_impl());
+  new_zone->set_parent(this);
   return this;
 }
 
@@ -75,7 +75,7 @@ NetZone* NetZone::get_parent() const
 
 NetZone* NetZone::set_parent(const NetZone* parent)
 {
-  pimpl_->set_parent(parent->get_impl());
+  kernel::actor::simcall([this, parent] { pimpl_->set_parent(parent->get_impl()); });
   return this;
 }
 
@@ -143,6 +143,11 @@ void NetZone::extract_xbt_graph(const s_xbt_graph_t* graph, std::map<std::string
   pimpl_->get_graph(graph, nodes, edges);
 }
 
+void NetZone::seal()
+{
+  kernel::actor::simcall([this] { pimpl_->seal(); });
+}
+
 s4u::Host* NetZone::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
 {
   return kernel::actor::simcall(
@@ -153,15 +158,12 @@ s4u::Host* NetZone::create_host(const std::string& name, const std::vector<std::
   return create_host(name, Host::convert_pstate_speed_vector(speed_per_pstate));
 }
 
-s4u::Link* NetZone::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                s4u::Link::SharingPolicy policy)
+s4u::Link* NetZone::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
-  return kernel::actor::simcall(
-      [this, &name, &bandwidths, &policy] { return pimpl_->create_link(name, bandwidths, policy); });
+  return kernel::actor::simcall([this, &name, &bandwidths] { return pimpl_->create_link(name, bandwidths); });
 }
 
-s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::string>& bandwidths,
-                                s4u::Link::SharingPolicy policy)
+s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::string>& bandwidths)
 {
   std::vector<double> bw;
   bw.reserve(bandwidths.size());
@@ -174,7 +176,7 @@ s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::
                                   std::string(". Invalid bandwidth: ") + speed_str);
     }
   }
-  return create_link(name, bw, policy);
+  return create_link(name, bw);
 }
 
 } // namespace s4u