class DiskImpl : public Resource, public surf::PropertyHolder {
bool currently_destroying_ = false;
s4u::Host* host_ = nullptr;
+ s4u::Disk piface_;
public:
DiskImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double read_bw, double bwrite_bw);
~DiskImpl() override;
/** @brief Public interface */
- s4u::Disk piface_;
s4u::Disk* get_iface() { return &piface_; }
/** @brief Check if the Storage is used (if an action currently uses its resources) */
bool is_used() override;
continue;
XBT_DEBUG("Update link %s", link->get_cname());
- LinkEnergy* link_energy = link->piface_.extension<LinkEnergy>();
+ LinkEnergy* link_energy = link->get_iface()->extension<LinkEnergy>();
link_energy->init_watts_range_list();
link_energy->update();
}
simgrid::kernel::resource::NetworkAction const& action, simgrid::kernel::resource::Action::State /* previous */) {
for (simgrid::kernel::resource::LinkImpl* link : action.links()) {
if (link != nullptr)
- link->piface_.extension<LinkEnergy>()->update();
+ link->get_iface()->extension<LinkEnergy>()->update();
}
});
std::vector<kernel::resource::LinkImpl*> linkImpls;
this->route_to(dest, linkImpls, latency);
for (kernel::resource::LinkImpl* const& l : linkImpls)
- links.push_back(&l->piface_);
+ links.push_back(l->get_iface());
}
/** @brief Just like Host::routeTo, but filling an array of link implementations */
if (mounts_ == nullptr) {
mounts_ = new std::unordered_map<std::string, Storage*>();
for (auto const& m : this->pimpl_->storage_) {
- mounts_->insert({m.first, &m.second->piface_});
+ mounts_->insert({m.first, m.second->get_iface()});
}
}
return *mounts_;
{
std::vector<s4u::Disk*> disks;
for (auto const& d : disks_)
- disks.push_back(&d->piface_);
+ disks.push_back(d->get_iface());
return disks;
}
std::vector<const char*> storages;
for (auto const& s : storage_)
if (s.second->get_host() == piface_->get_cname())
- storages.push_back(s.second->piface_.get_cname());
+ storages.push_back(s.second->get_iface()->get_cname());
return storages;
}
*/
class XBT_PRIVATE HostImpl : public simgrid::surf::PropertyHolder {
std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
+ s4u::Host* piface_ = nullptr; // FIXME: why don't we store a s4u::Host here as we do everywhere else?
public:
friend simgrid::vm::VirtualMachineImpl;
std::map<std::string, kernel::resource::StorageImpl*> storage_;
std::vector<kernel::resource::DiskImpl*> disks_;
- s4u::Host* piface_ = nullptr;
+ s4u::Host* get_iface() { return piface_; }
void turn_on();
void turn_off(kernel::actor::ActorImpl* issuer);
* @details A Storage represent a storage unit (e.g.: hard drive, usb key)
*/
class StorageImpl : public Resource, public surf::PropertyHolder {
+ s4u::Storage piface_;
+
public:
/** @brief Storage constructor */
StorageImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double bread, double bwrite,
~StorageImpl() override;
- /** @brief Public interface */
- s4u::Storage piface_;
-
+ s4u::Storage* get_iface() { return &piface_; }
/** @brief Check if the Storage is used (if an action currently uses its resources) */
bool is_used() override;
if (policy == s4u::Link::SharingPolicy::FATPIPE)
get_constraint()->unshare();
- simgrid::s4u::Link::on_creation(this->piface_);
+ simgrid::s4u::Link::on_creation(*get_iface());
}
void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
*/
class LinkImpl : public Resource, public surf::PropertyHolder {
bool currently_destroying_ = false;
+ s4u::Link piface_;
protected:
LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint);
void destroy(); // Must be called instead of the destructor
/** @brief Public interface */
- s4u::Link piface_;
+ s4u::Link* get_iface() { return &piface_; }
/** @brief Get the bandwidth in bytes per second of current Link */
virtual double get_bandwidth();
for (auto bandwidth : bandwidths)
bandwidths_.push_back({bandwidth, 1.0, nullptr});
- simgrid::s4u::Link::on_creation(this->piface_);
+ simgrid::s4u::Link::on_creation(*get_iface());
}
void NetworkWifiLink::set_host_rate(s4u::Host* host, int rate_level)
if (policy == s4u::Link::SharingPolicy::FATPIPE)
get_constraint()->unshare();
- s4u::Link::on_creation(this->piface_);
+ s4u::Link::on_creation(*get_iface());
}
kernel::resource::CpuAction* CpuL07::execution_start(double size)
: StorageImpl(model, name, maxminSystem, bread, bwrite, type_id, content_name, size, attach)
{
XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
- s4u::Storage::on_creation(this->piface_);
+ s4u::Storage::on_creation(*get_iface());
}
StorageAction* StorageN11::io_start(sg_size_t size, s4u::Io::OpType type)