X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7a2239ec54871d5915bcda2805058dda328b5795..a243b4c3535f516d05259cac06963c422d4aadc0:/src/surf/surf_routing_floyd.cpp diff --git a/src/surf/surf_routing_floyd.cpp b/src/surf/surf_routing_floyd.cpp index f3c72ab316..17472ea80a 100644 --- a/src/surf/surf_routing_floyd.cpp +++ b/src/surf/surf_routing_floyd.cpp @@ -1,4 +1,9 @@ -#include "surf_routing_private.h" +/* Copyright (c) 2009-2013. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + #include "surf_routing_floyd.hpp" #include "network.hpp" @@ -42,7 +47,7 @@ AsFloyd::~AsFloyd(){ /* Business methods */ xbt_dynar_t AsFloyd::getOneLinkRoutes() { - xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free); + xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free); sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1); route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); @@ -58,15 +63,13 @@ xbt_dynar_t AsFloyd::getOneLinkRoutes() if (xbt_dynar_length(route->link_list) == 1) { void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0); - onelink_t onelink = xbt_new0(s_onelink_t, 1); - onelink->link_ptr = link; - if (p_hierarchy == SURF_ROUTING_BASE) { - onelink->src = src_elm; - onelink->dst = dst_elm; - } else if (p_hierarchy == SURF_ROUTING_RECURSIVE) { - onelink->src = route->gw_src; - onelink->dst = route->gw_dst; - } + OnelinkPtr onelink; + if (p_hierarchy == SURF_ROUTING_BASE) + onelink = new Onelink(link, src_elm, dst_elm); + else if (p_hierarchy == SURF_ROUTING_RECURSIVE) + onelink = new Onelink(link, route->gw_src, route->gw_dst); + else + onelink = new Onelink(link, NULL, NULL); xbt_dynar_push(ret, &onelink); } } @@ -104,7 +107,7 @@ void AsFloyd::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_plat while (!xbt_dynar_is_empty(route_stack)) { sg_platf_route_cbarg_t e_route = xbt_dynar_pop_as(route_stack, sg_platf_route_cbarg_t); xbt_dynar_t links; - NetworkCm02LinkPtr link; + void *link; unsigned int cpt; if (p_hierarchy == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL @@ -117,7 +120,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 += link->getLatency(); + *lat += dynamic_cast(static_cast(link))->getLatency(); } prev_dst_gw = e_route->gw_dst; @@ -129,6 +132,10 @@ static int floyd_pointer_resource_cmp(const void *a, const void *b) { return a != b; } +void AsFloyd::parseASroute(sg_platf_route_cbarg_t route){ + parseRoute(route); +} + void AsFloyd::parseRoute(sg_platf_route_cbarg_t route) { char *src = (char*)(route->src);