Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Two small sonar fixes
[simgrid.git] / src / kernel / resource / DiskImpl.hpp
index 60032910e5cd44087b9f61cde4e7ce48f603e1cc..8f7af7b5d8db7c1d07283177077ee153d696c671 100644 (file)
@@ -20,8 +20,6 @@
  * Model *
  *********/
 
-XBT_PUBLIC_DATA simgrid::kernel::resource::DiskModel* surf_disk_model;
-
 namespace simgrid {
 namespace kernel {
 namespace resource {
@@ -39,7 +37,7 @@ public:
   DiskModel();
   DiskModel(const DiskModel&) = delete;
   DiskModel& operator=(const DiskModel&) = delete;
-  ~DiskModel() override;
+  ~DiskModel() = default;
 
   virtual DiskImpl* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) = 0;
 };
@@ -47,7 +45,7 @@ public:
 /************
  * Resource *
  ************/
-class DiskImpl : public Resource, public xbt::PropertyHolder {
+class DiskImpl : public Resource_T<DiskImpl>, public xbt::PropertyHolder {
   s4u::Host* host_           = nullptr;
   s4u::Disk piface_;
   double read_bw_ = -1.0;
@@ -60,18 +58,17 @@ protected:
 
 public:
   DiskImpl(const std::string& name, double read_bandwidth, double write_bandwidth)
-    : Resource(name),
-      piface_(name, this),
-      read_bw_(read_bandwidth),
-      write_bw_(write_bandwidth){}
+      : Resource_T(name), piface_(name, this), read_bw_(read_bandwidth), write_bw_(write_bandwidth)
+  {
+  }
   DiskImpl(const DiskImpl&) = delete;
   DiskImpl& operator=(const DiskImpl&) = delete;
 
   /** @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_; }
@@ -91,7 +88,7 @@ public:
   void turn_on() override;
   void turn_off() override;
 
-  void seal();
+  void seal() override;
   void destroy(); // Must be called instead of the destructor
   virtual DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) = 0;
   virtual DiskAction* read(sg_size_t size)                           = 0;