From: Arnaud Giersch Date: Sat, 14 Oct 2017 11:23:25 +0000 (+0200) Subject: Change name()/cname() to getName()/getCname() in kernel::routing::NetPoint. X-Git-Tag: v3.18~467 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b4ac368a8512fa8ec30d04f55c4a3c660e9439b9 Change name()/cname() to getName()/getCname() in kernel::routing::NetPoint. --- diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 2bd66e5359..894e08fe0f 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -22,7 +22,7 @@ ClusterZone::ClusterZone(NetZone* father, std::string name) : NetZoneImpl(father void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { - XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->cname(), src->id(), dst->cname(), dst->id()); + XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); xbt_assert(not privateLinks_.empty(), "Cluster routing: no links attached to the source node - did you use host_link tag?"); @@ -77,7 +77,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges "Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph."); /* create the router */ - xbt_node_t routerNode = new_xbt_graph_node(graph, router_->cname(), nodes); + xbt_node_t routerNode = new_xbt_graph_node(graph, router_->getCname(), nodes); xbt_node_t backboneNode = nullptr; if (backbone_) { @@ -87,7 +87,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges for (auto const& src : getVertices()) { if (not src->isRouter()) { - xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes); + xbt_node_t previous = new_xbt_graph_node(graph, src->getCname(), nodes); std::pair info = privateLinks_.at(src->id()); diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index c6f52a0814..0c5123d599 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -149,7 +149,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_s_v, node_e_v); if (edge == nullptr) - THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str()); + THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); sg_platf_route_cbarg_t e_route = static_cast(xbt_graph_edge_get_data(edge)); @@ -223,7 +223,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_pred_v, node_v); if (edge == nullptr) - THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str()); + THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); sg_platf_route_cbarg_t e_route = static_cast(xbt_graph_edge_get_data(edge)); @@ -234,8 +234,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb if (v == dst_node_id) first_gw = gw_dst; - if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && - strcmp(gw_dst->name().c_str(), prev_gw_src->name().c_str())) { + if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && gw_dst->getName() != prev_gw_src->getName()) { std::vector e_route_as_to_as; NetPoint* gw_dst_net_elm = nullptr; @@ -281,8 +280,8 @@ void DijkstraZone::addRoute(sg_platf_route_cbarg_t route) { NetPoint* src = route->src; NetPoint* dst = route->dst; - const char* srcName = src->name().c_str(); - const char* dstName = dst->name().c_str(); + const char* srcName = src->getCname(); + const char* dstName = dst->getCname(); addRouteCheckParams(route); @@ -310,11 +309,11 @@ void DijkstraZone::addRoute(sg_platf_route_cbarg_t route) if (edge) THROWF(arg_error, 0, "Route from %s to %s already exists", dstName, srcName); } else { - XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->name().c_str(), srcName, - route->gw_src->name().c_str()); + XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->getCname(), srcName, + route->gw_src->getCname()); if (edge) - THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->name().c_str(), srcName, - route->gw_src->name().c_str()); + THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->getCname(), srcName, + route->gw_src->getCname()); } if (route->gw_dst && route->gw_src) { diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 74241c8d17..fd60b9daf4 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -277,8 +277,7 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_c if (dst->isRouter() || src->isRouter()) return; - XBT_VERB("dragonfly getLocalRout from '%s'[%u] to '%s'[%u]", src->name().c_str(), src->id(), dst->name().c_str(), - dst->id()); + XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); if ((src->id() == dst->id()) && hasLoopback_) { std::pair info = privateLinks_.at(nodePosition(src->id())); diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index c6485c8540..4eb5f29a43 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -65,16 +65,16 @@ void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba /* Let's find the source and the destination in our internal structure */ auto searchedNode = this->computeNodes_.find(src->id()); xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the source %s [%u] in the fat tree", - src->name().c_str(), src->id()); + src->getCname(), src->id()); FatTreeNode* source = searchedNode->second; searchedNode = this->computeNodes_.find(dst->id()); xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the destination %s [%u] in the fat tree", - dst->name().c_str(), dst->id()); + dst->getCname(), dst->id()); FatTreeNode* destination = searchedNode->second; - XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->name().c_str(), src->id(), - dst->name().c_str(), dst->id()); + XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->getCname(), src->id(), + dst->getCname(), dst->id()); /* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */ if (source->id == destination->id && this->hasLoopback_) { diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 21302f0218..b434384bcd 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -55,7 +55,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg do { int pred = TO_FLOYD_PRED(src->id(), cur); if (pred == -1) - THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str()); + THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); route_stack.push_back(TO_FLOYD_LINK(pred, cur)); cur = pred; } while (cur != src->id()); @@ -70,7 +70,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg sg_platf_route_cbarg_t e_route = route_stack.back(); route_stack.pop_back(); if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr && - strcmp(prev_dst_gw->name().c_str(), e_route->gw_src->name().c_str())) { + prev_dst_gw->getCname() != e_route->gw_src->getCname()) { getGlobalRoute(prev_dst_gw, e_route->gw_src, route->link_list, lat); } @@ -110,12 +110,11 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route) if (route->gw_dst) // netzone route (to adapt the error message, if any) xbt_assert(nullptr == TO_FLOYD_LINK(route->src->id(), route->dst->id()), "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).", - route->src->name().c_str(), route->gw_src->name().c_str(), route->dst->name().c_str(), - route->gw_dst->name().c_str()); + route->src->getCname(), route->gw_src->getCname(), route->dst->getCname(), route->gw_dst->getCname()); else xbt_assert(nullptr == TO_FLOYD_LINK(route->src->id(), route->dst->id()), "The route between %s and %s already exists (Rq: routes are symmetrical by default).", - route->src->name().c_str(), route->dst->name().c_str()); + route->src->getCname(), route->dst->getCname()); TO_FLOYD_LINK(route->src->id(), route->dst->id()) = newExtendedRoute(hierarchy_, route, 1); TO_FLOYD_PRED(route->src->id(), route->dst->id()) = route->src->id(); @@ -127,12 +126,11 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route) xbt_assert( nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()), "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.", - route->dst->name().c_str(), route->gw_dst->name().c_str(), route->src->name().c_str(), - route->gw_src->name().c_str()); + route->dst->getCname(), route->gw_dst->getCname(), route->src->getCname(), route->gw_src->getCname()); else xbt_assert(nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()), "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.", - route->dst->name().c_str(), route->src->name().c_str()); + route->dst->getCname(), route->src->getCname()); if (route->gw_dst && route->gw_src) { NetPoint* gw_tmp = route->gw_src; @@ -141,10 +139,10 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route) } if (not route->gw_src || not route->gw_dst) - XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->name().c_str(), route->src->name().c_str()); + XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->getCname(), route->src->getCname()); else - XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->name().c_str(), route->gw_src->name().c_str(), - route->src->name().c_str(), route->gw_dst->name().c_str()); + XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->getCname(), route->gw_src->getCname(), + route->src->getCname(), route->gw_dst->getCname()); TO_FLOYD_LINK(route->dst->id(), route->src->id()) = newExtendedRoute(hierarchy_, route, 0); TO_FLOYD_PRED(route->dst->id(), route->src->id()) = route->dst->id(); diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index 5fe8ab42ca..d6e4660ec5 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -60,7 +60,7 @@ FullZone::~FullZone() void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t res, double* lat) { - XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->cname(), src->id(), dst->cname(), dst->id()); + XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); unsigned int table_size = getTableSize(); sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(src->id(), dst->id()); @@ -91,11 +91,11 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route) if (route->gw_dst) // inter-zone route (to adapt the error message, if any) xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()), "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).", - src->cname(), route->gw_src->cname(), dst->cname(), route->gw_dst->cname()); + src->getCname(), route->gw_src->getCname(), dst->getCname(), route->gw_dst->getCname()); else xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()), - "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->cname(), - dst->cname()); + "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->getCname(), + dst->getCname()); /* Add the route to the base */ TO_ROUTE_FULL(src->id(), dst->id()) = newExtendedRoute(hierarchy_, route, true); @@ -110,11 +110,11 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route) xbt_assert( nullptr == TO_ROUTE_FULL(dst->id(), src->id()), "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.", - dst->cname(), route->gw_dst->cname(), src->cname(), route->gw_src->cname()); + dst->getCname(), route->gw_dst->getCname(), src->getCname(), route->gw_src->getCname()); else xbt_assert(nullptr == TO_ROUTE_FULL(dst->id(), src->id()), "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.", - dst->cname(), src->cname()); + dst->getCname(), src->getCname()); TO_ROUTE_FULL(dst->id(), src->id()) = newExtendedRoute(hierarchy_, route, false); } diff --git a/src/kernel/routing/NetPoint.hpp b/src/kernel/routing/NetPoint.hpp index fd54a2f75e..0a4827427d 100644 --- a/src/kernel/routing/NetPoint.hpp +++ b/src/kernel/routing/NetPoint.hpp @@ -31,8 +31,8 @@ public: // Our rank in the vertices_ array of the netzone that contains us. unsigned int id() { return id_; } - std::string name() { return name_; } - const char* cname() { return name_.c_str(); } + const std::string& getName() const { return name_; } + const char* getCname() const { return name_.c_str(); } /** @brief the NetZone in which this NetPoint is included */ NetZoneImpl* netzone() { return netzone_; } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 994c6e1b76..a9e952e08e 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -68,19 +68,21 @@ void NetZoneImpl::addBypassRoute(sg_platf_route_cbarg_t e_route) { /* Argument validity checks */ if (e_route->gw_dst) { - XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", e_route->src->cname(), e_route->gw_src->cname(), - e_route->dst->cname(), e_route->gw_dst->cname()); + XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", e_route->src->getCname(), e_route->gw_src->getCname(), + e_route->dst->getCname(), e_route->gw_dst->getCname()); xbt_assert(not e_route->link_list->empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", - e_route->src->cname(), e_route->gw_src->cname(), e_route->dst->cname(), e_route->gw_dst->cname()); + e_route->src->getCname(), e_route->gw_src->getCname(), e_route->dst->getCname(), + e_route->gw_dst->getCname()); xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(), - "The bypass route between %s@%s and %s@%s already exists.", e_route->src->cname(), - e_route->gw_src->cname(), e_route->dst->cname(), e_route->gw_dst->cname()); + "The bypass route between %s@%s and %s@%s already exists.", e_route->src->getCname(), + e_route->gw_src->getCname(), e_route->dst->getCname(), e_route->gw_dst->getCname()); } else { - XBT_DEBUG("Load bypassRoute from %s to %s", e_route->src->cname(), e_route->dst->cname()); + XBT_DEBUG("Load bypassRoute from %s to %s", e_route->src->getCname(), e_route->dst->getCname()); xbt_assert(not e_route->link_list->empty(), "Bypass route between %s and %s cannot be empty.", - e_route->src->cname(), e_route->dst->cname()); + e_route->src->getCname(), e_route->dst->getCname()); xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(), - "The bypass route between %s and %s already exists.", e_route->src->cname(), e_route->dst->cname()); + "The bypass route between %s and %s already exists.", e_route->src->getCname(), + e_route->dst->getCname()); } /* Build a copy that will be stored in the dict */ @@ -160,8 +162,8 @@ static void find_common_ancestors(NetPoint* src, NetPoint* dst, NetZoneImpl* src_as = src->netzone(); NetZoneImpl* dst_as = dst->netzone(); - xbt_assert(src_as, "Host %s must be in a netzone", src->cname()); - xbt_assert(dst_as, "Host %s must be in a netzone", dst->cname()); + xbt_assert(src_as, "Host %s must be in a netzone", src->getCname()); + xbt_assert(dst_as, "Host %s must be in a netzone", dst->getCname()); /* (2) find the path to the root routing component */ std::vector path_src; @@ -218,7 +220,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, if (latency) *latency += link->latency(); } - XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->cname(), dst->cname(), + XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->getCname(), dst->getCname(), bypassedRoute->links.size()); return true; } @@ -294,7 +296,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, if (bypassedRoute) { XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links. We may have to complete it with recursive " "calls to getRoute", - src->cname(), dst->cname(), bypassedRoute->links.size()); + src->getCname(), dst->getCname(), bypassedRoute->links.size()); if (src != key.first) getGlobalRoute(src, bypassedRoute->gw_src, links, latency); for (surf::LinkImpl* const& link : bypassedRoute->links) { @@ -306,7 +308,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, getGlobalRoute(bypassedRoute->gw_dst, dst, links, latency); return true; } - XBT_DEBUG("No bypass route from '%s' to '%s'.", src->cname(), dst->cname()); + XBT_DEBUG("No bypass route from '%s' to '%s'.", src->getCname(), dst->getCname()); return false; } @@ -316,7 +318,7 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, s_sg_platf_route_cbarg_t route; memset(&route, 0, sizeof(route)); - XBT_DEBUG("Resolve route from '%s' to '%s'", src->cname(), dst->cname()); + XBT_DEBUG("Resolve route from '%s' to '%s'", src->getCname(), dst->getCname()); /* Find how src and dst are interconnected */ NetZoneImpl *common_ancestor; @@ -343,7 +345,7 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, common_ancestor->getLocalRoute(src_ancestor->netpoint_, dst_ancestor->netpoint_, &route, latency); xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr), "bad gateways for route from \"%s\" to \"%s\"", - src->cname(), dst->cname()); + src->getCname(), dst->getCname()); /* If source gateway is not our source, we have to recursively find our way up to this point */ if (src != route.gw_src) diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index cb2d000c4f..e655edd460 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -83,7 +83,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) getLocalRoute(my_src, my_dst, route, nullptr); - XBT_DEBUG("get_route_and_latency %s -> %s", my_src->cname(), my_dst->cname()); + XBT_DEBUG("get_route_and_latency %s -> %s", my_src->getCname(), my_dst->getCname()); xbt_node_t current; xbt_node_t previous; @@ -91,11 +91,11 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) const char *current_name; if (route->gw_src) { - previous = new_xbt_graph_node(graph, route->gw_src->cname(), nodes); - previous_name = route->gw_src->cname(); + previous = new_xbt_graph_node(graph, route->gw_src->getCname(), nodes); + previous_name = route->gw_src->getCname(); } else { - previous = new_xbt_graph_node(graph, my_src->cname(), nodes); - previous_name = my_src->cname(); + previous = new_xbt_graph_node(graph, my_src->getCname(), nodes); + previous_name = my_src->getCname(); } for (auto const& link : *route->link_list) { @@ -109,11 +109,11 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) } if (route->gw_dst) { - current = new_xbt_graph_node(graph, route->gw_dst->cname(), nodes); - current_name = route->gw_dst->cname(); + current = new_xbt_graph_node(graph, route->gw_dst->getCname(), nodes); + current_name = route->gw_dst->getCname(); } else { - current = new_xbt_graph_node(graph, my_dst->cname(), nodes); - current_name = my_dst->cname(); + current = new_xbt_graph_node(graph, my_dst->getCname(), nodes); + current_name = my_dst->getCname(); } new_xbt_graph_edge(graph, previous, current, edges); XBT_DEBUG(" %s -> %s", previous_name, current_name); @@ -158,26 +158,26 @@ sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_pl void RoutedZone::getRouteCheckParams(NetPoint* src, NetPoint* dst) { - 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()); + xbt_assert(src, "Cannot find a route from nullptr to %s", dst->getCname()); + xbt_assert(dst, "Cannot find a route from %s to nullptr", src->getCname()); NetZone* src_as = src->netzone(); NetZone* dst_as = dst->netzone(); xbt_assert(src_as == dst_as, "Internal error: %s@%s and %s@%s are not in the same netzone as expected. Please report that bug.", - src->cname(), src_as->getCname(), dst->cname(), dst_as->getCname()); + src->getCname(), src_as->getCname(), dst->getCname(), dst_as->getCname()); xbt_assert(this == dst_as, "Internal error: route destination %s@%s is not in netzone %s as expected (route source: " "%s@%s). Please report that bug.", - src->cname(), dst->cname(), src_as->getCname(), dst_as->getCname(), getCname()); + src->getCname(), dst->getCname(), src_as->getCname(), dst_as->getCname(), getCname()); } void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route) { NetPoint* src = route->src; NetPoint* dst = route->dst; - const char* srcName = src->cname(); - const char* dstName = dst->cname(); + const char* srcName = src->getCname(); + const char* dstName = dst->getCname(); if (not route->gw_dst || not route->gw_src) { XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName); @@ -191,7 +191,8 @@ void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route) "When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?", dstName); } else { - XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, route->gw_src->cname(), dstName, route->gw_dst->cname()); + XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, route->gw_src->getCname(), dstName, + route->gw_dst->getCname()); xbt_assert(src->isNetZone(), "When defining a NetzoneRoute, src must be a netzone but '%s' is not", srcName); xbt_assert(dst->isNetZone(), "When defining a NetzoneRoute, dst must be a netzone but '%s' is not", dstName); @@ -200,14 +201,15 @@ void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route) xbt_assert(route->gw_dst->isHost() || route->gw_dst->isRouter(), "When defining a NetzoneRoute, 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 NetzoneRoute from '%s' to itself", route->gw_src->cname()); + xbt_assert(route->gw_src != route->gw_dst, "Cannot define an NetzoneRoute from '%s' to itself", + route->gw_src->getCname()); - 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(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->getCname(), + dstName, route->gw_dst->getCname(), srcName); + xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->getCname(), + dstName, route->gw_dst->getCname(), dstName); xbt_assert(not route->link_list->empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName, - route->gw_src->cname(), dstName, route->gw_dst->cname()); + route->gw_src->getCname(), dstName, route->gw_dst->getCname()); } onRouteCreation(route->symmetrical, route->src, route->dst, route->gw_src, route->gw_dst, route->link_list); diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 074d473922..4992637081 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -94,8 +94,7 @@ void TorusZone::parse_specific_arguments(ClusterCreationArgs* cluster) void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { - XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->name().c_str(), src->id(), dst->name().c_str(), - dst->id()); + XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); if (dst->isRouter() || src->isRouter()) return; diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index d1ea847b99..a6b4fc3708 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -27,7 +27,7 @@ Coords::Coords(NetPoint* netpoint, std::string coordStr) std::vector string_values; boost::split(string_values, coordStr, boost::is_any_of(" ")); - xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->cname()); + xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->getCname()); for (auto const& str : string_values) try { @@ -38,7 +38,7 @@ Coords::Coords(NetPoint* netpoint, std::string coordStr) coords.shrink_to_fit(); netpoint->extension_set(this); - XBT_DEBUG("Coords of %s %p: %s", netpoint->cname(), netpoint, coordStr.c_str()); + XBT_DEBUG("Coords of %s %p: %s", netpoint->getCname(), netpoint, coordStr.c_str()); } }; // namespace vivaldi @@ -54,7 +54,7 @@ static std::vector* getCoordsFromNetpoint(NetPoint* np) { simgrid::kernel::routing::vivaldi::Coords* coords = np->extension(); xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)", - (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->cname(), np); + (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->getCname(), np); return &coords->coords; } @@ -68,8 +68,8 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, s new simgrid::kernel::routing::vivaldi::Coords(netpoint, coord); - std::string link_up = "link_" + netpoint->name() + "_UP"; - std::string link_down = "link_" + netpoint->name() + "_DOWN"; + std::string link_up = "link_" + netpoint->getName() + "_UP"; + std::string link_down = "link_" + netpoint->getName() + "_DOWN"; surf::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED); surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED); privateLinks_.insert({netpoint->id(), {linkUp, linkDown}}); @@ -77,11 +77,11 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, s void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { - XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->cname(), src->id(), dst->cname(), dst->id()); + XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); if (src->isNetZone()) { - std::string srcName = "router_" + src->name(); - std::string dstName = "router_" + dst->name(); + std::string srcName = "router_" + src->getName(); + std::string dstName = "router_" + dst->getName(); route->gw_src = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(srcName.c_str()); route->gw_dst = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(dstName.c_str()); } diff --git a/src/s4u/s4u_engine.cpp b/src/s4u/s4u_engine.cpp index 783ed43c4a..7695d85c0b 100644 --- a/src/s4u/s4u_engine.cpp +++ b/src/s4u/s4u_engine.cpp @@ -142,15 +142,15 @@ void Engine::getNetpointList(std::vector* l /** @brief Register a new netpoint to the system */ void Engine::netpointRegister(simgrid::kernel::routing::NetPoint* point) { -// simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread - pimpl->netpoints_[point->name()] = point; -// }); + // simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread + pimpl->netpoints_[point->getName()] = point; + // }); } /** @brief Unregister a given netpoint */ void Engine::netpointUnregister(simgrid::kernel::routing::NetPoint* point) { simgrid::simix::kernelImmediate([this, point] { - pimpl->netpoints_.erase(point->name()); + pimpl->netpoints_.erase(point->getName()); delete point; }); } diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index 0dc3a43ffb..8d431f1ca8 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -75,7 +75,7 @@ NetZone* NetZone::getFather() void NetZone::getHosts(std::vector* whereto) { for (auto const& card : vertices_) { - s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name()); + s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->getName()); if (host != nullptr) whereto->push_back(host); } diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 0b90169ca4..cec863df5a 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -258,7 +258,7 @@ static void sg_instr_new_router(simgrid::kernel::routing::NetPoint * netpoint) return; if (TRACE_is_enabled() && TRACE_needs_platform()) { container_t father = currentContainer.back(); - new simgrid::instr::Container(netpoint->cname(), simgrid::instr::INSTR_ROUTER, father); + new simgrid::instr::Container(netpoint->getCname(), simgrid::instr::INSTR_ROUTER, father); } } diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 0a1f72aadc..d7acd4a7db 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -84,7 +84,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin if (link_list->size() == 1) { simgrid::surf::LinkNS3* link = static_cast(link_list->at(0)); - XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->cname(), dst->cname(), link->cname(), + XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->getCname(), dst->getCname(), link->cname(), (symmetrical ? "(symmetrical)" : "(not symmetrical)")); // XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id); @@ -95,8 +95,8 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin NetPointNs3* host_src = src->extension(); NetPointNs3* host_dst = dst->extension(); - xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->cname()); - xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->cname()); + xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->getCname()); + xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->getCname()); ns3_add_link(host_src, host_dst, link->bandwidth(), link->latency()); } else { @@ -108,7 +108,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin "of length 1.\n" "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently " "ignored.", - src->cname(), dst->cname(), link_list->size()); + src->getCname(), dst->getCname(), link_list->size()); warned_about_long_routes = true; } } @@ -148,7 +148,7 @@ NetworkNS3Model::NetworkNS3Model() : NetworkModel() { simgrid::kernel::routing::NetPoint::onCreation.connect([](simgrid::kernel::routing::NetPoint* pt) { pt->extension_set(new NetPointNs3()); - XBT_VERB("SimGrid's %s is known as node %d within NS3", pt->cname(), pt->extension()->node_num); + XBT_VERB("SimGrid's %s is known as node %d within NS3", pt->getCname(), pt->extension()->node_num); }); simgrid::surf::on_cluster.connect(&clusterCreation_cb); simgrid::s4u::onPlatformCreated.connect(&postparse_cb); @@ -347,10 +347,10 @@ void ns3_create_flow(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, ns3::Ptr dst_node = nodes.Get(node2); xbt_assert(node2 < IPV4addr.size(), "Element %s is unknown to NS3. Is it connected to any one-hop link?", - dst->pimpl_netpoint->cname()); + dst->pimpl_netpoint->getCname()); char* addr = IPV4addr.at(node2); xbt_assert(addr != nullptr, "Element %s is unknown to NS3. Is it connected to any one-hop link?", - dst->pimpl_netpoint->cname()); + dst->pimpl_netpoint->getCname()); XBT_DEBUG("ns3_create_flow %u Bytes from %u to %u with Interface %s", TotalBytes, node1, node2, addr); ns3::PacketSinkHelper sink("ns3::TcpSocketFactory", ns3::InetSocketAddress (ns3::Ipv4Address::GetAny(), port_number)); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 660c6db0e2..d6f9e7de95 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -676,7 +676,7 @@ void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink) if (as_cluster->privateLinks_.find(netpoint->id()) != as_cluster->privateLinks_.end()) surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!"); - XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->cname(), netpoint->id()); + XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->getCname(), netpoint->id()); as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}}); } diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index a84649f4b2..dfb894da7e 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -59,9 +59,8 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri std::vector list; simgrid::s4u::Engine::getInstance()->getNetpointList(&list); - std::sort(list.begin(), list.end(), - [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { - return a->name() < b->name(); + std::sort(list.begin(), list.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { + return a->getName() < b->getName(); }); bool first = true; for (auto const& np : list) { @@ -71,7 +70,7 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri if (not first) msg += ","; first = false; - msg += "'" + np->name() + "'"; + msg += "'" + np->getName() + "'"; if (msg.length() > 4096) { msg.pop_back(); // remove trailing quote msg += "...(list truncated)......"; diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 6c3083218e..77aae6c8aa 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -85,12 +85,12 @@ static void dump_platform() simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { - return a->name() < b->name(); + return a->getName() < b->getName(); }); for (auto const& srcCard : netcardList) if (srcCard->isRouter()) - std::printf(" \n", srcCard->cname()); + std::printf(" \n", srcCard->getCname()); // Links unsigned int totalLinks = sg_link_count(); @@ -128,7 +128,7 @@ static void dump_platform() } for (auto const& netcardDst : netcardList) { // to router if (netcardDst->isRouter()) { - std::printf(" \n ", host1->getCname(), netcardDst->cname()); + std::printf(" \n ", host1->getCname(), netcardDst->getCname()); std::vector route; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr); for (auto const& link : route) @@ -142,7 +142,7 @@ static void dump_platform() if (value1->isRouter()) { for (auto const& value2 : netcardList) { // to router if (value2->isRouter()) { - std::printf(" \n ", value1->cname(), value2->cname()); + std::printf(" \n ", value1->getCname(), value2->getCname()); std::vector route; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, &route, nullptr); for (auto const& link : route) @@ -152,7 +152,7 @@ static void dump_platform() } for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host simgrid::s4u::Host* host2 = hosts[it_dst]; - std::printf(" \n ", value1->cname(), host2->getCname()); + std::printf(" \n ", value1->getCname(), host2->getCname()); std::vector route; simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr); diff --git a/teshsuite/simdag/is-router/is-router.cpp b/teshsuite/simdag/is-router/is-router.cpp index 9858c0cac4..88b653035d 100644 --- a/teshsuite/simdag/is-router/is-router.cpp +++ b/teshsuite/simdag/is-router/is-router.cpp @@ -22,7 +22,7 @@ int main(int argc, char **argv) simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { - return a->name() < b->name(); + return a->getName() < b->getName(); }); int it; @@ -42,7 +42,7 @@ int main(int argc, char **argv) std::printf("NetCards count: %zu\n", netcardList.size()); for (auto const& nc : netcardList) - std::printf(" - Seen: \"%s\". Type: %s\n", nc->cname(), + std::printf(" - Seen: \"%s\". Type: %s\n", nc->getCname(), nc->isRouter() ? "router" : (nc->isNetZone() ? "netzone" : (nc->isHost() ? "host" : "buggy"))); return 0;