Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove all dynamic casts
[simgrid.git] / src / surf / surf_routing_floyd.cpp
index 17472ea..a1d5287 100644 (file)
@@ -5,11 +5,9 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf_routing_floyd.hpp"
-#include "network.hpp"
+#include "network_interface.hpp"
 
-extern "C" {
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
-}
 
 #define TO_FLOYD_COST(i,j) (p_costTable)[(i)+(j)*table_size]
 #define TO_FLOYD_PRED(i,j) (p_predecessorTable)[(i)+(j)*table_size]
@@ -26,12 +24,15 @@ void model_floyd_end(AS_t current_routing)
 }
 
 AsFloyd::AsFloyd(): AsGeneric() {
+  p_predecessorTable = NULL;
+  p_costTable = NULL;
+  p_linkTable = NULL;
 }
 
 AsFloyd::~AsFloyd(){
   int i, j;
-  size_t table_size;
-  table_size = xbt_dynar_length(p_indexNetworkElm);
+  int table_size;
+  table_size = (int)xbt_dynar_length(p_indexNetworkElm);
     /* Delete link_table */
     for (i = 0; i < table_size; i++)
       for (j = 0; j < table_size; j++)
@@ -120,7 +121,7 @@ void AsFloyd::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_plat
     xbt_dynar_foreach(links, cpt, link) {
       xbt_dynar_push_as(res->link_list, sg_routing_link_t, link);
       if (lat)
-        *lat += dynamic_cast<NetworkCm02LinkPtr>(static_cast<ResourcePtr>(link))->getLatency();
+        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
     }
 
     prev_dst_gw = e_route->gw_dst;
@@ -144,7 +145,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route)
   int as_route = 0;
 
   /* set the size of table routing */
-  size_t table_size = xbt_dynar_length(p_indexNetworkElm);
+  int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
   RoutingEdgePtr src_net_elm, dst_net_elm;
 
   src_net_elm = sg_routing_edge_by_name_or_null(src);