Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
clang-format changes related to the previous commit
[simgrid.git] / src / s4u / s4u_as.cpp
index 5f159a5..9da12af 100644 (file)
@@ -9,14 +9,20 @@
 #include <simgrid/s4u/host.hpp>
 #include <simgrid/s4u/As.hpp>
 
-#include "src/surf/surf_routing.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
+#include "src/surf/surf_routing.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_as,"S4U autonomous systems");
 
 namespace simgrid {
   namespace s4u {
 
+  simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetCard* src, kernel::routing::NetCard* dst,
+                            kernel::routing::NetCard* gw_src, kernel::routing::NetCard* gw_dst,
+                            std::vector<Link*>* link_list)>
+      As::onRouteCreation;
+
   As::As(As* father, const char* name) : father_(father), name_(xbt_strdup(name))
   {
   }
@@ -32,8 +38,6 @@ namespace simgrid {
     xbt_dict_foreach(children_, cursor, key, elem) { delete (As*)elem; }
 
     xbt_dict_free(&children_);
-    for (auto& kv : bypassRoutes_)
-      delete kv.second;
     xbt_free(name_);
   }
 
@@ -73,31 +77,4 @@ namespace simgrid {
     xbt_die("AS %s does not accept new routes (wrong class).", name_);
   }
 
-  void As::addBypassRoute(sg_platf_route_cbarg_t e_route)
-  {
-    /* Argument validity checks */
-    if (e_route->gw_dst) {
-      XBT_DEBUG("Load bypassASroute from %s@%s to %s@%s", e_route->src->name(), e_route->gw_src->name(),
-                e_route->dst->name(), e_route->gw_dst->name());
-      xbt_assert(!e_route->link_list->empty(), "Bypass route between %s@%s and %s@%s cannot be empty.",
-                 e_route->src->name(), e_route->gw_src->name(), e_route->dst->name(), e_route->gw_dst->name());
-      xbt_assert(bypassRoutes_.find({e_route->src->name(), e_route->dst->name()}) == bypassRoutes_.end(),
-                 "The bypass route between %s@%s and %s@%s already exists.", e_route->src->name(),
-                 e_route->gw_src->name(), e_route->dst->name(), e_route->gw_dst->name());
-    } else {
-      XBT_DEBUG("Load bypassRoute from %s to %s", e_route->src->name(), e_route->dst->name());
-      xbt_assert(!e_route->link_list->empty(), "Bypass route between %s and %s cannot be empty.", e_route->src->name(),
-                 e_route->dst->name());
-      xbt_assert(bypassRoutes_.find({e_route->src->name(), e_route->dst->name()}) == bypassRoutes_.end(),
-                 "The bypass route between %s and %s already exists.", e_route->src->name(), e_route->dst->name());
-    }
-
-    /* Build a copy that will be stored in the dict */
-    std::vector<surf::Link*>* newRoute = new std::vector<surf::Link*>();
-    for (auto link : *e_route->link_list)
-      newRoute->push_back(link);
-
-    /* Store it */
-    bypassRoutes_.insert({{e_route->src->name(), e_route->dst->name()}, newRoute});
-  }
 }  }; // namespace simgrid::s4u