Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move some content out of parsing to the classes
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 24 Oct 2016 20:40:01 +0000 (22:40 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 24 Oct 2016 20:44:25 +0000 (22:44 +0200)
src/kernel/routing/AsImpl.cpp
src/kernel/routing/AsImpl.hpp
src/simix/ActorImpl.cpp
src/surf/sg_platf.cpp

index 595568f..9c60a50 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "xbt/log.h"
 
 
 #include "xbt/log.h"
 
+#include "simgrid/s4u/host.hpp"
 #include "src/kernel/routing/AsImpl.hpp"
 #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
 
 #include "src/kernel/routing/AsImpl.hpp"
 #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
 
@@ -19,13 +20,20 @@ namespace simgrid {
     xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL),
                "Refusing to create a second AS called '%s'.", name);
 
     xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL),
                "Refusing to create a second AS called '%s'.", name);
 
-    netcard_ = new simgrid::kernel::routing::NetCardImpl(name, simgrid::kernel::routing::NetCard::Type::As,
-                                                         static_cast<AsImpl*>(father));
+    netcard_ = new NetCardImpl(name, NetCard::Type::As, static_cast<AsImpl*>(father));
     xbt_lib_set(as_router_lib, name, ROUTING_ASR_LEVEL, static_cast<void*>(netcard_));
     xbt_lib_set(as_router_lib, name, ROUTING_ASR_LEVEL, static_cast<void*>(netcard_));
-    XBT_DEBUG("Having set name '%s' id '%d'", name, netcard_->id());
+    XBT_DEBUG("AS '%s' created with the id '%d'", name, netcard_->id());
   }
   AsImpl::~AsImpl() = default;
 
   }
   AsImpl::~AsImpl() = default;
 
+  void AsImpl::attachHost(s4u::Host* host)
+  {
+    if (hierarchy_ == RoutingMode::unset)
+      hierarchy_ = RoutingMode::base;
+
+    host->pimpl_netcard = new NetCardImpl(host->name().c_str(), NetCard::Type::Host, this);
+  }
+
   xbt_dynar_t AsImpl::getOneLinkRoutes()
   {
     return nullptr;
   xbt_dynar_t AsImpl::getOneLinkRoutes()
   {
     return nullptr;
index e202ca4..7ebe6a3 100644 (file)
@@ -30,6 +30,9 @@ protected:
   ~AsImpl() override;
   
 public:
   ~AsImpl() override;
   
 public:
+  /** @brief attach the given host to that AS */
+  void attachHost(s4u::Host * host);
+
   /**
    * @brief Probe the routing path between two points
    *
   /**
    * @brief Probe the routing path between two points
    *
index 3a5fe2c..fe4d45b 100644 (file)
@@ -627,7 +627,6 @@ smx_activity_t SIMIX_process_suspend(smx_actor_t process, smx_actor_t issuer)
 
     return nullptr;
   } else {
 
     return nullptr;
   } else {
-    /* FIXME: computation size is zero. Is it okay that bound is zero ? */
     return SIMIX_execution_start(process, "suspend", 0.0, 1.0, 0.0);
   }
 }
     return SIMIX_execution_start(process, "suspend", 0.0, 1.0, 0.0);
   }
 }
index c002ec7..25e3534 100644 (file)
@@ -77,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();
 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);
 
   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;
 
   if (host->coord && strcmp(host->coord, "")) {
     unsigned int cursor;
@@ -112,7 +107,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
     cpu->setSpeedTrace(host->speed_trace);
 
   new simgrid::surf::HostImpl(h, mount_list);
     cpu->setSpeedTrace(host->speed_trace);
 
   new simgrid::surf::HostImpl(h, mount_list);
-  xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void*)mount_list);
+  xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, static_cast<void*>(mount_list));
 
   mount_list = nullptr;
 
 
   mount_list = nullptr;