Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use a typed extension for simix::Host
[simgrid.git] / src / s4u / s4u_host.cpp
index 9c3b420..a75aea9 100644 (file)
 #include "src/surf/HostImpl.hpp"
 #include "xbt/log.h"
 #include "src/msg/msg_private.h"
-#include "src/simix/smx_process_private.h"
+#include "src/simix/ActorImpl.hpp"
 #include "src/simix/smx_private.h"
 #include "src/surf/cpu_interface.hpp"
 #include "simgrid/s4u/host.hpp"
 #include "simgrid/s4u/storage.hpp"
 
 int MSG_HOST_LEVEL = -1;
-int SIMIX_HOST_LEVEL = -1;
 int USER_HOST_LEVEL = -1;
 
 namespace simgrid {
@@ -69,10 +68,10 @@ Host* Host::by_name_or_create(const char* name)
 }
 
 Host *Host::current(){
-  smx_process_t smx_proc = SIMIX_process_self();
+  smx_actor_t smx_proc = SIMIX_process_self();
   if (smx_proc == nullptr)
     xbt_die("Cannot call Host::current() from the maestro context");
-  return SIMIX_process_get_host(smx_proc);
+  return smx_proc->host;
 }
 
 void Host::turnOn() {
@@ -133,7 +132,7 @@ void Host::setProperty(const char*key, const char *value){
 xbt_swag_t Host::processes()
 {
   return simgrid::simix::kernelImmediate([&]() {
-    return ((smx_host_priv_t)this->extension(SIMIX_HOST_LEVEL))->process_list;
+    return this->extension<simgrid::simix::Host>()->process_list;
   });
 }