Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill LinkPtr type and make Link* explicit
[simgrid.git] / src / surf / surf_routing_full.cpp
index 980221e..3c72ad8 100644 (file)
@@ -71,7 +71,7 @@ AsFull::~AsFull(){
 
 xbt_dynar_t AsFull::getOneLinkRoutes()
 {
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free);
+  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
 
   int src, dst;
   int table_size = xbt_dynar_length(p_indexNetworkElm);
@@ -127,7 +127,7 @@ void AsFull::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf
     xbt_dynar_foreach(e_route->link_list, cpt, link) {
       xbt_dynar_push(res->link_list, &link);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
+        *lat += static_cast<Link*>(link)->getLatency();
     }
   }
 }
@@ -214,12 +214,17 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route)
       //                         "but '%s' is not in '%s'.",
       //                         route->dst_gateway, subas->name);
       as_route = 1;
-      XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
-          src, route->gw_src->getName(), dst, route->gw_dst->getName());
-      if (route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
-        xbt_die("The dst_gateway '%s' does not exist!", route->gw_dst->getName());
-      if (route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
-        xbt_die("The src_gateway '%s' does not exist!", route->gw_src->getName());
+      XBT_DEBUG("Load ASroute from \"%s\" to \"%s\"", src, dst);
+      if (!route->gw_src ||
+          route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
+       surf_parse_error("The src_gateway \"%s\" does not exist!",
+                route->gw_src ? route->gw_src->getName() : "(null)");
+      if (!route->gw_dst ||
+          route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
+       surf_parse_error("The dst_gateway \"%s\" does not exist!",
+                route->gw_dst ? route->gw_dst->getName() : "(null)");
+      XBT_DEBUG("ASroute goes from \"%s\" to \"%s\"",
+                route->gw_src->getName(), route->gw_dst->getName());
     }
     TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId()) = newExtendedRoute(p_hierarchy, route, 1);
     xbt_dynar_shrink(TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId())->link_list, 0);