X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/783dacaf0fb0e39b260f8bfddc990df8603f657d..274ff3a104711075a837ddc6e677e713b3348354:/src/surf/StorageImpl.cpp diff --git a/src/surf/StorageImpl.cpp b/src/surf/StorageImpl.cpp index 3eb9910a3d..d15ab37d50 100644 --- a/src/surf/StorageImpl.cpp +++ b/src/surf/StorageImpl.cpp @@ -31,6 +31,17 @@ simgrid::xbt::signal storageDestructedCallbacks; simgrid::xbt::signal storageStateChangedCallbacks; // signature: wasOn, isOn simgrid::xbt::signal storageActionStateChangedCallbacks; +/* List of storages */ +std::unordered_map* StorageImpl::storages = + new std::unordered_map(); + +StorageImpl* StorageImpl::byName(const char* name) +{ + if (storages->find(name) == storages->end()) + return nullptr; + return storages->at(name); +} + /********* * Model * *********/ @@ -53,6 +64,7 @@ StorageModel::~StorageModel() StorageImpl::StorageImpl(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite, const char* type_id, const char* content_name, sg_size_t size, const char* attach) : Resource(model, name, lmm_constraint_new(maxminSystem, this, MAX(bread, bwrite))) + , piface_(this) , size_(size) , usedSize_(0) , typeId_(xbt_strdup(type_id)) @@ -64,6 +76,7 @@ StorageImpl::StorageImpl(Model* model, const char* name, lmm_system_t maxminSyst XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size); constraintRead_ = lmm_constraint_new(maxminSystem, this, bread); constraintWrite_ = lmm_constraint_new(maxminSystem, this, bwrite); + storages->insert({name, this}); } StorageImpl::~StorageImpl()