--- /dev/null
+/* Copyright (c) 2009-2011, 2013-2016. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "src/kernel/routing/NetCard.hpp"
+#include "src/surf/surf_routing.hpp"
+#include <simgrid/s4u/host.hpp>
+
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route);
+
+namespace simgrid {
+namespace kernel {
+namespace routing {
+
+simgrid::xbt::signal<void(NetCard*)> NetCard::onCreation;
+}
+}
+} // namespace simgrid::kernel::routing
+
+/** @brief Retrieve a netcard from its name
+ *
+ * Netcards are the thing that connect host or routers to the network
+ */
+simgrid::kernel::routing::NetCard* sg_netcard_by_name_or_null(const char* name)
+{
+ sg_host_t h = sg_host_by_name(name);
+ simgrid::kernel::routing::NetCard* netcard = h == nullptr ? nullptr : h->pimpl_netcard;
+ if (!netcard)
+ netcard = (simgrid::kernel::routing::NetCard*)xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
+ return netcard;
+}
namespace simgrid {
namespace kernel {
namespace routing {
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(NetCard*)>) netcardCreatedCallbacks;
/** @ingroup SURF_routing_interface
* @brief Network cards are the vertices in the graph representing the network, used to compute paths between nodes.
{
if (containingAS != nullptr)
id_ = containingAS->addComponent(this);
- simgrid::kernel::routing::netcardCreatedCallbacks(this);
+ simgrid::kernel::routing::NetCard::onCreation(this);
}
~NetCard() = default;
bool isHost() { return componentType_ == Type::Host; }
bool isRouter() { return componentType_ == Type::Router; }
+ static simgrid::xbt::signal<void(NetCard*)> onCreation;
+
private:
unsigned int id_;
std::string name_;
ns3_initialize(ns3_tcp_model.get().c_str());
simgrid::s4u::Host::onCreation.connect(ns3_add_host);
- simgrid::kernel::routing::netcardCreatedCallbacks.connect(ns3_add_netcard);
+ simgrid::kernel::routing::NetCard::onCreation.connect(ns3_add_netcard);
simgrid::surf::on_cluster.connect (&parse_ns3_add_cluster);
simgrid::surf::on_postparse.connect(&postparse_cb);
simgrid::s4u::As::onRouteCreation.connect(&routeCreation_cb);
namespace routing {
/* Callbacks */
- simgrid::xbt::signal<void(NetCard*)> netcardCreatedCallbacks;
simgrid::xbt::signal<void(s4u::As*)> asCreatedCallbacks;
}}} // namespace simgrid::kernel::routing
int NS3_ASR_LEVEL = -1; //host node for ns3
int ROUTING_PROP_ASR_LEVEL = -1; //Where the properties are stored
-/** @brief Retrieve a netcard from its name
- *
- * Netcards are the thing that connect host or routers to the network
- */
-simgrid::kernel::routing::NetCard *sg_netcard_by_name_or_null(const char *name)
-{
- sg_host_t h = sg_host_by_name(name);
- simgrid::kernel::routing::NetCard *netcard = h==nullptr ? nullptr: h->pimpl_netcard;
- if (!netcard)
- netcard = (simgrid::kernel::routing::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
- return netcard;
-}
-
void sg_platf_new_trace(sg_platf_trace_cbarg_t trace)
{
tmgr_trace_t tmgr_trace;
src/kernel/routing/AsRoutedGraph.cpp
src/kernel/routing/AsNone.cpp
src/kernel/routing/AsVivaldi.cpp
+ src/kernel/routing/NetCard.cpp
src/kernel/EngineImpl.cpp
src/kernel/EngineImpl.hpp