X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/274ff3a104711075a837ddc6e677e713b3348354..1847d1441271d076b3de449c8853031ea208ce8f:/src/s4u/s4u_storage.cpp diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index e3e776c928..092afea5ef 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -4,24 +4,25 @@ * 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 "xbt/lib.h" #include namespace simgrid { namespace s4u { -std::unordered_map* allStorages() + +std::map* allStorages() { std::unordered_map* map = surf::StorageImpl::storagesMap(); - std::unordered_map* res = new std::unordered_map; - for (auto s : *map) + std::map* res = new std::map; + for (auto const& s : *map) res->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface return res; } -Storage* Storage::byName(const char* name) +Storage* Storage::byName(std::string name) { surf::StorageImpl* res = surf::StorageImpl::byName(name); if (res == nullptr) @@ -29,46 +30,52 @@ Storage* Storage::byName(const char* name) return &res->piface_; } -const char* Storage::name() +const char* Storage::getName() { return pimpl_->cname(); } -const char* Storage::host() +const char* Storage::getType() { - return pimpl_->attach_; + return pimpl_->typeId_.c_str(); } -sg_size_t Storage::sizeFree() +Host* Storage::getHost() +{ + return attached_to_; +} + +sg_size_t Storage::getSizeFree() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getFreeSize(); }); } -sg_size_t Storage::sizeUsed() +sg_size_t Storage::getSizeUsed() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); }); } -sg_size_t Storage::size() { - return pimpl_->size_; +sg_size_t Storage::getSize() +{ + return pimpl_->getSize(); } -xbt_dict_t Storage::properties() +std::map* Storage::getProperties() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); }); } -const char* Storage::property(const char* key) +const char* Storage::getProperty(const char* key) { - return static_cast(xbt_dict_get_or_null(this->properties(), key)); + return this->pimpl_->getProperty(key); } -void Storage::setProperty(const char* key, char* value) +void Storage::setProperty(const char* key, const char* value) { - xbt_dict_set(this->properties(), key, value, nullptr); + simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); }); } -std::map* Storage::content() +std::map* Storage::getContent() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); }); }