From 455435b8a7cc8d84037aa66104a73d4760d9666f Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 8 Dec 2016 10:03:04 +0100 Subject: [PATCH] rename AsRoute to BypassRoute, and move it to its own file --- include/simgrid/s4u/As.hpp | 4 ++-- src/kernel/routing/AsImpl.cpp | 5 +++-- src/kernel/routing/BypassRoute.hpp | 29 +++++++++++++++++++++++++++++ src/s4u/s4u_as.cpp | 3 ++- src/surf/surf_routing.hpp | 12 ------------ tools/cmake/DefinePackages.cmake | 1 + 6 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 src/kernel/routing/BypassRoute.hpp diff --git a/include/simgrid/s4u/As.hpp b/include/simgrid/s4u/As.hpp index 21e57c6e5d..33fcb48e11 100644 --- a/include/simgrid/s4u/As.hpp +++ b/include/simgrid/s4u/As.hpp @@ -27,7 +27,7 @@ namespace kernel { namespace routing { class AsImpl; class NetCard; - class AsRoute; + class BypassRoute; } } namespace s4u { @@ -73,7 +73,7 @@ private: bool sealed_ = false; // We cannot add more content when sealed - std::map, kernel::routing::AsRoute*> + std::map, kernel::routing::BypassRoute*> bypassRoutes_; // src x dst -> route xbt_dict_t children_ = xbt_dict_new_homogeneous(nullptr); // sub-ASes }; diff --git a/src/kernel/routing/AsImpl.cpp b/src/kernel/routing/AsImpl.cpp index 4ff5801d07..1be8910964 100644 --- a/src/kernel/routing/AsImpl.cpp +++ b/src/kernel/routing/AsImpl.cpp @@ -7,6 +7,7 @@ #include "simgrid/s4u/host.hpp" #include "src/kernel/routing/AsImpl.hpp" +#include "src/kernel/routing/BypassRoute.hpp" #include "src/kernel/routing/NetCard.hpp" #include "src/surf/cpu_interface.hpp" #include "src/surf/network_interface.hpp" @@ -160,7 +161,7 @@ namespace simgrid { /* Base case, no recursion is needed */ if (dst->containingAS() == this && src->containingAS() == this) { if (bypassRoutes_.find({src, dst}) != bypassRoutes_.end()) { - AsRoute* bypassedRoute = bypassRoutes_.at({src, dst}); + BypassRoute* bypassedRoute = bypassRoutes_.at({src, dst}); for (surf::Link* link : bypassedRoute->links) { links->push_back(link); if (latency) @@ -204,7 +205,7 @@ namespace simgrid { int max_index = std::max(max_index_src, max_index_dst); /* (3) Search for a bypass making the path up to the ancestor useless */ - AsRoute* bypassedRoute = nullptr; + BypassRoute* bypassedRoute = nullptr; std::pair key; for (int max = 0; max <= max_index; max++) { for (int i = 0; i < max; i++) { diff --git a/src/kernel/routing/BypassRoute.hpp b/src/kernel/routing/BypassRoute.hpp new file mode 100644 index 0000000000..e791d39998 --- /dev/null +++ b/src/kernel/routing/BypassRoute.hpp @@ -0,0 +1,29 @@ +/* Copyright (c) 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. */ + +#ifndef KERNEL_ROUTING_BYPASSROUTE_HPP_ +#define KERNEL_ROUTING_BYPASSROUTE_HPP_ + +#include +#include + +#include "src/kernel/routing/NetCard.hpp" + +namespace simgrid { +namespace kernel { +namespace routing { + +class BypassRoute { +public: + explicit BypassRoute(NetCard* gwSrc, NetCard* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {} + const NetCard* gw_src; + const NetCard* gw_dst; + std::vector links; +}; +} +} +} + +#endif /* KERNEL_ROUTING_BYPASSROUTE_HPP_ */ diff --git a/src/s4u/s4u_as.cpp b/src/s4u/s4u_as.cpp index ac3a1f5edd..1a8587b16d 100644 --- a/src/s4u/s4u_as.cpp +++ b/src/s4u/s4u_as.cpp @@ -9,6 +9,7 @@ #include #include +#include "src/kernel/routing/BypassRoute.hpp" #include "src/kernel/routing/NetCard.hpp" #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header #include "src/surf/surf_routing.hpp" @@ -101,7 +102,7 @@ namespace simgrid { } /* Build a copy that will be stored in the dict */ - kernel::routing::AsRoute* newRoute = new kernel::routing::AsRoute(e_route->gw_src, e_route->gw_dst); + kernel::routing::BypassRoute* newRoute = new kernel::routing::BypassRoute(e_route->gw_src, e_route->gw_dst); for (auto link : *e_route->link_list) newRoute->links.push_back(link); diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 878ffc9915..d42dac9dbf 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -26,18 +26,6 @@ namespace routing { XBT_PUBLIC_DATA(simgrid::xbt::signal) asCreatedCallbacks; -/*********** - * Classes * - ***********/ - -class AsRoute { -public: - explicit AsRoute(NetCard* gwSrc, NetCard* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {} - const NetCard* gw_src; - const NetCard* gw_dst; - std::vector links; -}; - }}} #endif /* NETWORK_ROUTING_HPP_ */ diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 7e9dc7c668..7d5b8d431e 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -74,6 +74,7 @@ set(EXTRA_DIST src/kernel/routing/AsRoutedGraph.hpp src/kernel/routing/AsNone.hpp src/kernel/routing/AsVivaldi.hpp + src/kernel/routing/BypassRoute.hpp src/kernel/routing/NetCard.hpp src/surf/storage_interface.hpp -- 2.20.1