Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't load a private header from s4u/NetZone.hpp
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 19 Dec 2017 16:46:22 +0000 (17:46 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 19 Dec 2017 16:46:27 +0000 (17:46 +0100)
The later is a public header, that our users can load.

14 files changed:
include/simgrid/s4u/NetZone.hpp
src/instr/jedule/jedule_platform.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DijkstraZone.hpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FloydZone.hpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/FullZone.hpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/NetZoneImpl.hpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/RoutedZone.hpp
src/s4u/s4u_netzone.cpp
src/surf/sg_platf.cpp

index 8e7429c..a226bfa 100644 (file)
 
 #include <xbt/base.h>
 #include <xbt/graph.h>
+#include <xbt/signal.hpp>
 
 #include <simgrid/s4u/forward.hpp>
 
-#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
-
 namespace simgrid {
 namespace kernel {
 namespace routing {
 class NetZoneImpl;
+class NetPoint;
+}
 }
+namespace surf {
+class LinkImpl;
 }
 
 namespace s4u {
@@ -62,8 +65,12 @@ public:
 
   /* Add content to the netzone, at parsing time. It should be sealed afterward. */
   virtual int addComponent(kernel::routing::NetPoint * elm); /* A host, a router or a netzone, whatever */
-  virtual void addRoute(sg_platf_route_cbarg_t route);
-  virtual void addBypassRoute(sg_platf_route_cbarg_t e_route) = 0;
+  virtual void addRoute(kernel::routing::NetPoint * src, kernel::routing::NetPoint * dst,
+                        kernel::routing::NetPoint * gw_src, kernel::routing::NetPoint * gw_dst,
+                        std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical);
+  virtual void addBypassRoute(kernel::routing::NetPoint * src, kernel::routing::NetPoint * dst,
+                              kernel::routing::NetPoint * gw_src, kernel::routing::NetPoint * gw_dst,
+                              std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical) = 0;
 
   /*** Called on each newly created regular route (not on bypass routes) */
   static simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
index 133b1f6..cc3037e 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/jedule/jedule.hpp"
+#include "simgrid/host.h"
 #include "simgrid/s4u/NetZone.hpp"
 #include "xbt/asserts.h"
 #include <algorithm>
index 85dfd1a..5fe8bd7 100644 (file)
@@ -270,14 +270,14 @@ DijkstraZone::DijkstraZone(NetZone* father, std::string name, bool cached) : Rou
 {
 }
 
-void DijkstraZone::addRoute(sg_platf_route_cbarg_t route)
+void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                            kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                            std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
 {
-  NetPoint* src       = route->src;
-  NetPoint* dst       = route->dst;
   const char* srcName = src->getCname();
   const char* dstName = dst->getCname();
 
-  addRouteCheckParams(route);
+  addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
   /* Create the topology graph */
   if (not routeGraph_)
@@ -287,35 +287,35 @@ void DijkstraZone::addRoute(sg_platf_route_cbarg_t route)
    * nodes */
 
   /* Add the route to the base */
-  sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, route, 1);
+  sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
   newRoute(src->id(), dst->id(), e_route);
 
   // Symmetrical YES
-  if (route->symmetrical == true) {
+  if (symmetrical == true) {
 
     xbt_dynar_t nodes   = xbt_graph_get_nodes(routeGraph_);
     xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src->id(), xbt_node_t);
     xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst->id(), xbt_node_t);
     xbt_edge_t edge     = xbt_graph_get_edge(routeGraph_, node_e_v, node_s_v);
 
-    if (not route->gw_dst || not route->gw_src){
+    if (not gw_dst || not gw_src) {
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
       if (edge)
         THROWF(arg_error, 0, "Route from %s to %s already exists", dstName, srcName);
     } else {
-      XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->getCname(), srcName,
-                route->gw_src->getCname());
+      XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, gw_dst->getCname(), srcName, gw_src->getCname());
       if (edge)
-        THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->getCname(), srcName,
-               route->gw_src->getCname());
+        THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, gw_dst->getCname(), srcName,
+               gw_src->getCname());
     }
 
-    if (route->gw_dst && route->gw_src) {
-      NetPoint* gw_tmp = route->gw_src;
-      route->gw_src   = route->gw_dst;
-      route->gw_dst   = gw_tmp;
+    if (gw_dst && gw_src) {
+      NetPoint* gw_tmp = gw_src;
+      gw_src           = gw_dst;
+      gw_dst           = gw_tmp;
     }
-    sg_platf_route_cbarg_t link_route_back = newExtendedRoute(hierarchy_, route, 0);
+    sg_platf_route_cbarg_t link_route_back =
+        newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0);
     newRoute(dst->id(), src->id(), link_route_back);
   }
 }
index f7fc503..0f7f10d 100644 (file)
@@ -51,7 +51,8 @@ public:
    * will have a loopback attached to it.
    */
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) override;
-  void addRoute(sg_platf_route_cbarg_t route) override;
+  void addRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+                std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
 
   xbt_graph_t routeGraph_  = nullptr; /* xbt_graph */
   std::map<int, xbt_node_t> graphNodeMap_;     /* map */
index 354f13d..9eca6d6 100644 (file)
@@ -84,12 +84,14 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg
   }
 }
 
-void FloydZone::addRoute(sg_platf_route_cbarg_t route)
+void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                         kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                         std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
 {
   /* set the size of table routing */
   unsigned int table_size = getTableSize();
 
-  addRouteCheckParams(route);
+  addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
   if (not linkTable_) {
     /* Create Cost, Predecessor and Link tables */
@@ -107,47 +109,48 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route)
   }
 
   /* Check that the route does not already exist */
-  if (route->gw_dst) // netzone route (to adapt the error message, if any)
-    xbt_assert(nullptr == TO_FLOYD_LINK(route->src->id(), route->dst->id()),
+  if (gw_dst) // netzone route (to adapt the error message, if any)
+    xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()),
                "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
-               route->src->getCname(), route->gw_src->getCname(), route->dst->getCname(), route->gw_dst->getCname());
+               src->getCname(), gw_src->getCname(), dst->getCname(), gw_dst->getCname());
   else
-    xbt_assert(nullptr == TO_FLOYD_LINK(route->src->id(), route->dst->id()),
-               "The route between %s and %s already exists (Rq: routes are symmetrical by default).",
-               route->src->getCname(), route->dst->getCname());
+    xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()),
+               "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->getCname(),
+               dst->getCname());
 
-  TO_FLOYD_LINK(route->src->id(), route->dst->id()) = newExtendedRoute(hierarchy_, route, 1);
-  TO_FLOYD_PRED(route->src->id(), route->dst->id()) = route->src->id();
-  TO_FLOYD_COST(route->src->id(), route->dst->id()) =
-      (TO_FLOYD_LINK(route->src->id(), route->dst->id()))->link_list.size();
+  TO_FLOYD_LINK(src->id(), dst->id()) =
+      newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
+  TO_FLOYD_PRED(src->id(), dst->id()) = src->id();
+  TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list.size();
 
-  if (route->symmetrical == true) {
-    if (route->gw_dst) // netzone route (to adapt the error message, if any)
+  if (symmetrical == true) {
+    if (gw_dst) // netzone route (to adapt the error message, if any)
       xbt_assert(
-          nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()),
+          nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
           "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
-          route->dst->getCname(), route->gw_dst->getCname(), route->src->getCname(), route->gw_src->getCname());
+          dst->getCname(), gw_dst->getCname(), src->getCname(), gw_src->getCname());
     else
-      xbt_assert(nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()),
+      xbt_assert(nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
                  "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.",
-                 route->dst->getCname(), route->src->getCname());
+                 dst->getCname(), src->getCname());
 
-    if (route->gw_dst && route->gw_src) {
-      NetPoint* gw_tmp = route->gw_src;
-      route->gw_src   = route->gw_dst;
-      route->gw_dst   = gw_tmp;
+    if (gw_dst && gw_src) {
+      NetPoint* gw_tmp = gw_src;
+      gw_src           = gw_dst;
+      gw_dst           = gw_tmp;
     }
 
-    if (not route->gw_src || not route->gw_dst)
-      XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->getCname(), route->src->getCname());
+    if (not gw_src || not gw_dst)
+      XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst->getCname(), src->getCname());
     else
-      XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->getCname(), route->gw_src->getCname(),
-                route->src->getCname(), route->gw_dst->getCname());
-
-    TO_FLOYD_LINK(route->dst->id(), route->src->id()) = newExtendedRoute(hierarchy_, route, 0);
-    TO_FLOYD_PRED(route->dst->id(), route->src->id()) = route->dst->id();
-    TO_FLOYD_COST(route->dst->id(), route->src->id()) =
-        (TO_FLOYD_LINK(route->dst->id(), route->src->id()))->link_list.size(); /* count of links, old model assume 1 */
+      XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", dst->getCname(), gw_src->getCname(), src->getCname(),
+                gw_dst->getCname());
+
+    TO_FLOYD_LINK(dst->id(), src->id()) =
+        newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0);
+    TO_FLOYD_PRED(dst->id(), src->id()) = dst->id();
+    TO_FLOYD_COST(dst->id(), src->id()) =
+        (TO_FLOYD_LINK(dst->id(), src->id()))->link_list.size(); /* count of links, old model assume 1 */
   }
 }
 
index a612425..69ead53 100644 (file)
@@ -27,7 +27,9 @@ public:
   ~FloydZone() override;
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
-  void addRoute(sg_platf_route_cbarg_t route) override;
+  void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+                kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+                bool symmetrical) override;
   void seal() override;
 
 private:
index a05458a..bedc0cf 100644 (file)
@@ -71,11 +71,11 @@ void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_
   }
 }
 
-void FullZone::addRoute(sg_platf_route_cbarg_t route)
+void FullZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                        kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                        std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
 {
-  NetPoint* src = route->src;
-  NetPoint* dst = route->dst;
-  addRouteCheckParams(route);
+  addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
   unsigned int table_size = getTableSize();
 
@@ -83,35 +83,37 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route)
     routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size]();
 
   /* Check that the route does not already exist */
-  if (route->gw_dst) // inter-zone route (to adapt the error message, if any)
+  if (gw_dst) // inter-zone route (to adapt the error message, if any)
     xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()),
                "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
-               src->getCname(), route->gw_src->getCname(), dst->getCname(), route->gw_dst->getCname());
+               src->getCname(), gw_src->getCname(), dst->getCname(), gw_dst->getCname());
   else
     xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()),
                "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->getCname(),
                dst->getCname());
 
   /* Add the route to the base */
-  TO_ROUTE_FULL(src->id(), dst->id()) = newExtendedRoute(hierarchy_, route, true);
-
-  if (route->symmetrical == true && src != dst) {
-    if (route->gw_dst && route->gw_src) {
-      NetPoint* gw_tmp = route->gw_src;
-      route->gw_src   = route->gw_dst;
-      route->gw_dst   = gw_tmp;
+  TO_ROUTE_FULL(src->id(), dst->id()) =
+      newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, true);
+
+  if (symmetrical == true && src != dst) {
+    if (gw_dst && gw_src) {
+      NetPoint* gw_tmp = gw_src;
+      gw_src           = gw_dst;
+      gw_dst           = gw_tmp;
     }
-    if (route->gw_dst && route->gw_src) // inter-zone route (to adapt the error message, if any)
+    if (gw_dst && gw_src) // inter-zone route (to adapt the error message, if any)
       xbt_assert(
           nullptr == TO_ROUTE_FULL(dst->id(), src->id()),
           "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
-          dst->getCname(), route->gw_dst->getCname(), src->getCname(), route->gw_src->getCname());
+          dst->getCname(), gw_dst->getCname(), src->getCname(), gw_src->getCname());
     else
       xbt_assert(nullptr == TO_ROUTE_FULL(dst->id(), src->id()),
                  "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.",
                  dst->getCname(), src->getCname());
 
-    TO_ROUTE_FULL(dst->id(), src->id()) = newExtendedRoute(hierarchy_, route, false);
+    TO_ROUTE_FULL(dst->id(), src->id()) =
+        newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, false);
   }
 }
 }
index ab13bc5..d40709d 100644 (file)
@@ -25,7 +25,9 @@ public:
   ~FullZone() override;
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
-  void addRoute(sg_platf_route_cbarg_t route) override;
+  void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+                kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+                bool symmetrical) override;
 
   sg_platf_route_cbarg_t* routingTable_ = nullptr;
 };
index 08b74df..3094695 100644 (file)
@@ -64,34 +64,33 @@ simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vector<double
   return res;
 }
 
-void NetZoneImpl::addBypassRoute(sg_platf_route_cbarg_t e_route)
+void NetZoneImpl::addBypassRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+                                 std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
 {
   /* Argument validity checks */
-  if (e_route->gw_dst) {
-    XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", e_route->src->getCname(), e_route->gw_src->getCname(),
-              e_route->dst->getCname(), e_route->gw_dst->getCname());
-    xbt_assert(not e_route->link_list.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.",
-               e_route->src->getCname(), e_route->gw_src->getCname(), e_route->dst->getCname(),
-               e_route->gw_dst->getCname());
-    xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(),
-               "The bypass route between %s@%s and %s@%s already exists.", e_route->src->getCname(),
-               e_route->gw_src->getCname(), e_route->dst->getCname(), e_route->gw_dst->getCname());
+  if (gw_dst) {
+    XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", src->getCname(), gw_src->getCname(), dst->getCname(),
+              gw_dst->getCname());
+    xbt_assert(not link_list.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", src->getCname(),
+               gw_src->getCname(), dst->getCname(), gw_dst->getCname());
+    xbt_assert(bypassRoutes_.find({src, dst}) == bypassRoutes_.end(),
+               "The bypass route between %s@%s and %s@%s already exists.", src->getCname(), gw_src->getCname(),
+               dst->getCname(), gw_dst->getCname());
   } else {
-    XBT_DEBUG("Load bypassRoute from %s to %s", e_route->src->getCname(), e_route->dst->getCname());
-    xbt_assert(not e_route->link_list.empty(), "Bypass route between %s and %s cannot be empty.",
-               e_route->src->getCname(), e_route->dst->getCname());
-    xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(),
-               "The bypass route between %s and %s already exists.", e_route->src->getCname(),
-               e_route->dst->getCname());
+    XBT_DEBUG("Load bypassRoute from %s to %s", src->getCname(), dst->getCname());
+    xbt_assert(not link_list.empty(), "Bypass route between %s and %s cannot be empty.", src->getCname(),
+               dst->getCname());
+    xbt_assert(bypassRoutes_.find({src, dst}) == bypassRoutes_.end(),
+               "The bypass route between %s and %s already exists.", src->getCname(), dst->getCname());
   }
 
   /* Build a copy that will be stored in the dict */
-  kernel::routing::BypassRoute* newRoute = new kernel::routing::BypassRoute(e_route->gw_src, e_route->gw_dst);
-  for (auto const& link : e_route->link_list)
+  kernel::routing::BypassRoute* newRoute = new kernel::routing::BypassRoute(gw_src, gw_dst);
+  for (auto const& link : link_list)
     newRoute->links.push_back(link);
 
   /* Store it */
-  bypassRoutes_.insert({{e_route->src, e_route->dst}, newRoute});
+  bypassRoutes_.insert({{src, dst}, newRoute});
 }
 
 /** @brief Get the common ancestor and its first children in each line leading to src and dst
index c2d7738..4a3e5ec 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "simgrid/s4u/NetZone.hpp"
 #include "simgrid/s4u/forward.hpp"
+#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
 
 namespace simgrid {
 namespace kernel {
@@ -61,7 +62,8 @@ public:
   simgrid::s4u::Host* createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount,
                                  std::map<std::string, std::string>* props);
   /** @brief Creates a new route in this NetZone */
-  void addBypassRoute(sg_platf_route_cbarg_t e_route) override;
+  void addBypassRoute(NetPoint * src, NetPoint * dst, NetPoint * gw_src, NetPoint * gw_dst,
+                      std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical) override;
 
 protected:
   /**
index dab2e4e..6d41cbc 100644 (file)
@@ -120,24 +120,24 @@ void RoutedZone::getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>*
 /* ************************************************************************** */
 /* ************************* GENERIC AUX FUNCTIONS ************************** */
 /* change a route containing link names into a route containing link entities */
-sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
+sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst,
+                                                    NetPoint* gw_src, NetPoint* gw_dst,
+                                                    std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical,
                                                     bool change_order)
 {
-  sg_platf_route_cbarg_t result;
-
-  result            = new s_sg_platf_route_cbarg_t;
+  sg_platf_route_cbarg_t result = new s_sg_platf_route_cbarg_t;
 
   xbt_assert(hierarchy == RoutingMode::base || hierarchy == RoutingMode::recursive,
              "The hierarchy of this netzone is neither BASIC nor RECURSIVE, I'm lost here.");
 
   if (hierarchy == RoutingMode::recursive) {
-    xbt_assert(routearg->gw_src && routearg->gw_dst, "nullptr is obviously a deficient gateway");
+    xbt_assert(gw_src && gw_dst, "nullptr is obviously a deficient gateway");
 
-    result->gw_src = routearg->gw_src;
-    result->gw_dst = routearg->gw_dst;
+    result->gw_src = gw_src;
+    result->gw_dst = gw_dst;
   }
 
-  for (auto const& link : routearg->link_list) {
+  for (auto const& link : link_list) {
     if (change_order)
       result->link_list.push_back(link);
     else
@@ -164,18 +164,18 @@ void RoutedZone::getRouteCheckParams(NetPoint* src, NetPoint* dst)
                              "%s@%s). Please report that bug.",
              src->getCname(), dst->getCname(), src_as->getCname(), dst_as->getCname(), getCname());
 }
-void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
+void RoutedZone::addRouteCheckParams(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                                     kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                                     std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
 {
-  NetPoint* src       = route->src;
-  NetPoint* dst       = route->dst;
   const char* srcName = src->getCname();
   const char* dstName = dst->getCname();
 
-  if (not route->gw_dst || not route->gw_src) {
+  if (not gw_dst || not gw_src) {
     XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName);
     xbt_assert(src, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, srcName);
     xbt_assert(dst, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, dstName);
-    xbt_assert(not route->link_list.empty(), "Empty route (between %s and %s) forbidden.", srcName, dstName);
+    xbt_assert(not link_list.empty(), "Empty route (between %s and %s) forbidden.", srcName, dstName);
     xbt_assert(not src->isNetZone(),
                "When defining a route, src cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
                srcName);
@@ -183,28 +183,26 @@ void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
                "When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
                dstName);
   } else {
-    XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, route->gw_src->getCname(), dstName,
-              route->gw_dst->getCname());
+    XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, gw_src->getCname(), dstName, gw_dst->getCname());
     xbt_assert(src->isNetZone(), "When defining a NetzoneRoute, src must be a netzone but '%s' is not", srcName);
     xbt_assert(dst->isNetZone(), "When defining a NetzoneRoute, dst must be a netzone but '%s' is not", dstName);
 
-    xbt_assert(route->gw_src->isHost() || route->gw_src->isRouter(),
+    xbt_assert(gw_src->isHost() || gw_src->isRouter(),
                "When defining a NetzoneRoute, gw_src must be an host or a router but '%s' is not.", srcName);
-    xbt_assert(route->gw_dst->isHost() || route->gw_dst->isRouter(),
+    xbt_assert(gw_dst->isHost() || gw_dst->isRouter(),
                "When defining a NetzoneRoute, gw_dst must be an host or a router but '%s' is not.", dstName);
 
-    xbt_assert(route->gw_src != route->gw_dst, "Cannot define an NetzoneRoute from '%s' to itself",
-               route->gw_src->getCname());
+    xbt_assert(gw_src != gw_dst, "Cannot define an NetzoneRoute from '%s' to itself", gw_src->getCname());
 
-    xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->getCname(),
-               dstName, route->gw_dst->getCname(), srcName);
-    xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->getCname(),
-               dstName, route->gw_dst->getCname(), dstName);
-    xbt_assert(not route->link_list.empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName,
-               route->gw_src->getCname(), dstName, route->gw_dst->getCname());
+    xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->getCname(), dstName,
+               gw_dst->getCname(), srcName);
+    xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->getCname(), dstName,
+               gw_dst->getCname(), dstName);
+    xbt_assert(not link_list.empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName, gw_src->getCname(),
+               dstName, gw_dst->getCname());
   }
 
-  onRouteCreation(route->symmetrical, route->src, route->dst, route->gw_src, route->gw_dst, route->link_list);
+  onRouteCreation(symmetrical, src, dst, gw_src, gw_dst, link_list);
 }
 }
 }
index 62ebe81..c1117fc 100644 (file)
@@ -54,12 +54,15 @@ public:
 
   void getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
                 std::map<std::string, xbt_edge_t>* edges) override;
-  virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
-                                                  bool change_order);
+  virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
+                                                  NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+                                                  bool symmetrical, bool change_order);
 
 protected:
   void getRouteCheckParams(NetPoint* src, NetPoint* dst);
-  void addRouteCheckParams(sg_platf_route_cbarg_t route);
+  void addRouteCheckParams(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                           kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                           std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical);
 };
 }
 }
index 52e4014..7a6f5f2 100644 (file)
@@ -87,7 +87,8 @@ int NetZone::addComponent(kernel::routing::NetPoint* elm)
   return vertices_.size() - 1; // The rank of the newly created object
 }
 
-void NetZone::addRoute(sg_platf_route_cbarg_t /*route*/)
+void NetZone::addRoute(sg_netpoint_t /*src*/, sg_netpoint_t /*dst*/, sg_netpoint_t /*gw_src*/, sg_netpoint_t /*gw_dst*/,
+                       std::vector<simgrid::surf::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
 {
   xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_.c_str());
 }
index 81a15d0..3b968a4 100644 (file)
@@ -406,12 +406,14 @@ void sg_platf_new_mount(MountCreationArgs* mount)
 
 void sg_platf_new_route(sg_platf_route_cbarg_t route)
 {
-  routing_get_current()->addRoute(route);
+  routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
+                                  route->symmetrical);
 }
 
 void sg_platf_new_bypassRoute(sg_platf_route_cbarg_t bypassRoute)
 {
-  routing_get_current()->addBypassRoute(bypassRoute);
+  routing_get_current()->addBypassRoute(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst,
+                                        bypassRoute->link_list, bypassRoute->symmetrical);
 }
 
 void sg_platf_new_process(sg_platf_process_cbarg_t process)