From: Martin Quinson Date: Mon, 24 Oct 2016 20:40:01 +0000 (+0200) Subject: move some content out of parsing to the classes X-Git-Tag: v3_14~288 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ed477ea54b80d9aec5ace284831637103c552b92?ds=sidebyside move some content out of parsing to the classes --- diff --git a/src/kernel/routing/AsImpl.cpp b/src/kernel/routing/AsImpl.cpp index 595568f4a1..9c60a5020c 100644 --- a/src/kernel/routing/AsImpl.cpp +++ b/src/kernel/routing/AsImpl.cpp @@ -5,6 +5,7 @@ #include "xbt/log.h" +#include "simgrid/s4u/host.hpp" #include "src/kernel/routing/AsImpl.hpp" #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header @@ -19,13 +20,20 @@ namespace simgrid { xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL), "Refusing to create a second AS called '%s'.", name); - netcard_ = new simgrid::kernel::routing::NetCardImpl(name, simgrid::kernel::routing::NetCard::Type::As, - static_cast(father)); + netcard_ = new NetCardImpl(name, NetCard::Type::As, static_cast(father)); xbt_lib_set(as_router_lib, name, ROUTING_ASR_LEVEL, static_cast(netcard_)); - XBT_DEBUG("Having set name '%s' id '%d'", name, netcard_->id()); + XBT_DEBUG("AS '%s' created with the id '%d'", name, netcard_->id()); } AsImpl::~AsImpl() = default; + void AsImpl::attachHost(s4u::Host* host) + { + if (hierarchy_ == RoutingMode::unset) + hierarchy_ = RoutingMode::base; + + host->pimpl_netcard = new NetCardImpl(host->name().c_str(), NetCard::Type::Host, this); + } + xbt_dynar_t AsImpl::getOneLinkRoutes() { return nullptr; diff --git a/src/kernel/routing/AsImpl.hpp b/src/kernel/routing/AsImpl.hpp index e202ca45c3..7ebe6a35c6 100644 --- a/src/kernel/routing/AsImpl.hpp +++ b/src/kernel/routing/AsImpl.hpp @@ -30,6 +30,9 @@ protected: ~AsImpl() override; public: + /** @brief attach the given host to that AS */ + void attachHost(s4u::Host * host); + /** * @brief Probe the routing path between two points * diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 3a5fe2ce76..fe4d45b1f0 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -627,7 +627,6 @@ smx_activity_t SIMIX_process_suspend(smx_actor_t process, smx_actor_t issuer) return nullptr; } else { - /* FIXME: computation size is zero. Is it okay that bound is zero ? */ return SIMIX_execution_start(process, "suspend", 0.0, 1.0, 0.0); } } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index c002ec7d21..25e3534b4d 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -77,14 +77,9 @@ void sg_platf_exit() { void sg_platf_new_host(sg_platf_host_cbarg_t host) { simgrid::kernel::routing::AsImpl* current_routing = routing_get_current(); - if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset) - current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::base; - - simgrid::kernel::routing::NetCard *netcard = - new simgrid::kernel::routing::NetCardImpl(host->id, simgrid::kernel::routing::NetCard::Type::Host, current_routing); simgrid::s4u::Host* h = new simgrid::s4u::Host(host->id); - h->pimpl_netcard = netcard; + current_routing->attachHost(h); if (host->coord && strcmp(host->coord, "")) { unsigned int cursor; @@ -112,7 +107,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) cpu->setSpeedTrace(host->speed_trace); new simgrid::surf::HostImpl(h, mount_list); - xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void*)mount_list); + xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, static_cast(mount_list)); mount_list = nullptr;