From: Martin Quinson Date: Sat, 15 Oct 2016 15:18:35 +0000 (+0200) Subject: move content from the sg_platf to the object hierarchy X-Git-Tag: v3_14~329 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/895f9270fc62c112619eb62a6b1998f78b0abaa1?ds=sidebyside move content from the sg_platf to the object hierarchy --- diff --git a/src/kernel/routing/AsImpl.cpp b/src/kernel/routing/AsImpl.cpp index e4eb1032dc..38b857ee58 100644 --- a/src/kernel/routing/AsImpl.cpp +++ b/src/kernel/routing/AsImpl.cpp @@ -16,6 +16,10 @@ namespace simgrid { AsImpl::AsImpl(As* father, const char* name) : As(father, name) { + netcard_ = new simgrid::kernel::routing::NetCardImpl(name, simgrid::kernel::routing::NetCard::Type::As, + static_cast(father)); + xbt_lib_set(as_router_lib, name, ROUTING_ASR_LEVEL, (void*)netcard_); + XBT_DEBUG("Having set name '%s' id '%d'", name, netcard_->id()); } AsImpl::~AsImpl() = default; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 21d0d8c0f9..2cf24725b2 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -856,8 +856,6 @@ simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS) break; } - /* make a new routing component */ - simgrid::kernel::routing::NetCard *netcard = new simgrid::kernel::routing::NetCardImpl(new_as->name(), simgrid::kernel::routing::NetCard::Type::As, current_routing); if (current_routing == nullptr && routing_platf->root_ == nullptr) { /* it is the first one */ routing_platf->root_ = new_as; @@ -873,12 +871,8 @@ simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS) THROWF(arg_error, 0, "All defined components must belong to a AS"); } - xbt_lib_set(as_router_lib, netcard->name(), ROUTING_ASR_LEVEL, (void *) netcard); - XBT_DEBUG("Having set name '%s' id '%d'", new_as->name(), netcard->id()); - /* set the new current component of the tree */ current_routing = new_as; - current_routing->netcard_ = netcard; simgrid::kernel::routing::asCreatedCallbacks(new_as); if (TRACE_is_enabled())