From c527cde5e1ee1bfe22dd33b3bbb77aaae8bcdcb1 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 20 Oct 2016 17:59:15 +0200 Subject: [PATCH] continue removing content from HostImpl --- src/surf/HostImpl.cpp | 12 ++---------- src/surf/HostImpl.hpp | 6 +----- src/surf/sg_platf.cpp | 3 +-- src/surf/virtual_machine.cpp | 5 +---- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 2408c687cb..b05ca954c3 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -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; diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index d5d7933aff..56909eb1ed 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -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); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 9294509daa..c002ec7d21 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -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; diff --git a/src/surf/virtual_machine.cpp b/src/surf/virtual_machine.cpp index aa27cf84cc..76d945a257 100644 --- a/src/surf/virtual_machine.cpp +++ b/src/surf/virtual_machine.cpp @@ -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 -- 2.20.1