#ifndef INCLUDE_SIMGRID_S4U_STORAGE_HPP_
#define INCLUDE_SIMGRID_S4U_STORAGE_HPP_
+#include <string>
+
#include <boost/unordered_map.hpp>
-#include "xbt/base.h"
-#include "simgrid/simix.h"
+
+#include <xbt/base.h>
+
+#include <simgrid/simix.h>
#include <simgrid/s4u/forward.hpp>
namespace simgrid {
namespace s4u {
XBT_PUBLIC_CLASS Storage {
-private:
+ friend s4u::Engine;
+
Storage(std::string name, smx_storage_t inferior);
virtual ~Storage();
+
public:
/** Retrieve a Storage by its name. It must exist in the platform file */
static Storage &byName(const char* name);
const char *name();
- sg_size_t size_free();
- sg_size_t size_used();
+ sg_size_t sizeFree();
+ sg_size_t sizeUsed();
/** Retrieve the total amount of space of this storage element */
sg_size_t size();
*/
protected:
smx_storage_t inferior();
-private:
- static boost::unordered_map<std::string, Storage *> *storages;
- std::string p_name;
- smx_storage_t p_inferior;
-
public:
- void set_userdata(void *data) {p_userdata = data;}
- void *userdata() {return p_userdata;}
+ void setUserdata(void *data) {userdata_ = data;}
+ void *userdata() {return userdata_;}
+
private:
- void *p_userdata = NULL;
+ static boost::unordered_map<std::string, Storage *> *storages_;
+ std::string name_;
+ size_t size_;
+ smx_storage_t pimpl_ = nullptr;
+ void *userdata_ = nullptr;
};
} /* namespace s4u */