From d785a64b1830b6a5d05561316ef7161ee1c67671 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 31 Jul 2016 13:06:32 +0200 Subject: [PATCH] align namespaces on directories for kernel::routing --- include/simgrid/forward.h | 10 +-- include/simgrid/s4u/As.hpp | 12 ++-- include/simgrid/s4u/host.hpp | 2 +- src/include/surf/surf.h | 4 +- src/kernel/routing/AsCluster.cpp | 4 +- src/kernel/routing/AsCluster.hpp | 4 +- src/kernel/routing/AsClusterDragonfly.cpp | 4 +- src/kernel/routing/AsClusterDragonfly.hpp | 5 +- src/kernel/routing/AsClusterFatTree.cpp | 4 +- src/kernel/routing/AsClusterFatTree.hpp | 4 +- src/kernel/routing/AsClusterTorus.cpp | 4 +- src/kernel/routing/AsClusterTorus.hpp | 7 +- src/kernel/routing/AsDijkstra.cpp | 4 +- src/kernel/routing/AsDijkstra.hpp | 4 +- src/kernel/routing/AsFloyd.cpp | 4 +- src/kernel/routing/AsFloyd.hpp | 4 +- src/kernel/routing/AsFull.cpp | 4 +- src/kernel/routing/AsFull.hpp | 4 +- src/kernel/routing/AsImpl.cpp | 4 +- src/kernel/routing/AsImpl.hpp | 5 +- src/kernel/routing/AsNone.cpp | 4 +- src/kernel/routing/AsNone.hpp | 4 +- src/kernel/routing/AsRoutedGraph.cpp | 8 +-- src/kernel/routing/AsRoutedGraph.hpp | 4 +- src/kernel/routing/AsVivaldi.cpp | 4 +- src/kernel/routing/AsVivaldi.hpp | 4 +- src/s4u/s4u_as.cpp | 8 +-- src/surf/HostImpl.cpp | 5 +- src/surf/HostImpl.hpp | 2 +- src/surf/instr_routing.cpp | 4 +- src/surf/network_cm02.cpp | 3 +- src/surf/network_cm02.hpp | 4 +- src/surf/network_constant.cpp | 2 +- src/surf/network_constant.hpp | 2 +- src/surf/network_ib.cpp | 2 +- src/surf/network_interface.cpp | 10 +-- src/surf/network_interface.hpp | 10 +-- src/surf/ptask_L07.cpp | 2 +- src/surf/ptask_L07.hpp | 4 +- src/surf/sg_platf.cpp | 84 +++++++++++------------ src/surf/surf_interface.cpp | 2 +- src/surf/surf_routing.cpp | 28 ++++---- src/surf/surf_routing.hpp | 6 +- teshsuite/simdag/is-router/is-router.cpp | 4 +- 44 files changed, 157 insertions(+), 150 deletions(-) diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index ddf9531817..67212b1cb5 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -17,7 +17,10 @@ namespace simgrid { } namespace kernel { namespace activity { - class Synchro; + class Synchro; + } + namespace routing { + class NetCard; } } namespace surf { @@ -25,9 +28,6 @@ namespace simgrid { class Cpu; class Link; } - namespace routing { - class NetCard; - } namespace trace_mgr { class trace; class future_evt_set; @@ -38,8 +38,8 @@ typedef simgrid::s4u::As simgrid_As; typedef simgrid::s4u::Host simgrid_Host; typedef simgrid::s4u::Mailbox simgrid_Mailbox; typedef simgrid::kernel::activity::Synchro simgrid_Synchro; +typedef simgrid::kernel::routing::NetCard routing_NetCard; typedef simgrid::surf::Cpu surf_Cpu; -typedef simgrid::routing::NetCard routing_NetCard; typedef simgrid::surf::Link Link; typedef simgrid::surf::Resource surf_Resource; typedef simgrid::trace_mgr::trace tmgr_Trace; diff --git a/include/simgrid/s4u/As.hpp b/include/simgrid/s4u/As.hpp index 32d50b595f..50c4854814 100644 --- a/include/simgrid/s4u/As.hpp +++ b/include/simgrid/s4u/As.hpp @@ -23,9 +23,11 @@ namespace simgrid { namespace surf { class Link; } -namespace routing { - class AsImpl; - class NetCard; +namespace kernel { + namespace routing { + class AsImpl; + class NetCard; + } } namespace s4u { @@ -36,7 +38,7 @@ namespace s4u { */ XBT_PUBLIC_CLASS As { protected: - friend simgrid::routing::AsImpl; + friend simgrid::kernel::routing::AsImpl; explicit As(const char *name); virtual ~As(); @@ -52,7 +54,7 @@ public: As *father_ = nullptr; // FIXME: hide me public: /* Add content to the AS, at parsing time. It should be sealed afterward. */ - virtual int addComponent(routing::NetCard *elm); /* A host, a router or an AS, whatever */ + virtual int addComponent(kernel::routing::NetCard *elm); /* A host, a router or an AS, whatever */ virtual void addRoute(sg_platf_route_cbarg_t route); void addBypassRoute(sg_platf_route_cbarg_t e_route); diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index 8d7d2dd1ae..af1df884f5 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -101,7 +101,7 @@ public: /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */ surf::Cpu *pimpl_cpu = nullptr; /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */ - routing::NetCard *pimpl_netcard = nullptr; + kernel::routing::NetCard *pimpl_netcard = nullptr; public: /*** Called on each newly created object */ diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index be7819f432..9eebbb49ee 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -53,10 +53,12 @@ class Action; class ActionLmm; class StorageActionLmm; } +namespace kernel { namespace routing { class RoutingPlatf; } } +} typedef simgrid::surf::Model surf_Model; typedef simgrid::surf::CpuModel surf_CpuModel; @@ -72,7 +74,7 @@ typedef simgrid::surf::NetworkCm02Link surf_NetworkCm02Link; typedef simgrid::surf::Action surf_Action; typedef simgrid::surf::ActionLmm surf_ActionLmm; typedef simgrid::surf::StorageActionLmm surf_StorageActionLmm; -typedef simgrid::routing::RoutingPlatf surf_RoutingPlatf; +typedef simgrid::kernel::routing::RoutingPlatf surf_RoutingPlatf; #else diff --git a/src/kernel/routing/AsCluster.cpp b/src/kernel/routing/AsCluster.cpp index 10ef461a3c..e85becf24c 100644 --- a/src/kernel/routing/AsCluster.cpp +++ b/src/kernel/routing/AsCluster.cpp @@ -12,6 +12,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf" * Note that a router is created, easing the interconnexion with the rest of the world. */ namespace simgrid { +namespace kernel { namespace routing { AsCluster::AsCluster(const char*name) : AsImpl(name) @@ -162,5 +163,4 @@ void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, xbt_free(link_id); } -} -} +}}} diff --git a/src/kernel/routing/AsCluster.hpp b/src/kernel/routing/AsCluster.hpp index 4b747b1b21..7a8d4e3bea 100644 --- a/src/kernel/routing/AsCluster.hpp +++ b/src/kernel/routing/AsCluster.hpp @@ -9,6 +9,7 @@ #include "src/kernel/routing/AsImpl.hpp" namespace simgrid { +namespace kernel { namespace routing { class XBT_PRIVATE AsCluster: public AsImpl { @@ -33,7 +34,6 @@ public: }; -} -} +}}} // namespace #endif /* SIMGRID_ROUTING_CLUSTER_HPP_ */ diff --git a/src/kernel/routing/AsClusterDragonfly.cpp b/src/kernel/routing/AsClusterDragonfly.cpp index 0a2f42f59a..cec68d8aac 100644 --- a/src/kernel/routing/AsClusterDragonfly.cpp +++ b/src/kernel/routing/AsClusterDragonfly.cpp @@ -13,6 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster_dragonfly, surf_route_cluster, "Dragonfly Routing part of surf"); namespace simgrid { +namespace kernel { namespace routing { AsClusterDragonfly::AsClusterDragonfly(const char*name) @@ -341,5 +342,4 @@ void AsClusterDragonfly::getRouteAndLatency(NetCard * src, NetCard * dst, sg_pla } - } -} +}}} // namespace diff --git a/src/kernel/routing/AsClusterDragonfly.hpp b/src/kernel/routing/AsClusterDragonfly.hpp index e275d6752c..e0ed5a618a 100644 --- a/src/kernel/routing/AsClusterDragonfly.hpp +++ b/src/kernel/routing/AsClusterDragonfly.hpp @@ -9,7 +9,8 @@ #include "src/kernel/routing/AsCluster.hpp" namespace simgrid { - namespace routing { +namespace kernel { +namespace routing { class XBT_PRIVATE DragonflyRouter { @@ -85,5 +86,5 @@ class XBT_PRIVATE AsClusterDragonfly DragonflyRouter** routers_=nullptr; }; - }} +}}} #endif diff --git a/src/kernel/routing/AsClusterFatTree.cpp b/src/kernel/routing/AsClusterFatTree.cpp index 9b07520ce6..c5b518f810 100644 --- a/src/kernel/routing/AsClusterFatTree.cpp +++ b/src/kernel/routing/AsClusterFatTree.cpp @@ -20,6 +20,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_fat_tree, surf, "Routing for fat trees"); namespace simgrid { +namespace kernel { namespace routing { AsClusterFatTree::AsClusterFatTree(const char*name) @@ -523,5 +524,4 @@ FatTreeLink::FatTreeLink(sg_platf_cluster_cbarg_t cluster, free((void*)linkTemplate.id); } -} -} +}}} // namespace diff --git a/src/kernel/routing/AsClusterFatTree.hpp b/src/kernel/routing/AsClusterFatTree.hpp index 6854f63378..bff262736e 100644 --- a/src/kernel/routing/AsClusterFatTree.hpp +++ b/src/kernel/routing/AsClusterFatTree.hpp @@ -9,6 +9,7 @@ #include "src/kernel/routing/AsCluster.hpp" namespace simgrid { +namespace kernel { namespace routing { class XBT_PRIVATE FatTreeLink; @@ -147,7 +148,6 @@ private: bool isInSubTree(FatTreeNode *root, FatTreeNode *node); }; -} -} +}}} // namespaces #endif diff --git a/src/kernel/routing/AsClusterTorus.cpp b/src/kernel/routing/AsClusterTorus.cpp index 2a11c9a0ad..55a46067c6 100644 --- a/src/kernel/routing/AsClusterTorus.cpp +++ b/src/kernel/routing/AsClusterTorus.cpp @@ -25,6 +25,7 @@ inline unsigned int *rankId_to_coords(int rankId, xbt_dynar_t dimensions) namespace simgrid { + namespace kernel { namespace routing { AsClusterTorus::AsClusterTorus(const char*name) : AsCluster(name) { @@ -223,5 +224,4 @@ namespace simgrid { return; } - } -} +}}} // namespace diff --git a/src/kernel/routing/AsClusterTorus.hpp b/src/kernel/routing/AsClusterTorus.hpp index b3b61ed079..1e4f264470 100644 --- a/src/kernel/routing/AsClusterTorus.hpp +++ b/src/kernel/routing/AsClusterTorus.hpp @@ -9,9 +9,10 @@ #include "src/kernel/routing/AsCluster.hpp" namespace simgrid { - namespace routing { +namespace kernel { +namespace routing { - class XBT_PRIVATE AsClusterTorus : public simgrid::routing::AsCluster { + class XBT_PRIVATE AsClusterTorus : public AsCluster { public: explicit AsClusterTorus(const char*name); ~AsClusterTorus() override; @@ -22,5 +23,5 @@ namespace simgrid { xbt_dynar_t dimensions_ = nullptr; }; - }} +}}} #endif diff --git a/src/kernel/routing/AsDijkstra.cpp b/src/kernel/routing/AsDijkstra.cpp index 98b87195e1..29f4524c38 100644 --- a/src/kernel/routing/AsDijkstra.cpp +++ b/src/kernel/routing/AsDijkstra.cpp @@ -37,6 +37,7 @@ static void graph_edge_data_free(void *e) // FIXME: useless code duplication /* Utility functions */ namespace simgrid { +namespace kernel { namespace routing { void AsDijkstra::seal() { @@ -358,5 +359,4 @@ void AsDijkstra::addRoute(sg_platf_route_cbarg_t route) } } -} -} +}}} // namespace diff --git a/src/kernel/routing/AsDijkstra.hpp b/src/kernel/routing/AsDijkstra.hpp index cf313b5972..5dada5a18d 100644 --- a/src/kernel/routing/AsDijkstra.hpp +++ b/src/kernel/routing/AsDijkstra.hpp @@ -23,6 +23,7 @@ typedef struct route_cache_element { } s_route_cache_element_t, *route_cache_element_t; namespace simgrid { +namespace kernel { namespace routing { /*********** @@ -59,7 +60,6 @@ public: xbt_dict_t routeCache_ = nullptr; /* use in cache mode */ }; -} -} +}}} // namespaces #endif /* SURF_ROUTING_DIJKSTRA_HPP_ */ diff --git a/src/kernel/routing/AsFloyd.cpp b/src/kernel/routing/AsFloyd.cpp index 87ca9652cd..77047752fb 100644 --- a/src/kernel/routing/AsFloyd.cpp +++ b/src/kernel/routing/AsFloyd.cpp @@ -15,6 +15,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf"); #define TO_FLOYD_LINK(i,j) (linkTable_)[(i)+(j)*table_size] namespace simgrid { +namespace kernel { namespace routing { AsFloyd::AsFloyd(const char*name) @@ -197,5 +198,4 @@ void AsFloyd::seal(){ } } -} -} +}}} diff --git a/src/kernel/routing/AsFloyd.hpp b/src/kernel/routing/AsFloyd.hpp index 3f53c96456..c4327ffcde 100644 --- a/src/kernel/routing/AsFloyd.hpp +++ b/src/kernel/routing/AsFloyd.hpp @@ -9,6 +9,7 @@ #include "src/kernel/routing/AsRoutedGraph.hpp" namespace simgrid { +namespace kernel { namespace routing { /** Floyd routing data: slow initialization, fast lookup, lesser memory requirements, shortest path routing only */ @@ -28,7 +29,6 @@ private: sg_platf_route_cbarg_t *linkTable_; }; -} -} +}}} // namespaces #endif /* SURF_ROUTING_FLOYD_HPP_ */ diff --git a/src/kernel/routing/AsFull.cpp b/src/kernel/routing/AsFull.cpp index d2c6438171..e0b6cda7fe 100644 --- a/src/kernel/routing/AsFull.cpp +++ b/src/kernel/routing/AsFull.cpp @@ -11,6 +11,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf"); #define TO_ROUTE_FULL(i,j) routingTable_[(i)+(j)*table_size] namespace simgrid { +namespace kernel { namespace routing { AsFull::AsFull(const char*name) : AsRoutedGraph(name) @@ -129,5 +130,4 @@ void AsFull::addRoute(sg_platf_route_cbarg_t route) } } -} -} +}}} // namespace diff --git a/src/kernel/routing/AsFull.hpp b/src/kernel/routing/AsFull.hpp index bf7668b92a..66ca294b1a 100644 --- a/src/kernel/routing/AsFull.hpp +++ b/src/kernel/routing/AsFull.hpp @@ -9,6 +9,7 @@ #include "src/kernel/routing/AsRoutedGraph.hpp" namespace simgrid { +namespace kernel { namespace routing { /** Full routing: fast, large memory requirements, fully expressive */ @@ -25,7 +26,6 @@ public: sg_platf_route_cbarg_t *routingTable_ = nullptr; }; -} -} +}}} // namespaces #endif /* SIMGRID_ROUTING_FULL_HPP_ */ diff --git a/src/kernel/routing/AsImpl.cpp b/src/kernel/routing/AsImpl.cpp index 40c940052d..fdc135fa2b 100644 --- a/src/kernel/routing/AsImpl.cpp +++ b/src/kernel/routing/AsImpl.cpp @@ -11,6 +11,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(AsImpl,surf, "Implementation of S4U autonomous systems"); namespace simgrid { + namespace kernel { namespace routing { AsImpl::AsImpl(const char *name) @@ -217,5 +218,4 @@ namespace simgrid { } - } -}; +}}} // namespace diff --git a/src/kernel/routing/AsImpl.hpp b/src/kernel/routing/AsImpl.hpp index 5e64ccd092..374b711ae9 100644 --- a/src/kernel/routing/AsImpl.hpp +++ b/src/kernel/routing/AsImpl.hpp @@ -14,6 +14,7 @@ #include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include namespace simgrid { +namespace kernel { namespace routing { class RoutingPlatf; // FIXME: KILLME @@ -23,7 +24,7 @@ namespace routing { * In SimGrid, there is a hierarchy of ASes, with a unique root AS (that you can retrieve from the s4u::Engine). */ XBT_PUBLIC_CLASS AsImpl : public s4u::As { - friend simgrid::routing::RoutingPlatf; + friend simgrid::kernel::routing::RoutingPlatf; protected: explicit AsImpl(const char *name); ~AsImpl() override; @@ -72,6 +73,6 @@ public: routing::NetCard *netcard_ = nullptr; // Our representative in the father AS }; -}}; // Namespace simgrid::s4u +}}}; // Namespace simgrid::kernel::routing #endif /* SIMGRID_SURF_AS_HPP */ diff --git a/src/kernel/routing/AsNone.cpp b/src/kernel/routing/AsNone.cpp index 41c6272bac..f63439315c 100644 --- a/src/kernel/routing/AsNone.cpp +++ b/src/kernel/routing/AsNone.cpp @@ -12,6 +12,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf"); namespace simgrid { +namespace kernel { namespace routing { AsNone::AsNone(const char*name) @@ -30,5 +31,4 @@ void AsNone::getGraph(xbt_graph_t /*graph*/, xbt_dict_t /*nodes*/, xbt_dict_t /* XBT_ERROR("No routing no graph"); } -} -} +}}} diff --git a/src/kernel/routing/AsNone.hpp b/src/kernel/routing/AsNone.hpp index f711f51029..391050c155 100644 --- a/src/kernel/routing/AsNone.hpp +++ b/src/kernel/routing/AsNone.hpp @@ -9,6 +9,7 @@ #include "src/kernel/routing/AsImpl.hpp" namespace simgrid { +namespace kernel { namespace routing { /** No specific routing. Mainly useful with the constant network model */ @@ -21,7 +22,6 @@ public: void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; }; -} -} +}}} // namespace #endif /* SURF_ROUTING_NONE_HPP_ */ diff --git a/src/kernel/routing/AsRoutedGraph.cpp b/src/kernel/routing/AsRoutedGraph.cpp index 090c63d66a..b256dd00a0 100644 --- a/src/kernel/routing/AsRoutedGraph.cpp +++ b/src/kernel/routing/AsRoutedGraph.cpp @@ -23,6 +23,7 @@ void routing_route_free(sg_platf_route_cbarg_t route) } namespace simgrid { +namespace kernel { namespace routing { AsRoutedGraph::AsRoutedGraph(const char*name) @@ -35,8 +36,7 @@ AsRoutedGraph::~AsRoutedGraph() } -} -} +}}} // namespace simgrid::kernel::routing /* ************************************************************************** */ /* *********************** GENERIC BUSINESS METHODS ************************* */ @@ -83,6 +83,7 @@ xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt } namespace simgrid { +namespace kernel { namespace routing { xbt_dynar_t AsRoutedGraph::getOneLinkRoutes() @@ -254,5 +255,4 @@ void AsRoutedGraph::addRouteCheckParams(sg_platf_route_cbarg_t route) { } } -} -} +}}} diff --git a/src/kernel/routing/AsRoutedGraph.hpp b/src/kernel/routing/AsRoutedGraph.hpp index 89dc2e2772..1b5bfa40da 100644 --- a/src/kernel/routing/AsRoutedGraph.hpp +++ b/src/kernel/routing/AsRoutedGraph.hpp @@ -9,6 +9,7 @@ #include "src/kernel/routing/AsImpl.hpp" namespace simgrid { +namespace kernel { namespace routing { class XBT_PRIVATE AsRoutedGraph : public AsImpl { @@ -25,7 +26,6 @@ protected: void addRouteCheckParams(sg_platf_route_cbarg_t route); }; -} -} +}}} // namespace #endif /* SIMGRID_ROUTING_GENERIC_HPP_ */ diff --git a/src/kernel/routing/AsVivaldi.cpp b/src/kernel/routing/AsVivaldi.cpp index 964ee76c36..c25b4e026f 100644 --- a/src/kernel/routing/AsVivaldi.cpp +++ b/src/kernel/routing/AsVivaldi.cpp @@ -13,6 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf"); namespace simgrid { +namespace kernel { namespace routing { static inline double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) { double src_coord = xbt_dynar_get_as(src, index, double); @@ -97,5 +98,4 @@ void AsVivaldi::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb } } -} -} +}}} diff --git a/src/kernel/routing/AsVivaldi.hpp b/src/kernel/routing/AsVivaldi.hpp index adf5ba1e94..5667ddbbaa 100644 --- a/src/kernel/routing/AsVivaldi.hpp +++ b/src/kernel/routing/AsVivaldi.hpp @@ -9,6 +9,7 @@ #include "src/kernel/routing/AsCluster.hpp" namespace simgrid { +namespace kernel { namespace routing { /* This derivates from cluster because each host has a private link */ @@ -21,7 +22,6 @@ public: void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; }; -} -} +}}} // namespace #endif /* SURF_ROUTING_VIVALDI_HPP_ */ diff --git a/src/s4u/s4u_as.cpp b/src/s4u/s4u_as.cpp index 2e798e4eee..56864b5f47 100644 --- a/src/s4u/s4u_as.cpp +++ b/src/s4u/s4u_as.cpp @@ -59,16 +59,16 @@ 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()); + kernel::routing::NetCard *card = xbt_dynar_get_as(vertices_, index, kernel::routing::NetCard*); + 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); + int As::addComponent(kernel::routing::NetCard *elm) { + xbt_dynar_push_as(vertices_, kernel::routing::NetCard*, elm); return xbt_dynar_length(vertices_)-1; } diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index c893a4f37c..c7e5ec9a0d 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -30,7 +30,7 @@ simgrid::xbt::Extension HostImpl::EXTENSION_ID; /********* * Model * *********/ -HostImpl *HostModel::createHost(const char *name, routing::NetCard *netElm, Cpu *cpu){ +HostImpl *HostModel::createHost(const char *name, kernel::routing::NetCard *netElm, Cpu *cpu){ xbt_dynar_t storageList = (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL); HostImpl *host = new simgrid::surf::HostImpl(surf_host_model, name, storageList, cpu); @@ -413,5 +413,4 @@ void HostImpl::setParams(vm_params_t params) p_params = *params; } -} -} +}} diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 0849c4368a..62f6178f79 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -52,7 +52,7 @@ public: HostModel() : Model() {} ~HostModel() override {} - HostImpl *createHost(const char *name, routing::NetCard *net, Cpu *cpu); + HostImpl *createHost(const char *name, kernel::routing::NetCard *net, Cpu *cpu); virtual void adjustWeightOfDummyCpuActions(); virtual Action *executeParallelTask(int host_nb, sg_host_t *host_list, diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 2fe419f921..04bd5f7425 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -152,7 +152,7 @@ static void recursiveGraphExtraction (simgrid::s4u::As *as, container_t containe xbt_dict_cursor_t cursor = nullptr; char *edge_name; - static_cast(as)->getGraph(graph, nodes, edges); + static_cast(as)->getGraph(graph, nodes, edges); xbt_dict_foreach(edges,cursor,edge_name,edge) { linkContainers( PJ_container_get((const char*) edge->src->data), @@ -456,7 +456,7 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb } } - static_cast(as)->getGraph(graph, nodes, edges); + static_cast(as)->getGraph(graph, nodes, edges); } xbt_graph_t instr_routing_platform_graph (void) diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 98ea4c3e68..032350e829 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -289,7 +289,8 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) } } -Action *NetworkCm02Model::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) +Action *NetworkCm02Model::communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, + double size, double rate) { int failed = 0; double bandwidth_bound; diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index 3819984e15..230c735aa2 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -44,7 +44,7 @@ namespace simgrid { xbt_dict_t properties) override; void updateActionsStateLazy(double now, double delta) override; void updateActionsStateFull(double now, double delta) override; - Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) override; + Action *communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, double size, double rate) override; bool next_occuring_event_isIdempotent() override; virtual void gapAppend(double size, const Link* link, NetworkAction* action); protected: @@ -72,7 +72,7 @@ namespace simgrid { * Action * **********/ class NetworkCm02Action : public NetworkAction { - friend Action *NetworkCm02Model::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate); + friend Action *NetworkCm02Model::communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, double size, double rate); friend NetworkSmpiModel; public: NetworkCm02Action(Model *model, double cost, bool failed) diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index b9c377e234..1564f4d8bf 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -79,7 +79,7 @@ namespace simgrid { } } - Action *NetworkConstantModel::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) + Action *NetworkConstantModel::communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, double size, double rate) { NetworkConstantAction *action = new NetworkConstantAction(this, size, sg_latency_factor); diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index 93fd2f1f4e..e66a2241a1 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -29,7 +29,7 @@ namespace simgrid { NetworkConstantModel() : NetworkModel() { }; ~NetworkConstantModel() override; - Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) override; + Action *communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, double size, double rate) override; double next_occuring_event(double now) override; bool next_occuring_event_isIdempotent() override {return true;} void updateActionsState(double now, double delta) override; diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 831dbdb7bc..6b199b88a0 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -51,7 +51,7 @@ static void IB_action_state_changed_callback( static void IB_action_init_callback( - simgrid::surf::NetworkAction *action, simgrid::routing::NetCard *src, simgrid::routing::NetCard *dst) + simgrid::surf::NetworkAction *action, simgrid::kernel::routing::NetCard *src, simgrid::kernel::routing::NetCard *dst) { simgrid::surf::NetworkIBModel* ibModel = (simgrid::surf::NetworkIBModel*)surf_network_model; diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index 7912f2078d..fd3b806551 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -91,12 +91,12 @@ namespace simgrid { * Callbacks * *************/ - simgrid::xbt::signal Link::onCreation; - simgrid::xbt::signal Link::onDestruction; - simgrid::xbt::signal Link::onStateChange; + simgrid::xbt::signal Link::onCreation; + simgrid::xbt::signal Link::onDestruction; + simgrid::xbt::signal Link::onStateChange; - simgrid::xbt::signal networkActionStateChangedCallbacks; - simgrid::xbt::signal Link::onCommunicate; + simgrid::xbt::signal networkActionStateChangedCallbacks; + simgrid::xbt::signal Link::onCommunicate; } } diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 8caa9df504..fdf56e473a 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -77,7 +77,7 @@ namespace simgrid { * unlimited. * @return The action representing the communication */ - virtual Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate)=0; + virtual Action *communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, double size, double rate)=0; /** @brief Function pointer to the function to use to solve the lmm_system_t * @@ -151,19 +151,19 @@ namespace simgrid { public: /** @brief Callback signal fired when a new Link is created. * Signature: void(Link*) */ - static simgrid::xbt::signal onCreation; + static simgrid::xbt::signal onCreation; /** @brief Callback signal fired when a Link is destroyed. * Signature: void(Link*) */ - static simgrid::xbt::signal onDestruction; + static simgrid::xbt::signal onDestruction; /** @brief Callback signal fired when the state of a Link changes (when it is turned on or off) * Signature: `void(Link*)` */ - static simgrid::xbt::signal onStateChange; + static simgrid::xbt::signal onStateChange; /** @brief Callback signal fired when a communication starts * Signature: `void(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst)` */ - static simgrid::xbt::signal onCommunicate; + static simgrid::xbt::signal onCommunicate; diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 272aa59988..327d244754 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -254,7 +254,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t*host_list, xbt_free(host_list); } -Action *NetworkL07Model::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) +Action *NetworkL07Model::communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, double size, double rate) { sg_host_t*host_list = xbt_new0(sg_host_t, 2); double *flops_amount = xbt_new0(double, 2); diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 80a1fa41f0..5f8a8283b4 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -66,7 +66,7 @@ public: e_surf_link_sharing_policy_t policy, xbt_dict_t properties) override; - Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) override; + Action *communicate(kernel::routing::NetCard *src, kernel::routing::NetCard *dst, double size, double rate) override; bool next_occuring_event_isIdempotent() override {return true;} HostL07Model *p_hostModel; @@ -122,7 +122,7 @@ public: int unref() override; - std::vector * p_netcardList = new std::vector(); + std::vector * p_netcardList = new std::vector(); double *p_computationAmount; double *p_communicationAmount; double m_latency; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 57e5b7f5e9..776ab7add6 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -88,8 +88,8 @@ static std::vector *explodesRadical(const char*radicals){ /** The current AS in the parsing */ -static simgrid::routing::AsImpl *current_routing = nullptr; -static simgrid::routing::AsImpl* routing_get_current() +static simgrid::kernel::routing::AsImpl *current_routing = nullptr; +static simgrid::kernel::routing::AsImpl* routing_get_current() { return current_routing; } @@ -114,12 +114,12 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) { xbt_assert(sg_host_by_name(host->id) == nullptr, "Refusing to create a second host named '%s'.", host->id); - simgrid::routing::AsImpl* current_routing = routing_get_current(); - if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset) - current_routing->hierarchy_ = simgrid::routing::AsImpl::RoutingMode::base; + 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::routing::NetCard *netcard = - new simgrid::routing::NetCardImpl(host->id, simgrid::routing::NetCard::Type::Host, current_routing); + simgrid::kernel::routing::NetCard *netcard = + new simgrid::kernel::routing::NetCardImpl(host->id, simgrid::kernel::routing::NetCard::Type::Host, current_routing); sg_host_t h = simgrid::s4u::Host::by_name_or_create(host->id); h->pimpl_netcard = netcard; @@ -175,16 +175,16 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) /** @brief Add a "router" to the network element list */ void sg_platf_new_router(sg_platf_router_cbarg_t router) { - using simgrid::routing::AsCluster; - simgrid::routing::AsImpl* current_routing = routing_get_current(); + using simgrid::kernel::routing::AsCluster; + simgrid::kernel::routing::AsImpl* current_routing = routing_get_current(); - if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset) - current_routing->hierarchy_ = simgrid::routing::AsImpl::RoutingMode::base; + if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset) + current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::base; xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL), "Refusing to create a router named '%s': this name already describes a node.", router->id); - simgrid::routing::NetCard* netcard = - new simgrid::routing::NetCardImpl(router->id, simgrid::routing::NetCard::Type::Router, current_routing); + simgrid::kernel::routing::NetCard* netcard = + new simgrid::kernel::routing::NetCardImpl(router->id, simgrid::kernel::routing::NetCard::Type::Router, current_routing); xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, netcard); XBT_DEBUG("Router '%s' has the id %d", router->id, netcard->id()); @@ -208,7 +208,7 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router) auto cluster = dynamic_cast(current_routing); if(cluster != nullptr) - cluster->router_ = static_cast(xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL)); + cluster->router_ = static_cast(xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL)); if (TRACE_is_enabled() && TRACE_needs_platform()) sg_instr_new_router(router); @@ -241,10 +241,10 @@ void sg_platf_new_link(sg_platf_link_cbarg_t link){ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) { - using simgrid::routing::AsCluster; - using simgrid::routing::AsClusterDragonfly; - using simgrid::routing::AsClusterFatTree; - using simgrid::routing::AsClusterTorus; + using simgrid::kernel::routing::AsCluster; + using simgrid::kernel::routing::AsClusterDragonfly; + using simgrid::kernel::routing::AsClusterFatTree; + using simgrid::kernel::routing::AsClusterTorus; int rankId=0; @@ -268,7 +268,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) break; } sg_platf_new_AS_begin(&AS); - simgrid::routing::AsCluster *current_as = static_cast(routing_get_current()); + simgrid::kernel::routing::AsCluster *current_as = static_cast(routing_get_current()); current_as->parse_specific_arguments(cluster); if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){ @@ -377,7 +377,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) if (!router.id || !strcmp(router.id, "")) router.id = newid = bprintf("%s%s_router%s", cluster->prefix, cluster->id, cluster->suffix); sg_platf_new_router(&router); - current_as->router_ = (simgrid::routing::NetCard*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL); + current_as->router_ = (simgrid::kernel::routing::NetCard*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL); free(newid); //Make the backbone @@ -402,7 +402,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) simgrid::surf::on_cluster(cluster); } void routing_cluster_add_backbone(simgrid::surf::Link* bb) { - simgrid::routing::AsCluster *cluster = dynamic_cast(current_routing); + simgrid::kernel::routing::AsCluster *cluster = dynamic_cast(current_routing); xbt_assert(cluster, "Only hosts from Cluster can get a backbone."); xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->name()); @@ -648,8 +648,8 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process) void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) { - using simgrid::routing::NetCard; - using simgrid::routing::AsCluster; + using simgrid::kernel::routing::NetCard; + using simgrid::kernel::routing::AsCluster; char *host_id = bprintf("peer_%s", peer->id); char *router_id = bprintf("router_%s", peer->id); @@ -827,23 +827,23 @@ simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS) /* search the routing model */ - simgrid::routing::AsImpl *new_as = nullptr; + simgrid::kernel::routing::AsImpl *new_as = nullptr; switch(AS->routing){ - case A_surfxml_AS_routing_Cluster: new_as = new simgrid::routing::AsCluster(AS->id); break; - case A_surfxml_AS_routing_ClusterDragonfly: new_as = new simgrid::routing::AsClusterDragonfly(AS->id); break; - case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::routing::AsClusterTorus(AS->id); break; - case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::routing::AsClusterFatTree(AS->id); break; - case A_surfxml_AS_routing_Dijkstra: new_as = new simgrid::routing::AsDijkstra(AS->id, 0); break; - case A_surfxml_AS_routing_DijkstraCache: new_as = new simgrid::routing::AsDijkstra(AS->id, 1); break; - case A_surfxml_AS_routing_Floyd: new_as = new simgrid::routing::AsFloyd(AS->id); break; - case A_surfxml_AS_routing_Full: new_as = new simgrid::routing::AsFull(AS->id); break; - case A_surfxml_AS_routing_None: new_as = new simgrid::routing::AsNone(AS->id); break; - case A_surfxml_AS_routing_Vivaldi: new_as = new simgrid::routing::AsVivaldi(AS->id); break; + case A_surfxml_AS_routing_Cluster: new_as = new simgrid::kernel::routing::AsCluster(AS->id); break; + case A_surfxml_AS_routing_ClusterDragonfly: new_as = new simgrid::kernel::routing::AsClusterDragonfly(AS->id); break; + case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::kernel::routing::AsClusterTorus(AS->id); break; + case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::kernel::routing::AsClusterFatTree(AS->id); break; + case A_surfxml_AS_routing_Dijkstra: new_as = new simgrid::kernel::routing::AsDijkstra(AS->id, 0); break; + case A_surfxml_AS_routing_DijkstraCache: new_as = new simgrid::kernel::routing::AsDijkstra(AS->id, 1); break; + case A_surfxml_AS_routing_Floyd: new_as = new simgrid::kernel::routing::AsFloyd(AS->id); break; + case A_surfxml_AS_routing_Full: new_as = new simgrid::kernel::routing::AsFull(AS->id); break; + case A_surfxml_AS_routing_None: new_as = new simgrid::kernel::routing::AsNone(AS->id); break; + case A_surfxml_AS_routing_Vivaldi: new_as = new simgrid::kernel::routing::AsVivaldi(AS->id); break; default: xbt_die("Not a valid model!"); break; } /* make a new routing component */ - simgrid::routing::NetCard *netcard = new simgrid::routing::NetCardImpl(new_as->name(), simgrid::routing::NetCard::Type::As, current_routing); + 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; @@ -854,8 +854,8 @@ simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS) /* it is a part of the tree */ new_as->father_ = current_routing; /* set the father behavior */ - if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset) - current_routing->hierarchy_ = simgrid::routing::AsImpl::RoutingMode::recursive; + if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset) + current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::recursive; /* add to the sons dictionary */ xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, nullptr); } else { @@ -869,7 +869,7 @@ simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS) current_routing = new_as; current_routing->netcard_ = netcard; - simgrid::routing::asCreatedCallbacks(new_as); + simgrid::kernel::routing::asCreatedCallbacks(new_as); if (TRACE_is_enabled()) sg_instr_AS_begin(AS); @@ -886,7 +886,7 @@ void sg_platf_new_AS_seal() { xbt_assert(current_routing, "Cannot seal the current AS: none under construction"); current_routing->seal(); - current_routing = static_cast(current_routing->father()); + current_routing = static_cast(current_routing->father()); if (TRACE_is_enabled()) sg_instr_AS_end(); @@ -895,9 +895,9 @@ void sg_platf_new_AS_seal() /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */ void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t hostlink) { - simgrid::routing::NetCard *netcard = sg_host_by_name(hostlink->id)->pimpl_netcard; + simgrid::kernel::routing::NetCard *netcard = sg_host_by_name(hostlink->id)->pimpl_netcard; xbt_assert(netcard, "Host '%s' not found!", hostlink->id); - xbt_assert(dynamic_cast(current_routing), + xbt_assert(dynamic_cast(current_routing), "Only hosts from Cluster and Vivaldi ASes can get an host_link."); s_surf_parsing_link_up_down_t link_up_down; @@ -908,7 +908,7 @@ void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t hostlink) xbt_assert(link_up_down.linkDown, "Link '%s' not found!",hostlink->link_down); // If dynar is is greater than netcard id and if the host_link is already defined - auto as_cluster = static_cast(current_routing); + auto as_cluster = static_cast(current_routing); if((int)xbt_dynar_length(as_cluster->privateLinks_) > netcard->id() && xbt_dynar_get_as(as_cluster->privateLinks_, netcard->id(), void*)) surf_parse_error("Host_link for '%s' is already defined!",hostlink->id); diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 4ff30eddad..8a2ec6d124 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -287,7 +287,7 @@ void surf_init(int *argc, char **argv) XBT_DEBUG("Add routing levels"); ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, nullptr); ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) { - delete static_cast(p); + delete static_cast(p); }); XBT_DEBUG("Add SURF levels"); diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 857e69d022..d5771d196f 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -21,14 +21,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf"); namespace simgrid { +namespace kernel { namespace routing { /* Callbacks */ - simgrid::xbt::signal netcardCreatedCallbacks; - simgrid::xbt::signal asCreatedCallbacks; + simgrid::xbt::signal netcardCreatedCallbacks; + simgrid::xbt::signal asCreatedCallbacks; - -}} // namespace simgrid::routing +}}} // namespace simgrid::kernel::routing /** * @ingroup SURF_build_api @@ -53,17 +53,17 @@ int ROUTING_PROP_ASR_LEVEL = -1; //Where the properties are stored * * Netcards are the thing that connect host or routers to the network */ -simgrid::routing::NetCard *sg_netcard_by_name_or_null(const char *name) +simgrid::kernel::routing::NetCard *sg_netcard_by_name_or_null(const char *name) { sg_host_t h = sg_host_by_name(name); - simgrid::routing::NetCard *netcard = h==nullptr ? nullptr: h->pimpl_netcard; + simgrid::kernel::routing::NetCard *netcard = h==nullptr ? nullptr: h->pimpl_netcard; if (!netcard) - netcard = (simgrid::routing::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); + netcard = (simgrid::kernel::routing::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); return netcard; } /* Global vars */ -simgrid::routing::RoutingPlatf *routing_platf = nullptr; +simgrid::kernel::routing::RoutingPlatf *routing_platf = nullptr; void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) @@ -80,6 +80,7 @@ void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) } namespace simgrid { +namespace kernel { namespace routing { /** @@ -128,13 +129,12 @@ xbt_dynar_t RoutingPlatf::getOneLinkRoutes(){ return _recursiveGetOneLinkRoutes(root_); } -} -} +}}} /** @brief create the root AS */ void routing_model_create(Link *loopback) { - routing_platf = new simgrid::routing::RoutingPlatf(loopback); + routing_platf = new simgrid::kernel::routing::RoutingPlatf(loopback); } /* ************************************************************************** */ @@ -145,7 +145,7 @@ static void check_disk_attachment() xbt_lib_cursor_t cursor; char *key; void **data; - simgrid::routing::NetCard *host_elm; + simgrid::kernel::routing::NetCard *host_elm; xbt_lib_foreach(storage_lib, cursor, key, data) { if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) { simgrid::surf::Storage *storage = static_cast(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL)); @@ -168,11 +168,11 @@ void routing_exit(void) { delete routing_platf; } -simgrid::routing::RoutingPlatf::RoutingPlatf(simgrid::surf::Link *loopback) +simgrid::kernel::routing::RoutingPlatf::RoutingPlatf(simgrid::surf::Link *loopback) : loopback_(loopback) { } -simgrid::routing::RoutingPlatf::~RoutingPlatf() +simgrid::kernel::routing::RoutingPlatf::~RoutingPlatf() { delete root_; } diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 420557e3be..8645ad765d 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -24,6 +24,7 @@ XBT_PRIVATE xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_ SG_END_DECL() namespace simgrid { +namespace kernel { namespace routing { XBT_PUBLIC_DATA(simgrid::xbt::signal) asCreatedCallbacks; @@ -64,7 +65,7 @@ public: { if (containingAS != nullptr) id_ = containingAS->addComponent(this); - simgrid::routing::netcardCreatedCallbacks(this); + simgrid::kernel::routing::netcardCreatedCallbacks(this); } ~NetCardImpl() { xbt_free(name_);}; @@ -108,7 +109,6 @@ public: void getRouteAndLatency(NetCard *src, NetCard *dst, std::vector * links, double *latency); }; -} -} +}}} #endif /* NETWORK_ROUTING_HPP_ */ diff --git a/teshsuite/simdag/is-router/is-router.cpp b/teshsuite/simdag/is-router/is-router.cpp index 5e612766b5..680fce3fb6 100644 --- a/teshsuite/simdag/is-router/is-router.cpp +++ b/teshsuite/simdag/is-router/is-router.cpp @@ -24,12 +24,12 @@ int main(int argc, char **argv) printf("Host number: %zu, link number: %d, elmts number: %d\n", sg_host_count(), sg_link_count(), size); xbt_dict_foreach(host_list, cursor, key, data) { - simgrid::routing::NetCard * nc = sg_netcard_by_name_or_null(key); + simgrid::kernel::routing::NetCard * nc = sg_netcard_by_name_or_null(key); printf(" - Seen: \"%s\". Type: %s\n", key, nc->isRouter() ? "router" : (nc->isAS()?"AS":"host")); } xbt_lib_foreach(as_router_lib, cursor, key, data) { - simgrid::routing::NetCard * nc = sg_netcard_by_name_or_null(key); + simgrid::kernel::routing::NetCard * nc = sg_netcard_by_name_or_null(key); printf(" - Seen: \"%s\". Type: %s\n", key, nc->isRouter() ? "router" : (nc->isAS()?"AS":"host")); } -- 2.20.1