X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/20c31352905d3bd7d3c334708424d3e356a0dd26..fb81c8bcd9bf351c3a575908adfa783b0b375e10:/src/simgrid/host.cpp diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 3bc21b18c7..5bf67431eb 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -19,7 +19,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts"); // FIXME: The following duplicates the content of s4u::Host -extern std::unordered_map host_list; +namespace simgrid { +namespace s4u { +extern std::map host_list; +} +} extern "C" { @@ -33,20 +37,20 @@ void sg_host_exit() * the tests. */ std::vector names = std::vector(); - for (auto kv : host_list) + for (auto kv : simgrid::s4u::host_list) names.push_back(kv.second->name()); std::sort(names.begin(), names.end()); for (auto name : names) - host_list.at(name)->destroy(); + simgrid::s4u::host_list.at(name)->destroy(); // host_list.clear(); This would be sufficient if the dict would contain smart_ptr. It's now useless } size_t sg_host_count() { - return host_list.size(); + return simgrid::s4u::host_list.size(); } /** @brief Returns the host list * @@ -93,7 +97,7 @@ xbt_dynar_t sg_hosts_as_dynar() { xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),nullptr); - for (auto kv : host_list) { + for (auto kv : simgrid::s4u::host_list) { simgrid::s4u::Host* host = kv.second; if (host && host->pimpl_netpoint && host->pimpl_netpoint->isHost()) xbt_dynar_push(res, &host); @@ -121,10 +125,15 @@ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){ } xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){ - return host->pimpl_->getAttachedStorageList(); + std::vector* storage_vector = new std::vector(); + xbt_dynar_t storage_dynar = xbt_dynar_new(sizeof(const char*), nullptr); + host->attachedStorages(storage_vector); + for (auto name : *storage_vector) + xbt_dynar_push(storage_dynar, &name); + delete storage_vector; + return storage_dynar; } - // =========== user-level functions =============== // ================================================ /** @brief Returns the total speed of a host */