Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
continue removing content from HostImpl
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 20 Oct 2016 15:59:15 +0000 (17:59 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 20 Oct 2016 16:07:54 +0000 (18:07 +0200)
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/sg_platf.cpp
src/surf/virtual_machine.cpp

index 2408c68..b05ca95 100644 (file)
@@ -98,23 +98,15 @@ Action* HostModel::executeParallelTask(int host_nb, simgrid::s4u::Host** host_li
 /************
  * Resource *
  ************/
-HostImpl::HostImpl(simgrid::surf::HostModel* model, const char* name, xbt_dynar_t storage)
-    : PropertyHolder(nullptr), storage_(storage)
+HostImpl::HostImpl(s4u::Host* host, xbt_dynar_t storage) : PropertyHolder(nullptr), storage_(storage), piface_(host)
 {
+  piface_->pimpl_ = this;
   params_.ramsize = 0;
 }
 
 /** @brief use destroy() instead of this destructor */
 HostImpl::~HostImpl() = default;
 
-void HostImpl::attach(simgrid::s4u::Host* host)
-{
-  if (piface_ != nullptr)
-    xbt_die("Already attached to host %s", host->name().c_str());
-  host->pimpl_ = this;
-  piface_ = host;
-}
-
 simgrid::surf::Storage *HostImpl::findStorageOnMountList(const char* mount)
 {
   simgrid::surf::Storage *st = nullptr;
index d5d7933..56909eb 100644 (file)
@@ -69,19 +69,15 @@ public:
   /**
    * @brief Host constructor
    *
-   * @param model HostModel associated to this Host
-   * @param name The name of the Host
    * @param storage The Storage associated to this Host
    */
-  HostImpl(HostModel* model, const char* name, xbt_dynar_t storage);
+  HostImpl(s4u::Host* host, xbt_dynar_t storage);
 
   /* Host destruction logic */
   /**************************/
   virtual ~HostImpl();
 
 public:
-  void attach(simgrid::s4u::Host* host);
-
   /** @brief Return the storage of corresponding mount point */
   virtual simgrid::surf::Storage *findStorageOnMountList(const char* storage);
 
index 9294509..c002ec7 100644 (file)
@@ -111,8 +111,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
   if (host->speed_trace)
     cpu->setSpeedTrace(host->speed_trace);
 
-  simgrid::surf::HostImpl* hi = new simgrid::surf::HostImpl(surf_host_model, host->id, mount_list);
-  hi->attach(h);
+  new simgrid::surf::HostImpl(h, mount_list);
   xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void*)mount_list);
 
   mount_list = nullptr;
index aa27cf8..76d945a 100644 (file)
@@ -105,14 +105,11 @@ double VMModel::nextOccuringEvent(double now)
  ************/
 
 VirtualMachine::VirtualMachine(HostModel* model, const char* name, simgrid::s4u::Host* host_PM)
-    : HostImpl(model, name, nullptr /*storage*/), hostPM_(host_PM)
+    : HostImpl(new simgrid::s4u::Host(name), nullptr /*storage*/), hostPM_(host_PM)
 {
   /* Register this VM to the list of all VMs */
   allVms_.push_back(this);
 
-  piface_ = new simgrid::s4u::Host(name);
-  piface_->pimpl_ = this;
-
   /* Currently, a VM uses the network resource of its physical host. In
    * host_lib, this network resource object is referred from two different keys.
    * When deregistering the reference that points the network resource object