/* 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_private.h"
#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]
}
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++)
/* 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);
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);
}
}
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 += dynamic_cast<NetworkLinkPtr>(static_cast<ResourcePtr>(link))->getLatency();
}
prev_dst_gw = e_route->gw_dst;
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);