X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f1e469ce075c0a1ad21a7fd0fdb587f9a3cb5289..e595b191c3e10a96a9d896f6ecec9c4df6707aef:/include/simgrid/s4u/Storage.hpp diff --git a/include/simgrid/s4u/Storage.hpp b/include/simgrid/s4u/Storage.hpp index 305bbba87d..38e30b7e49 100644 --- a/include/simgrid/s4u/Storage.hpp +++ b/include/simgrid/s4u/Storage.hpp @@ -17,44 +17,48 @@ namespace simgrid { namespace s4u { +XBT_ATTRIB_PUBLIC std::map* allStorages(); + XBT_PUBLIC_CLASS Storage { friend s4u::Engine; - - Storage(std::string name, smx_storage_t inferior); + friend simgrid::surf::StorageImpl; public: - Storage() = default; - virtual ~Storage(); + explicit Storage(surf::StorageImpl * pimpl) : pimpl_(pimpl) {} + virtual ~Storage() = default; /** Retrieve a Storage by its name. It must exist in the platform file */ - static Storage& byName(const char* name); - const char* name(); - const char* host(); - sg_size_t sizeFree(); - sg_size_t sizeUsed(); - /** Retrieve the total amount of space of this storage element */ - sg_size_t size(); - xbt_dict_t properties(); - const char* property(const char* key); - void setProperty(const char* key, char* value); - std::map* content(); - std::unordered_map* allStorages(); - -protected: - smx_storage_t inferior(); + static Storage* byName(const char* name); + const char* getName(); + const char* getType(); + Host* getHost(); + sg_size_t getSize(); /** Retrieve the total amount of space of this storage element */ + sg_size_t getSizeFree(); + sg_size_t getSizeUsed(); + + std::map* getProperties(); + const char* getProperty(const char* key); + void setProperty(const char* key, const char* value); + std::map* getContent(); -public: void setUserdata(void* data) { userdata_ = data; } - void* userdata() { return userdata_; } + void* getUserdata() { return userdata_; } -private: - static std::unordered_map* storages_; + surf::StorageImpl* getImpl() { return pimpl_; } - std::string hostname_; + /* The signals */ + /** @brief Callback signal fired when a new Link is created */ + static simgrid::xbt::signal onCreation; + + /** @brief Callback signal fired when a Link is destroyed */ + static simgrid::xbt::signal onDestruction; + + Host* attached_to_ = nullptr; + +private: + surf::StorageImpl* const pimpl_ = nullptr; std::string name_; - sg_size_t size_ = 0; - smx_storage_t pimpl_ = nullptr; - void* userdata_ = nullptr; + void* userdata_ = nullptr; }; } /* namespace s4u */