Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename AsRoute to BypassRoute, and move it to its own file
[simgrid.git] / src / kernel / routing / AsImpl.cpp
index 80d8442..1be8910 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "simgrid/s4u/host.hpp"
 #include "src/kernel/routing/AsImpl.hpp"
+#include "src/kernel/routing/BypassRoute.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
 
@@ -40,17 +42,6 @@ namespace simgrid {
     return res;
   }
 
-  void AsImpl::getOneLinkRoutes(std::vector<Onelink*>* accumulator)
-  {
-    // recursing only. I have no route myself :)
-    char* key;
-    xbt_dict_cursor_t cursor = nullptr;
-    AsImpl* rc_child;
-    xbt_dict_foreach (children(), cursor, key, rc_child) {
-      rc_child->getOneLinkRoutes(accumulator);
-    }
-  }
-
   /** @brief Get the common ancestor and its first children in each line leading to src and dst
    *
    * In the recursive case, this sets common_ancestor, src_ancestor and dst_ancestor are set as follows.
@@ -118,8 +109,8 @@ namespace simgrid {
     AsImpl* src_as = src->containingAS();
     AsImpl* dst_as = dst->containingAS();
 
-    xbt_assert(src_as, "Host %s must be in an AS", src->name().c_str());
-    xbt_assert(dst_as, "Host %s must be in an AS", dst->name().c_str());
+    xbt_assert(src_as, "Host %s must be in an AS", src->cname());
+    xbt_assert(dst_as, "Host %s must be in an AS", dst->cname());
 
     /* (2) find the path to the root routing component */
     std::vector<AsImpl*> path_src;
@@ -170,7 +161,7 @@ namespace simgrid {
     /* Base case, no recursion is needed */
     if (dst->containingAS() == this && src->containingAS() == this) {
       if (bypassRoutes_.find({src, dst}) != bypassRoutes_.end()) {
-        AsRoute* bypassedRoute = bypassRoutes_.at({src, dst});
+        BypassRoute* bypassedRoute = bypassRoutes_.at({src, dst});
         for (surf::Link* link : bypassedRoute->links) {
           links->push_back(link);
           if (latency)
@@ -214,7 +205,7 @@ namespace simgrid {
     int max_index = std::max(max_index_src, max_index_dst);
 
     /* (3) Search for a bypass making the path up to the ancestor useless */
-    AsRoute* bypassedRoute = nullptr;
+    BypassRoute* bypassedRoute = nullptr;
     std::pair<kernel::routing::NetCard*, kernel::routing::NetCard*> key;
     for (int max = 0; max <= max_index; max++) {
       for (int i = 0; i < max; i++) {
@@ -297,7 +288,7 @@ namespace simgrid {
 
       common_ancestor->getLocalRoute(src_ancestor->netcard_, dst_ancestor->netcard_, &route, latency);
       xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr), "bad gateways for route from \"%s\" to \"%s\"",
-                 src->name().c_str(), dst->name().c_str());
+                 src->cname(), dst->cname());
 
       /* If source gateway is not our source, we have to recursively find our way up to this point */
       if (src != route.gw_src)