X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e5b7ca2bccfd542f49b069ef8239391ecadcbc55..aa3426ffe35e9f09e17b5f09ee1264263b0a61b4:/src/s4u/s4u_as.cpp?ds=sidebyside diff --git a/src/s4u/s4u_as.cpp b/src/s4u/s4u_as.cpp index 2e798e4eee..a86951c5b1 100644 --- a/src/s4u/s4u_as.cpp +++ b/src/s4u/s4u_as.cpp @@ -17,9 +17,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_as,"S4U autonomous systems"); namespace simgrid { namespace s4u { - As::As(const char *name) - : name_(xbt_strdup(name)) - { + As::As(As* father, const char* name) : father_(father), name_(xbt_strdup(name)) + { } void As::seal() { @@ -36,7 +35,6 @@ namespace simgrid { xbt_dict_free(&children_); - xbt_dynar_free(&vertices_); for (auto &kv : bypassRoutes_) delete kv.second; xbt_free(name_); @@ -58,18 +56,17 @@ namespace simgrid { { xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr); - for (unsigned int index = 0; index < xbt_dynar_length(vertices_); index++) { - simgrid::routing::NetCard *card = xbt_dynar_get_as(vertices_, index, simgrid::routing::NetCard*); - simgrid::s4u::Host *host = simgrid::s4u::Host::by_name_or_null(card->name()); + for (auto card : vertices_) { + s4u::Host *host = simgrid::s4u::Host::by_name_or_null(card->name()); if (host!=nullptr) xbt_dynar_push(res, &host); } return res; } - int As::addComponent(routing::NetCard *elm) { - xbt_dynar_push_as(vertices_, routing::NetCard*, elm); - return xbt_dynar_length(vertices_)-1; + int As::addComponent(kernel::routing::NetCard *elm) { + vertices_.push_back(elm); + return vertices_.size()-1; // The rank of the newly created object } void As::addRoute(sg_platf_route_cbarg_t /*route*/){