#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
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<AsImpl*>(father));
+ netcard_ = new NetCardImpl(name, NetCard::Type::As, static_cast<AsImpl*>(father));
xbt_lib_set(as_router_lib, name, ROUTING_ASR_LEVEL, static_cast<void*>(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;
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;
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<void*>(mount_list));
mount_list = nullptr;