X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/232df979b87bc271f4fbb61a2059c6539bc23012..0b364cf4c773d809e4ca7a8d8998ee54f5f7ebfe:/src/s4u/s4u_host.cpp?ds=sidebyside diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index a21b4d01ec..b9971952df 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -29,6 +29,11 @@ int ROUTING_HOST_LEVEL; int USER_HOST_LEVEL; namespace simgrid { + +namespace xbt { +template class Extendable; +} + namespace s4u { simgrid::xbt::signal Host::onCreation; @@ -42,8 +47,7 @@ Host::Host(const char* name) Host::~Host() { delete pimpl_cpu; - if (mounts != NULL) - delete mounts; + delete mounts; } Host *Host::by_name(std::string name) { @@ -53,6 +57,19 @@ Host *Host::by_name(std::string name) { xbt_die("No such host: %s", name.c_str()); return host; } +Host* Host::by_name_or_null(const char* name) +{ + return (Host*) xbt_dict_get_or_null(host_list, name); +} +Host* Host::by_name_or_create(const char* name) +{ + Host* host = by_name_or_null(name); + if (host == nullptr) { + host = new Host(name); + xbt_dict_set(host_list, name, host, NULL); + } + return host; +} Host *Host::current(){ smx_process_t smx_proc = SIMIX_process_self(); @@ -136,21 +153,6 @@ int Host::core_count() { return pimpl_cpu->getCore(); } -Host* Host::by_name_or_null(const char* name) -{ - return (Host*) xbt_dict_get_or_null(host_list, name); -} - -Host* Host::by_name_or_create(const char* name) -{ - Host* host = by_name_or_null(name); - if (host == nullptr) { - host = new Host(name); - xbt_dict_set(host_list, name, host, NULL); - } - return host; -} - /** @brief Set the pstate at which the host should run */ void Host::set_pstate(int pstate_index) {