#include "simgrid/s4u/Storage.hpp"
#include "simgrid/storage.h"
#include "src/surf/StorageImpl.hpp"
#include "simgrid/s4u/Storage.hpp"
#include "simgrid/storage.h"
#include "src/surf/StorageImpl.hpp"
-void getStorageList(std::map<std::string, Storage*>* whereTo)
-{
- for (auto const& s : simgrid::s4u::Engine::get_instance()->get_all_storages())
- whereTo->insert({s->get_name(), s});
-}
+simgrid::xbt::signal<void(s4u::Storage&)> Storage::on_creation;
+simgrid::xbt::signal<void(s4u::Storage&)> Storage::on_destruction;
+simgrid::xbt::signal<void(s4u::Storage&)> Storage::on_state_change;
Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
{
simgrid::s4u::Engine::get_instance()->storage_register(name, this);
}
Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
{
simgrid::s4u::Engine::get_instance()->storage_register(name, this);
}
-/*************
- * Callbacks *
- *************/
-simgrid::xbt::signal<void(s4u::Storage&)> Storage::onCreation;
-simgrid::xbt::signal<void(s4u::Storage&)> Storage::onDestruction;
+sg_size_t Storage::write(sg_size_t size)
+{
+ IoPtr i = io_init(size, Io::OpType::WRITE);
+ i->start()->wait();
+ return i->get_performed_ioops();
+}
const char* sg_storage_get_host(sg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters");
const char* sg_storage_get_host(sg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters");
-/** \ingroup sg_storage_management
- * \brief Returns a xbt_dict_t consisting of the list of properties assigned to this storage
- * \param storage a storage
- * \return a dict containing the properties
+/** @ingroup sg_storage_management
+ * @brief Returns a xbt_dict_t consisting of the list of properties assigned to this storage
+ * @param storage a storage
+ * @return a dict containing the properties
*/
xbt_dict_t sg_storage_get_properties(sg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters (storage is nullptr)");
xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
*/
xbt_dict_t sg_storage_get_properties(sg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters (storage is nullptr)");
xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
- * \param storage a storage
- * \param name a property name
- * \param value what to change the property to
+ * @param storage a storage
+ * @param name a property name
+ * @param value what to change the property to
- * \param storage a storage
- * \param name a property name
- * \return value of a property (or nullptr if property not set)
+ * @param storage a storage
+ * @param name a property name
+ * @return value of a property (or nullptr if property not set)
-/** \ingroup sg_storage_management
- * \brief Finds a sg_storage_t using its name.
- * \param name the name of a storage
- * \return the corresponding storage
+/** @ingroup sg_storage_management
+ * @brief Finds a sg_storage_t using its name.
+ * @param name the name of a storage
+ * @return the corresponding storage
-/** \ingroup sg_storage_management
- * \brief Returns a dynar containing all the storage elements declared at a given point of time
+/** @ingroup sg_storage_management
+ * @brief Returns a dynar containing all the storage elements declared at a given point of time
void* sg_storage_get_data(sg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters");
void* sg_storage_get_data(sg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters");