From 50242809cc408d0c30337fde31c91e36860b3b60 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 28 Nov 2015 21:18:29 +0100 Subject: [PATCH] the fabric of RoutingEdges should return the create one --- src/include/surf/surf.h | 2 +- src/surf/surf_routing.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 38cebedd91..2e37aafe28 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -1167,7 +1167,7 @@ void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *fi /********** Routing **********/ void routing_AS_begin(sg_platf_AS_cbarg_t AS); void routing_AS_end(sg_platf_AS_cbarg_t AS); -void routing_add_host(As* as, sg_platf_host_cbarg_t host); +RoutingEdge *routing_add_host(As* as, sg_platf_host_cbarg_t host); void routing_cluster_add_backbone(void* bb); As* routing_get_current(); diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 971df4c27c..3ffa723a86 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -146,20 +146,20 @@ static void parse_S_host(sg_platf_host_link_cbarg_t host) /** * \brief Add a "host" to the network element list */ -void routing_add_host(As* current_routing, sg_platf_host_cbarg_t host) +RoutingEdge *routing_add_host(As* current_routing, sg_platf_host_cbarg_t host) { if (current_routing->p_hierarchy == SURF_ROUTING_NULL) current_routing->p_hierarchy = SURF_ROUTING_BASE; xbt_assert(!sg_host_by_name(host->id), "Reading a host, processing unit \"%s\" already exists", host->id); - RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(host->id), + RoutingEdge *routingEdge = new RoutingEdgeImpl(xbt_strdup(host->id), -1, SURF_NETWORK_ELEMENT_HOST, current_routing); - info->setId(current_routing->parsePU(info)); - sg_host_edge_set(sg_host_by_name_or_create(host->id), info); - XBT_DEBUG("Having set name '%s' id '%d'", host->id, info->getId()); + routingEdge->setId(current_routing->parsePU(routingEdge)); + sg_host_edge_set(sg_host_by_name_or_create(host->id), routingEdge); + XBT_DEBUG("Having set name '%s' id '%d'", host->id, routingEdge->getId()); if(mount_list){ xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list); @@ -184,6 +184,8 @@ void routing_add_host(As* current_routing, sg_platf_host_cbarg_t host) xbt_lib_set(host_lib, host->id, COORD_HOST_LEVEL, (void *) ctn); XBT_DEBUG("Having set host coordinates for '%s'",host->id); } + + return routingEdge; } /** -- 2.20.1