X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/48efae676c3604efffe21365b2d525e578fd22e5..ccae9b178683382c85fbb8aaddfbc6d791c70f78:/src/s4u/s4u_storage.cpp diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index afc3401bcc..c6e33340c2 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -13,27 +13,24 @@ namespace simgrid { namespace s4u { boost::unordered_map *Storage::storages_ = new boost::unordered_map (); -Storage::Storage(std::string name, smx_storage_t inferior) { - name_ = name; - pimpl_ = inferior; - +Storage::Storage(std::string name, smx_storage_t inferior) : + name_(name), pimpl_(inferior) +{ storages_->insert({name, this}); } -Storage::~Storage() { - // TODO Auto-generated destructor stub -} +Storage::~Storage() = default; smx_storage_t Storage::inferior() { return pimpl_; } Storage &Storage::byName(const char*name) { - s4u::Storage *res = NULL; + s4u::Storage *res = nullptr; try { res = storages_->at(name); } catch (std::out_of_range& e) { smx_storage_t inferior = xbt_lib_get_elm_or_null(storage_lib,name); - if (inferior == NULL) + if (inferior == nullptr) xbt_die("Storage %s does not exist. Please only use the storages that are defined in your platform.", name); res = new Storage(name,inferior);