X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e1a5484101efbff9c8d982a0c4650f7953ee7e2f..36fccba5f4f2b4c32e97c4e56911eb5bd804f7c9:/src/s4u/s4u_Disk.cpp diff --git a/src/s4u/s4u_Disk.cpp b/src/s4u/s4u_Disk.cpp index f8f10f81f2..29adfd31d4 100644 --- a/src/s4u/s4u_Disk.cpp +++ b/src/s4u/s4u_Disk.cpp @@ -20,10 +20,14 @@ xbt::signal Disk::on_creation; xbt::signal Disk::on_destruction; xbt::signal Disk::on_state_change; -Disk* Disk::set_name(const std::string& name) +const std::string& Disk::get_name() const { - name_ = name; - return this; + return pimpl_->get_name(); +} + +const char* Disk::get_cname() const +{ + return pimpl_->get_cname(); } Disk* Disk::set_read_bandwidth(double read_bw) @@ -81,6 +85,27 @@ Disk* Disk::set_properties(const std::unordered_map& p return this; } +Disk* Disk::set_state_profile(kernel::profile::Profile* profile) +{ + xbt_assert(not pimpl_->is_sealed(), "Cannot set a state profile once the Disk is sealed"); + kernel::actor::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); + return this; +} + +Disk* Disk::set_read_bandwidth_profile(kernel::profile::Profile* profile) +{ + xbt_assert(not pimpl_->is_sealed(), "Cannot set a bandwidth profile once the Disk is sealed"); + kernel::actor::simcall([this, profile]() { this->pimpl_->set_read_bandwidth_profile(profile); }); + return this; +} + +Disk* Disk::set_write_bandwidth_profile(kernel::profile::Profile* profile) +{ + xbt_assert(not pimpl_->is_sealed(), "Cannot set a bandwidth profile once the Disk is sealed"); + kernel::actor::simcall([this, profile]() { this->pimpl_->set_write_bandwidth_profile(profile); }); + return this; +} + IoPtr Disk::io_init(sg_size_t size, Io::OpType type) const { return Io::init()->set_disk(this)->set_size(size)->set_op_type(type); @@ -106,6 +131,17 @@ sg_size_t Disk::write(sg_size_t size) const return IoPtr(io_init(size, Io::OpType::WRITE))->vetoable_start()->wait()->get_performed_ioops(); } +Disk* Disk::set_sharing_policy(Disk::Operation op, Disk::SharingPolicy policy, const NonLinearResourceCb& cb) +{ + kernel::actor::simcall([this, op, policy, &cb] { pimpl_->set_sharing_policy(op, policy, cb); }); + return this; +} + +Disk::SharingPolicy Disk::get_sharing_policy(Operation op) const +{ + return this->pimpl_->get_sharing_policy(op); +} + Disk* Disk::seal() { kernel::actor::simcall([this]{ pimpl_->seal(); });