* 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 <unordered_map>
namespace simgrid {
namespace s4u {
+
std::map<std::string, Storage*>* allStorages()
{
std::unordered_map<std::string, surf::StorageImpl*>* map = surf::StorageImpl::storagesMap();
std::map<std::string, Storage*>* res = new std::map<std::string, Storage*>;
- for (auto s : *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)
return &res->piface_;
}
-const char* Storage::name()
+const std::string& Storage::getName() const
+{
+ return pimpl_->getName();
+}
+
+const char* Storage::getCname() const
{
- return pimpl_->cname();
+ return pimpl_->getCname();
}
-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<std::string, std::string>* 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<const char*>(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<std::string, sg_size_t*>* Storage::content()
+std::map<std::string, sg_size_t>* Storage::getContent()
{
return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); });
}