X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6a6935148284f51d20bceed365ed0edea8b5a70e..12ad1e7c01058fada33cecf2d4c4cb8bf9874f9e:/src/s4u/s4u_storage.cpp diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index b1112a2c76..d8f004ac63 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -3,27 +3,27 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "../surf/StorageImpl.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Storage.hpp" #include "simgrid/simix.hpp" +#include "src/plugins/file_system/FileSystem.hpp" +#include "src/surf/StorageImpl.hpp" #include namespace simgrid { +namespace xbt { +template class Extendable; +} + namespace s4u { -// attached_to_ = Host::by_name_or_null(pimpl->attach_); -std::map* allStorages() +void getStorageList(std::map* whereTo) { - std::unordered_map* map = surf::StorageImpl::storagesMap(); - std::map* res = new std::map; - for (auto s : *map) - res->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface - - return res; + for (auto const& s : *surf::StorageImpl::storagesMap()) + whereTo->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface } -Storage* Storage::byName(const char* name) +Storage* Storage::byName(std::string name) { surf::StorageImpl* res = surf::StorageImpl::byName(name); if (res == nullptr) @@ -31,53 +31,50 @@ Storage* Storage::byName(const char* name) return &res->piface_; } -const char* Storage::name() +const std::string& Storage::getName() const { - return pimpl_->cname(); + return pimpl_->getName(); } -const char* Storage::type() +const char* Storage::getCname() const { - return pimpl_->typeId_; + return pimpl_->getCname(); } -Host* Storage::host() +const char* Storage::getType() { - return attached_to_; + return pimpl_->typeId_.c_str(); } -sg_size_t Storage::sizeFree() +Host* Storage::getHost() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getFreeSize(); }); + return attached_to_; } -sg_size_t Storage::sizeUsed() -{ - return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); }); -} -sg_size_t Storage::size() { - return pimpl_->size_; +std::map* Storage::getProperties() +{ + return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); }); } -xbt_dict_t Storage::properties() +const char* Storage::getProperty(std::string key) { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); }); + return this->pimpl_->getProperty(key); } -const char* Storage::property(const char* key) +void Storage::setProperty(std::string key, std::string value) { - return static_cast(xbt_dict_get_or_null(this->properties(), key)); + simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); }); } -void Storage::setProperty(const char* key, char* value) +sg_size_t Storage::read(sg_size_t size) { - xbt_dict_set(this->properties(), key, value, nullptr); + return simcall_storage_read(pimpl_, size); } -std::map* Storage::content() +sg_size_t Storage::write(sg_size_t size) { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); }); + return simcall_storage_write(pimpl_, size); } /*************