Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move some content out of parsing to the classes
[simgrid.git] / src / surf / sg_platf.cpp
index 1d9ddd0..25e3534 100644 (file)
@@ -19,6 +19,7 @@
 #include "src/include/simgrid/sg_config.h"
 #include "src/surf/xml/platf_private.hpp"
 
+#include "src/surf/HostImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
 #include "surf/surf_routing.h" // FIXME: brain dead public header
@@ -76,14 +77,9 @@ void sg_platf_exit() {
 void sg_platf_new_host(sg_platf_host_cbarg_t host)
 {
   simgrid::kernel::routing::AsImpl* current_routing = routing_get_current();
-  if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset)
-    current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::base;
-
-  simgrid::kernel::routing::NetCard *netcard =
-      new simgrid::kernel::routing::NetCardImpl(host->id, simgrid::kernel::routing::NetCard::Type::Host, current_routing);
 
   simgrid::s4u::Host* h = new simgrid::s4u::Host(host->id);
-  h->pimpl_netcard = netcard;
+  current_routing->attachHost(h);
 
   if (host->coord && strcmp(host->coord, "")) {
     unsigned int cursor;
@@ -110,7 +106,9 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
   if (host->speed_trace)
     cpu->setSpeedTrace(host->speed_trace);
 
-  surf_host_model->createHost(host->id, cpu, netcard, mount_list)->attach(h);
+  new simgrid::surf::HostImpl(h, mount_list);
+  xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, static_cast<void*>(mount_list));
+
   mount_list = nullptr;
 
   if (host->properties) {