X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1a826bc9b199ebfc23aa7a1bb38f8cdbab57e105..29dbba02d775b87908c34d8233290331b67d02b3:/src/kernel/routing/AsRoutedGraph.cpp diff --git a/src/kernel/routing/AsRoutedGraph.cpp b/src/kernel/routing/AsRoutedGraph.cpp index 6e56149618..e0c289d346 100644 --- a/src/kernel/routing/AsRoutedGraph.cpp +++ b/src/kernel/routing/AsRoutedGraph.cpp @@ -23,16 +23,6 @@ void routing_route_free(sg_platf_route_cbarg_t route) } } -namespace simgrid { -namespace kernel { -namespace routing { - -AsRoutedGraph::AsRoutedGraph(As* father, const char* name) : AsImpl(father, name) -{ -} - -}}} // namespace simgrid::kernel::routing - /* ************************************************************************** */ /* *********************** GENERIC BUSINESS METHODS ************************* */ @@ -80,6 +70,10 @@ namespace simgrid { namespace kernel { namespace routing { +AsRoutedGraph::AsRoutedGraph(As* father, const char* name) : AsImpl(father, name) +{ +} + void AsRoutedGraph::getOneLinkRoutes(std::vector* accumulator) { sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1); @@ -91,18 +85,16 @@ void AsRoutedGraph::getOneLinkRoutes(std::vector* accumulator) route->link_list->clear(); NetCard* src_elm = vertices_.at(src); NetCard* dst_elm = vertices_.at(dst); - this->getLocalRoute(src_elm, dst_elm, route, nullptr); + getLocalRoute(src_elm, dst_elm, route, nullptr); if (route->link_list->size() == 1) { Link* link = route->link_list->at(0); - Onelink* onelink; if (hierarchy_ == RoutingMode::base) - onelink = new Onelink(link, src_elm, dst_elm); + accumulator->push_back(new Onelink(link, src_elm, dst_elm)); else if (hierarchy_ == RoutingMode::recursive) - onelink = new Onelink(link, route->gw_src, route->gw_dst); + accumulator->push_back(new Onelink(link, route->gw_src, route->gw_dst)); else - onelink = new Onelink(link, nullptr, nullptr); - accumulator->push_back(onelink); + accumulator->push_back(new Onelink(link, nullptr, nullptr)); } } } @@ -121,17 +113,17 @@ void AsRoutedGraph::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edg getLocalRoute(my_src, my_dst, route, nullptr); - XBT_DEBUG("get_route_and_latency %s -> %s", my_src->name().c_str(), my_dst->name().c_str()); + XBT_DEBUG("get_route_and_latency %s -> %s", my_src->cname(), my_dst->cname()); xbt_node_t current, previous; const char *previous_name, *current_name; if (route->gw_src) { - previous = new_xbt_graph_node(graph, route->gw_src->name().c_str(), nodes); - previous_name = route->gw_src->name().c_str(); + previous = new_xbt_graph_node(graph, route->gw_src->cname(), nodes); + previous_name = route->gw_src->cname(); } else { - previous = new_xbt_graph_node(graph, my_src->name().c_str(), nodes); - previous_name = my_src->name().c_str(); + previous = new_xbt_graph_node(graph, my_src->cname(), nodes); + previous_name = my_src->cname(); } for (auto link: *route->link_list) { @@ -145,11 +137,11 @@ void AsRoutedGraph::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edg } if (route->gw_dst) { - current = new_xbt_graph_node(graph, route->gw_dst->name().c_str(), nodes); - current_name = route->gw_dst->name().c_str(); + current = new_xbt_graph_node(graph, route->gw_dst->cname(), nodes); + current_name = route->gw_dst->cname(); } else { - current = new_xbt_graph_node(graph, my_dst->name().c_str(), nodes); - current_name = my_dst->name().c_str(); + current = new_xbt_graph_node(graph, my_dst->cname(), nodes); + current_name = my_dst->cname(); } new_xbt_graph_edge(graph, previous, current, edges); XBT_DEBUG (" %s -> %s", previous_name, current_name); @@ -192,25 +184,25 @@ sg_platf_route_cbarg_t AsRoutedGraph::newExtendedRoute(RoutingMode hierarchy, sg void AsRoutedGraph::getRouteCheckParams(NetCard *src, NetCard *dst) { - xbt_assert(src, "Cannot find a route from nullptr to %s", dst->name().c_str()); - xbt_assert(dst, "Cannot find a route from %s to nullptr", src->name().c_str()); + xbt_assert(src, "Cannot find a route from nullptr to %s", dst->cname()); + xbt_assert(dst, "Cannot find a route from %s to nullptr", src->cname()); As *src_as = src->containingAS(); As *dst_as = dst->containingAS(); xbt_assert(src_as == dst_as, "Internal error: %s@%s and %s@%s are not in the same AS as expected. Please report that bug.", - src->name().c_str(), src_as->name(), dst->name().c_str(), dst_as->name()); + src->cname(), src_as->name(), dst->cname(), dst_as->name()); xbt_assert(this == dst_as, "Internal error: route destination %s@%s is not in AS %s as expected (route source: " "%s@%s). Please report that bug.", - src->name().c_str(), dst->name().c_str(), src_as->name(), dst_as->name(), name()); + src->cname(), dst->cname(), src_as->name(), dst_as->name(), name()); } void AsRoutedGraph::addRouteCheckParams(sg_platf_route_cbarg_t route) { NetCard *src = route->src; NetCard *dst = route->dst; - const char* srcName = src->name().c_str(); - const char* dstName = dst->name().c_str(); + const char* srcName = src->cname(); + const char* dstName = dst->cname(); if(!route->gw_dst && !route->gw_src) { XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName); @@ -220,8 +212,7 @@ void AsRoutedGraph::addRouteCheckParams(sg_platf_route_cbarg_t route) { xbt_assert(! src->isAS(), "When defining a route, src cannot be an AS such as '%s'. Did you meant to have an ASroute?", srcName); xbt_assert(! dst->isAS(), "When defining a route, dst cannot be an AS such as '%s'. Did you meant to have an ASroute?", dstName); } else { - XBT_DEBUG("Load ASroute from %s@%s to %s@%s", srcName, route->gw_src->name().c_str(), dstName, - route->gw_dst->name().c_str()); + XBT_DEBUG("Load ASroute from %s@%s to %s@%s", srcName, route->gw_src->cname(), dstName, route->gw_dst->cname()); xbt_assert(src->isAS(), "When defining an ASroute, src must be an AS but '%s' is not", srcName); xbt_assert(dst->isAS(), "When defining an ASroute, dst must be an AS but '%s' is not", dstName); @@ -230,15 +221,14 @@ void AsRoutedGraph::addRouteCheckParams(sg_platf_route_cbarg_t route) { xbt_assert(route->gw_dst->isHost() || route->gw_dst->isRouter(), "When defining an ASroute, gw_dst must be an host or a router but '%s' is not.", dstName); - xbt_assert(route->gw_src != route->gw_dst, "Cannot define an ASroute from '%s' to itself", - route->gw_src->name().c_str()); + xbt_assert(route->gw_src != route->gw_dst, "Cannot define an ASroute from '%s' to itself", route->gw_src->cname()); - xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, - route->gw_src->name().c_str(), dstName, route->gw_dst->name().c_str(), srcName); - xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, - route->gw_src->name().c_str(), dstName, route->gw_dst->name().c_str(), dstName); + xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->cname(), + dstName, route->gw_dst->cname(), srcName); + xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->cname(), + dstName, route->gw_dst->cname(), dstName); xbt_assert(!route->link_list->empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName, - route->gw_src->name().c_str(), dstName, route->gw_dst->name().c_str()); + route->gw_src->cname(), dstName, route->gw_dst->cname()); } }