class HostImpl : public simgrid::surf::PropertyHolder {
public:
- /**
- * @brief Host constructor
- *
- * @param storage The Storage associated to this Host
- */
HostImpl(s4u::Host* host, xbt_dynar_t storage);
-
- /* Host destruction logic */
- /**************************/
virtual ~HostImpl();
public:
storage->content_type,
storage->properties);
- surf_storage_model->createStorage(storage->id,
- ((storage_type_t) stype)->type_id,
- storage->content,
- storage->content_type,
- storage->properties,
- storage->attach);
+ auto s = surf_storage_model->createStorage(storage->id, ((storage_type_t)stype)->type_id, storage->content,
+ storage->content_type, storage->attach);
+
+ if (storage->properties) {
+ xbt_dict_cursor_t cursor = nullptr;
+ char *key, *data;
+ xbt_dict_foreach (storage->properties, cursor, key, data)
+ s->setProperty(key, data);
+ xbt_dict_free(&storage->properties);
+ }
}
void sg_platf_new_storage_type(sg_platf_storage_type_cbarg_t storage_type){
* Resource *
************/
-Storage::Storage(Model *model, const char *name, xbt_dict_t props,
- lmm_system_t maxminSystem, double bread, double bwrite,
- double bconnection, const char* type_id, const char *content_name,
- const char *content_type, sg_size_t size, const char *attach)
- : Resource(model, name, lmm_constraint_new(maxminSystem, this, bconnection))
- , PropertyHolder(props)
- , contentType_(xbt_strdup(content_type))
- , size_(size), usedSize_(0)
- , typeId_(xbt_strdup(type_id))
- , writeActions_(std::vector<StorageAction*>())
+Storage::Storage(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+ double bconnection, const char* type_id, const char* content_name, const char* content_type,
+ sg_size_t size, const char* attach)
+ : Resource(model, name, lmm_constraint_new(maxminSystem, this, bconnection))
+ , PropertyHolder(nullptr)
+ , contentType_(xbt_strdup(content_type))
+ , size_(size)
+ , usedSize_(0)
+ , typeId_(xbt_strdup(type_id))
+ , writeActions_(std::vector<StorageAction*>())
{
content_ = parseContent(content_name);
attach_ = xbt_strdup(attach);
StorageModel();
~StorageModel();
- virtual Storage *createStorage(const char* id, const char* type_id,
- const char* content_name, const char* content_type,
- xbt_dict_t properties, const char *attach) = 0;
+ virtual Storage* createStorage(const char* id, const char* type_id, const char* content_name,
+ const char* content_type, const char* attach) = 0;
std::vector<Storage*> p_storageList;
};
* @param name The name of the Storage
* @param props Dictionary of properties associated to this Storage
*/
- Storage(Model *model, const char *name, xbt_dict_t props,
- lmm_system_t maxminSystem, double bread, double bwrite,
- double bconnection,
- const char* type_id, const char *content_name, const char *content_type,
- sg_size_t size, const char *attach);
+ Storage(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
+ const char* type_id, const char* content_name, const char* content_type, sg_size_t size, const char* attach);
~Storage();
namespace surf {
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
-Storage *StorageN11Model::createStorage(const char* id, const char* type_id,
- const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach)
+Storage* StorageN11Model::createStorage(const char* id, const char* type_id, const char* content_name,
+ const char* content_type, const char* attach)
{
xbt_assert(!surf_storage_resource_priv(surf_storage_resource_by_name(id)),
double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"),
"property Bconnection, storage",type_id);
- Storage *storage = new StorageN11(this, id, properties, maxminSystem_,
- Bread, Bwrite, Bconnection, type_id, (char *)content_name,
- content_type, storage_type->size, (char *) attach);
+ Storage* storage = new StorageN11(this, id, maxminSystem_, Bread, Bwrite, Bconnection, type_id, (char*)content_name,
+ content_type, storage_type->size, (char*)attach);
storageCreatedCallbacks(storage);
xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
- XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tproperties '%p'\n\t\tBread '%f'\n",
- id, type_id, properties, Bread);
+ XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tBread '%f'\n", id, type_id, Bread);
p_storageList.push_back(storage);
* Resource *
************/
-StorageN11::StorageN11(StorageModel *model, const char* name,
- xbt_dict_t properties, lmm_system_t maxminSystem, double bread,
- double bwrite, double bconnection, const char* type_id, char *content_name,
- const char *content_type, sg_size_t size, char *attach)
-: Storage(model, name, properties,
- maxminSystem, bread, bwrite, bconnection, type_id, content_name, content_type, size, attach) {
+StorageN11::StorageN11(StorageModel* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+ double bconnection, const char* type_id, char* content_name, const char* content_type,
+ sg_size_t size, char* attach)
+ : Storage(model, name, maxminSystem, bread, bwrite, bconnection, type_id, content_name, content_type, size, attach)
+{
XBT_DEBUG("Create resource with Bconnection '%f' Bread '%f' Bwrite '%f' and Size '%llu'", bconnection, bread, bwrite, size);
}
class StorageN11Model : public StorageModel {
public:
- Storage *createStorage(const char* id, const char* type_id,
- const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach) override;
+ Storage* createStorage(const char* id, const char* type_id, const char* content_name, const char* content_type,
+ const char* attach) override;
double nextOccuringEvent(double now) override;
void updateActionsState(double now, double delta) override;
};
class StorageN11 : public Storage {
public:
- StorageN11(StorageModel *model, const char* name, xbt_dict_t properties,
- lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
- const char* type_id, char *content_name, const char *content_type, sg_size_t size, char *attach);
+ StorageN11(StorageModel* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+ double bconnection, const char* type_id, char* content_name, const char* content_type, sg_size_t size,
+ char* attach);
StorageAction *open(const char* mount, const char* path);
StorageAction *close(surf_file_t fd);
StorageAction *ls(const char *path);
- StorageAction *read(surf_file_t fd, sg_size_t size); //FIXME:why we have a useless param *??
- StorageAction *write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param *??
+ StorageAction* read(surf_file_t fd, sg_size_t size);
+ StorageAction* write(surf_file_t fd, sg_size_t size);
void rename(const char *src, const char *dest);
};