Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use plain vectors and references for link lists.
[simgrid.git] / src / kernel / routing / FloydZone.cpp
index 4162fa4..354f13d 100644 (file)
@@ -36,7 +36,7 @@ FloydZone::~FloydZone()
   /* Delete link_table */
   for (unsigned int i = 0; i < table_size; i++)
     for (unsigned int j = 0; j < table_size; j++)
-      routing_route_free(TO_FLOYD_LINK(i, j));
+      delete TO_FLOYD_LINK(i, j);
   delete[] linkTable_;
 
   delete[] predecessorTable_;
@@ -74,8 +74,8 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg
       getGlobalRoute(prev_dst_gw, e_route->gw_src, route->link_list, lat);
     }
 
-    for (auto const& link : *e_route->link_list) {
-      route->link_list->push_back(link);
+    for (auto const& link : e_route->link_list) {
+      route->link_list.push_back(link);
       if (lat)
         *lat += link->latency();
     }
@@ -119,7 +119,7 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route)
   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(route->src->id(), route->dst->id()))->link_list.size();
 
   if (route->symmetrical == true) {
     if (route->gw_dst) // netzone route (to adapt the error message, if any)
@@ -147,7 +147,7 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route)
     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 */
+        (TO_FLOYD_LINK(route->dst->id(), route->src->id()))->link_list.size(); /* count of links, old model assume 1 */
   }
 }
 
@@ -179,8 +179,7 @@ void FloydZone::seal()
         e_route            = new s_sg_platf_route_cbarg_t;
         e_route->gw_src    = nullptr;
         e_route->gw_dst    = nullptr;
-        e_route->link_list = new std::vector<surf::LinkImpl*>();
-        e_route->link_list->push_back(surf_network_model->loopback_);
+        e_route->link_list.push_back(surf_network_model->loopback_);
         TO_FLOYD_LINK(i, i) = e_route;
         TO_FLOYD_PRED(i, i) = i;
         TO_FLOYD_COST(i, i) = 1;