Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
routing: rename and sort things
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 14 Feb 2016 16:39:41 +0000 (17:39 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 14 Feb 2016 16:39:41 +0000 (17:39 +0100)
src/surf/surf_routing_dijkstra.cpp
src/surf/surf_routing_floyd.cpp
src/surf/surf_routing_generic.cpp
src/surf/surf_routing_generic.hpp

index e880ba3..b6fae6e 100644 (file)
@@ -197,7 +197,7 @@ void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_c
 
   /* set utils vars */
 
-  srcDstCheck(src, dst);
+  getRouteCheckParams(src, dst);
   int src_id = src->id();
   int dst_id = dst->id();
 
index b052964..f89b229 100644 (file)
@@ -81,10 +81,9 @@ xbt_dynar_t AsFloyd::getOneLinkRoutes()
 void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t res, double *lat)
 {
 
-  /* set utils vars */
   size_t table_size = xbt_dynar_length(vertices_);
 
-  this->srcDstCheck(src, dst);
+  getRouteCheckParams(src, dst);
 
   /* create a result route */
   xbt_dynar_t route_stack = xbt_dynar_new(sizeof(sg_platf_route_cbarg_t), NULL);
@@ -110,10 +109,8 @@ void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbar
     void *link;
     unsigned int cpt;
 
-    if (hierarchy_ == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL
-        && strcmp(prev_dst_gw->name(), e_route->gw_src->name())) {
-      routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src,
-                                    &res->link_list, lat);
+    if (hierarchy_ == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL && strcmp(prev_dst_gw->name(), e_route->gw_src->name())) {
+      routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src, &res->link_list, lat);
     }
 
     links = e_route->link_list;
index 142731f..7d8b5d8 100644 (file)
@@ -350,8 +350,7 @@ sg_platf_route_cbarg_t AsGeneric::newExtendedRoute(e_surf_routing_hierarchy_t hi
 
   if (hierarchy == SURF_ROUTING_RECURSIVE) {
 
-    xbt_assert(routearg->gw_src && routearg->gw_dst,
-        "NULL is obviously a deficient gateway");
+    xbt_assert(routearg->gw_src && routearg->gw_dst, "NULL is obviously a deficient gateway");
 
     /* remember not erase the gateway names */
     result->gw_src = routearg->gw_src;
@@ -373,7 +372,7 @@ sg_platf_route_cbarg_t AsGeneric::newExtendedRoute(e_surf_routing_hierarchy_t hi
   return result;
 }
 
-void AsGeneric::srcDstCheck(NetCard *src, NetCard *dst)
+void AsGeneric::getRouteCheckParams(NetCard *src, NetCard *dst)
 {
   xbt_assert(src,"Cannot find a route from NULL to %s", dst->name());
   xbt_assert(dst,"Cannot find a route from %s to NULL", src->name());
@@ -389,24 +388,24 @@ void AsGeneric::srcDstCheck(NetCard *src, NetCard *dst)
         src->name(), dst->name(),  src_as->name_, dst_as->name_,  name_);
 }
 void AsGeneric::parseRouteCheckParams(sg_platf_route_cbarg_t route) {
-  const char *src = route->src;
-  const char *dst = route->dst;
-  NetCard *src_net_elm = sg_netcard_by_name_or_null(src);
-  NetCard *dst_net_elm = sg_netcard_by_name_or_null(dst);
+  const char *srcName = route->src;
+  const char *dstName = route->dst;
+  NetCard *src = sg_netcard_by_name_or_null(srcName);
+  NetCard *dst = sg_netcard_by_name_or_null(dstName);
 
   if(!route->gw_dst && !route->gw_src) {
-    XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
-    xbt_assert(src_net_elm, "Cannot add a route from %s to %s: %s does not exist.", src, dst, src);
-    xbt_assert(dst_net_elm, "Cannot add a route from %s to %s: %s does not exist.", src, dst, dst);
-    xbt_assert(!xbt_dynar_is_empty(route->link_list), "Empty route (between %s and %s) forbidden.", src, dst);
+    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(!xbt_dynar_is_empty(route->link_list), "Empty route (between %s and %s) forbidden.", srcName, dstName);
   } else {
-    XBT_DEBUG("Load ASroute from %s@%s to %s@%s", src, route->gw_src->name(), dst, route->gw_dst->name());
-    xbt_assert(src_net_elm, "Cannot add a route from %s@%s to %s@%s: %s does not exist.",
-        src,route->gw_src->name(), dst,route->gw_dst->name(), src);
-    xbt_assert(dst_net_elm, "Cannot add a route from %s@%s to %s@%s: %s does not exist.",
-        src,route->gw_src->name(), dst,route->gw_dst->name(), dst);
+    XBT_DEBUG("Load ASroute from %s@%s to %s@%s", srcName, route->gw_src->name(), dstName, route->gw_dst->name());
+    xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.",
+        srcName,route->gw_src->name(), dstName,route->gw_dst->name(), srcName);
+    xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.",
+        srcName,route->gw_src->name(), dstName,route->gw_dst->name(), dstName);
     xbt_assert(!xbt_dynar_is_empty(route->link_list), "Empty route (between %s@%s and %s@%s) forbidden.",
-        src,route->gw_src->name(), dst,route->gw_dst->name());
+        srcName,route->gw_src->name(), dstName,route->gw_dst->name());
   }
 }
 
index 8418f67..6587ace 100644 (file)
@@ -29,7 +29,7 @@ public:
 
   virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order);
 protected:
-  void srcDstCheck(NetCard *src, NetCard *dst);
+  void getRouteCheckParams(NetCard *src, NetCard *dst);
   void parseRouteCheckParams(sg_platf_route_cbarg_t route);
 };