Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename AsRoute to BypassRoute, and move it to its own file
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 8 Dec 2016 09:03:04 +0000 (10:03 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 8 Dec 2016 09:03:04 +0000 (10:03 +0100)
include/simgrid/s4u/As.hpp
src/kernel/routing/AsImpl.cpp
src/kernel/routing/BypassRoute.hpp [new file with mode: 0644]
src/s4u/s4u_as.cpp
src/surf/surf_routing.hpp
tools/cmake/DefinePackages.cmake

index 21e57c6..33fcb48 100644 (file)
@@ -27,7 +27,7 @@ namespace kernel {
   namespace routing {
     class AsImpl;
     class NetCard;
   namespace routing {
     class AsImpl;
     class NetCard;
-    class AsRoute;
+    class BypassRoute;
   }
 }
 namespace s4u {
   }
 }
 namespace s4u {
@@ -73,7 +73,7 @@ private:
 
   bool sealed_ = false; // We cannot add more content when sealed
 
 
   bool sealed_ = false; // We cannot add more content when sealed
 
-  std::map<std::pair<kernel::routing::NetCard*, kernel::routing::NetCard*>, kernel::routing::AsRoute*>
+  std::map<std::pair<kernel::routing::NetCard*, kernel::routing::NetCard*>, kernel::routing::BypassRoute*>
       bypassRoutes_;                                                                      // src x dst -> route
   xbt_dict_t children_ = xbt_dict_new_homogeneous(nullptr);                               // sub-ASes
 };
       bypassRoutes_;                                                                      // src x dst -> route
   xbt_dict_t children_ = xbt_dict_new_homogeneous(nullptr);                               // sub-ASes
 };
index 4ff5801..1be8910 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "simgrid/s4u/host.hpp"
 #include "src/kernel/routing/AsImpl.hpp"
 
 #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"
 #include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
@@ -160,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()) {
     /* 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)
         for (surf::Link* link : bypassedRoute->links) {
           links->push_back(link);
           if (latency)
@@ -204,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 */
     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++) {
     std::pair<kernel::routing::NetCard*, kernel::routing::NetCard*> key;
     for (int max = 0; max <= max_index; max++) {
       for (int i = 0; i < max; i++) {
diff --git a/src/kernel/routing/BypassRoute.hpp b/src/kernel/routing/BypassRoute.hpp
new file mode 100644 (file)
index 0000000..e791d39
--- /dev/null
@@ -0,0 +1,29 @@
+/* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef KERNEL_ROUTING_BYPASSROUTE_HPP_
+#define KERNEL_ROUTING_BYPASSROUTE_HPP_
+
+#include <xbt/base.h>
+#include <xbt/signal.hpp>
+
+#include "src/kernel/routing/NetCard.hpp"
+
+namespace simgrid {
+namespace kernel {
+namespace routing {
+
+class BypassRoute {
+public:
+  explicit BypassRoute(NetCard* gwSrc, NetCard* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
+  const NetCard* gw_src;
+  const NetCard* gw_dst;
+  std::vector<Link*> links;
+};
+}
+}
+}
+
+#endif /* KERNEL_ROUTING_BYPASSROUTE_HPP_ */
index ac3a1f5..1a8587b 100644 (file)
@@ -9,6 +9,7 @@
 #include <simgrid/s4u/host.hpp>
 #include <simgrid/s4u/As.hpp>
 
 #include <simgrid/s4u/host.hpp>
 #include <simgrid/s4u/As.hpp>
 
+#include "src/kernel/routing/BypassRoute.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"
 #include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
 #include "src/surf/surf_routing.hpp"
@@ -101,7 +102,7 @@ namespace simgrid {
     }
 
     /* Build a copy that will be stored in the dict */
     }
 
     /* Build a copy that will be stored in the dict */
-    kernel::routing::AsRoute* newRoute = new kernel::routing::AsRoute(e_route->gw_src, e_route->gw_dst);
+    kernel::routing::BypassRoute* newRoute = new kernel::routing::BypassRoute(e_route->gw_src, e_route->gw_dst);
     for (auto link : *e_route->link_list)
       newRoute->links.push_back(link);
 
     for (auto link : *e_route->link_list)
       newRoute->links.push_back(link);
 
index 878ffc9..d42dac9 100644 (file)
@@ -26,18 +26,6 @@ namespace routing {
 
   XBT_PUBLIC_DATA(simgrid::xbt::signal<void(s4u::As*)>) asCreatedCallbacks;
 
 
   XBT_PUBLIC_DATA(simgrid::xbt::signal<void(s4u::As*)>) asCreatedCallbacks;
 
-/***********
- * Classes *
- ***********/
-
-class AsRoute {
-public:
-  explicit AsRoute(NetCard* gwSrc, NetCard* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
-  const NetCard* gw_src;
-  const NetCard* gw_dst;
-  std::vector<Link*> links;
-};
-
 }}}
 
 #endif /* NETWORK_ROUTING_HPP_ */
 }}}
 
 #endif /* NETWORK_ROUTING_HPP_ */
index 7e9dc7c..7d5b8d4 100644 (file)
@@ -74,6 +74,7 @@ set(EXTRA_DIST
   src/kernel/routing/AsRoutedGraph.hpp
   src/kernel/routing/AsNone.hpp
   src/kernel/routing/AsVivaldi.hpp  
   src/kernel/routing/AsRoutedGraph.hpp
   src/kernel/routing/AsNone.hpp
   src/kernel/routing/AsVivaldi.hpp  
+  src/kernel/routing/BypassRoute.hpp
   src/kernel/routing/NetCard.hpp
 
   src/surf/storage_interface.hpp
   src/kernel/routing/NetCard.hpp
 
   src/surf/storage_interface.hpp