* Model *
*********/
-XBT_PUBLIC_DATA simgrid::kernel::resource::DiskModel* surf_disk_model;
-
namespace simgrid {
namespace kernel {
namespace resource {
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;
};
/************
* 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;
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_; }
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;