Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix MC tests.
[simgrid.git] / src / surf / HostImpl.cpp
index 9b8ec04..8919977 100644 (file)
@@ -25,16 +25,16 @@ namespace surf {
 /************
  * Resource *
  ************/
-HostImpl::HostImpl(const std::string& name, s4u::Host* piface) : piface_(this), name_(name)
+HostImpl::HostImpl(const std::string& name, s4u::Host* piface) : piface_(name, this)
 {
-  xbt_assert(s4u::Host::by_name_or_null(name_) == nullptr, "Refusing to create a second host named '%s'.", get_cname());
-  s4u::Engine::get_instance()->host_register(name_, piface);
+  xbt_assert(s4u::Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name.c_str());
+  s4u::Engine::get_instance()->host_register(name, piface);
 }
 
-HostImpl::HostImpl(const std::string& name) : piface_(this), name_(name)
+HostImpl::HostImpl(const std::string& name) : piface_(name, this)
 {
-  xbt_assert(s4u::Host::by_name_or_null(name_) == nullptr, "Refusing to create a second host named '%s'.", get_cname());
-  s4u::Engine::get_instance()->host_register(name_, &piface_);
+  xbt_assert(s4u::Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name.c_str());
+  s4u::Engine::get_instance()->host_register(name, &piface_);
 }
 
 HostImpl::~HostImpl()
@@ -63,7 +63,7 @@ HostImpl::~HostImpl()
 void HostImpl::destroy()
 {
   s4u::Host::on_destruction(*this->get_iface());
-  s4u::Engine::get_instance()->host_unregister(std::string(name_));
+  s4u::Engine::get_instance()->host_unregister(std::string(get_iface()->get_name()));
   delete this;
 }