A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
further split File and Storage
[simgrid.git]
/
src
/
s4u
/
s4u_storage.cpp
diff --git
a/src/s4u/s4u_storage.cpp
b/src/s4u/s4u_storage.cpp
index
58ad8f4
..
5cb09af
100644
(file)
--- a/
src/s4u/s4u_storage.cpp
+++ b/
src/s4u/s4u_storage.cpp
@@
-3,10
+3,10
@@
/* 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. */
/* 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 "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Storage.hpp"
#include "simgrid/simix.hpp"
+#include "src/surf/StorageImpl.hpp"
#include <unordered_map>
namespace simgrid {
#include <unordered_map>
namespace simgrid {
@@
-16,13
+16,13
@@
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*>;
{
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;
}
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)
{
surf::StorageImpl* res = surf::StorageImpl::byName(name);
if (res == nullptr)
@@
-30,9
+30,14
@@
Storage* Storage::byName(const char* name)
return &res->piface_;
}
return &res->piface_;
}
-const
char* Storage::getName()
+const
std::string& Storage::getName() const
{
{
- return pimpl_->cname();
+ return pimpl_->getName();
+}
+
+const char* Storage::getCname() const
+{
+ return pimpl_->getCname();
}
const char* Storage::getType()
}
const char* Storage::getType()
@@
-55,22
+60,27
@@
sg_size_t Storage::getSizeUsed()
return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); });
}
return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); });
}
+void Storage::decrUsedSize(sg_size_t size)
+{
+ simgrid::simix::kernelImmediate([this, size] { pimpl_->usedSize_ -= size; });
+}
+
sg_size_t Storage::getSize()
{
return pimpl_->getSize();
}
sg_size_t Storage::getSize()
{
return pimpl_->getSize();
}
-std::
unordered_
map<std::string, std::string>* Storage::getProperties()
+std::map<std::string, std::string>* Storage::getProperties()
{
return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); });
}
{
return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); });
}
-const char* Storage::getProperty(
const char*
key)
+const char* Storage::getProperty(
std::string
key)
{
return this->pimpl_->getProperty(key);
}
{
return this->pimpl_->getProperty(key);
}
-void Storage::setProperty(
const char* key, const char*
value)
+void Storage::setProperty(
std::string key, std::string
value)
{
simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); });
}
{
simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); });
}
@@
-80,6
+90,16
@@
std::map<std::string, sg_size_t>* Storage::getContent()
return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); });
}
return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); });
}
+sg_size_t Storage::read(sg_size_t size)
+{
+ return simcall_storage_read(pimpl_, size);
+}
+
+sg_size_t Storage::write(sg_size_t size)
+{
+ return simcall_storage_write(pimpl_, size);
+}
+
/*************
* Callbacks *
*************/
/*************
* Callbacks *
*************/