Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more fluent version
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 1 Mar 2021 09:34:58 +0000 (10:34 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 1 Mar 2021 11:27:12 +0000 (12:27 +0100)
src/kernel/resource/DiskImpl.cpp
src/kernel/resource/DiskImpl.hpp
src/s4u/s4u_Host.cpp

index c0cfd58..de8c7bb 100644 (file)
@@ -34,6 +34,11 @@ DiskModel::~DiskModel()
 /************
  * Resource *
  ************/
+DiskImpl* DiskImpl::set_host(s4u::Host* host)
+{
+  host_ = host;
+  return this;
+}
 
 DiskImpl* DiskImpl::set_read_bandwidth(double read_bw)
 {
index 6003291..e426216 100644 (file)
@@ -70,8 +70,8 @@ public:
   /** @brief Public interface */
   const s4u::Disk* get_iface() const { return &piface_; }
   s4u::Disk* get_iface() { return &piface_; }
+  DiskImpl* set_host(s4u::Host* host);
   s4u::Host* get_host() const { return host_; }
-  void set_host(s4u::Host* host) { host_ = host; }
 
   DiskImpl* set_read_bandwidth(double read_bw);
   double get_read_bandwidth() const { return read_bw_; }
index 0b4d103..bfe5c67 100644 (file)
@@ -269,9 +269,7 @@ std::vector<Disk*> Host::get_disks() const
 
 Disk* Host::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
 {
-  auto pimpl = surf_disk_model->create_disk(name, read_bandwidth, write_bandwidth);
-  pimpl->set_host(this);
-  return pimpl->get_iface();
+  return surf_disk_model->create_disk(name, read_bandwidth, write_bandwidth)->set_host(this)->get_iface();
 }
 
 void Host::add_disk(const Disk* disk)