From eac77828e5174e46ff0bffc3a17149aaefb62438 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 20 Feb 2016 00:27:32 +0100 Subject: [PATCH 1/1] move one method higher in As hierarchy + rework the inheritance tree: models don't need to inherit of AsNone --- src/surf/surf_routing.cpp | 4 +++- src/surf/surf_routing.hpp | 2 +- src/surf/surf_routing_cluster.cpp | 2 +- src/surf/surf_routing_cluster.hpp | 4 ++-- src/surf/surf_routing_generic.cpp | 2 +- src/surf/surf_routing_generic.hpp | 4 ++-- src/surf/surf_routing_none.cpp | 4 ---- src/surf/surf_routing_none.hpp | 1 - 8 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 470214230e..2fa1297d6d 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -49,7 +49,9 @@ namespace surf { sg_platf_route_cbarg_t As::getBypassRoute(NetCard * /*src*/, NetCard * /*dst*/, double * /*lat*/) { return NULL; } - + xbt_dynar_t As::getOneLinkRoutes() { + return NULL; + } int As::addComponent(NetCard *elm) { XBT_DEBUG("Load component \"%s\"", elm->name()); diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index d87bcb37bf..8b30f5fe1e 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -92,7 +92,7 @@ public: */ virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency)=0; /** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */ - virtual xbt_dynar_t getOneLinkRoutes()=0; + virtual xbt_dynar_t getOneLinkRoutes(); virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0; diff --git a/src/surf/surf_routing_cluster.cpp b/src/surf/surf_routing_cluster.cpp index 1b648c5f44..9b364b1c67 100644 --- a/src/surf/surf_routing_cluster.cpp +++ b/src/surf/surf_routing_cluster.cpp @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf" namespace simgrid { namespace surf { AsCluster::AsCluster(const char*name) - : AsNone(name) + : As(name) {} void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) diff --git a/src/surf/surf_routing_cluster.hpp b/src/surf/surf_routing_cluster.hpp index bd2da0a5ec..8ea4836198 100644 --- a/src/surf/surf_routing_cluster.hpp +++ b/src/surf/surf_routing_cluster.hpp @@ -9,7 +9,7 @@ #include -#include "surf_routing_none.hpp" +#include "surf_routing.hpp" #include "network_interface.hpp" namespace simgrid { @@ -24,7 +24,7 @@ class XBT_PRIVATE AsCluster; /* ************************************************** */ /* ************** Cluster ROUTING **************** */ -class AsCluster: public AsNone { +class AsCluster: public As { public: AsCluster(const char*name); diff --git a/src/surf/surf_routing_generic.cpp b/src/surf/surf_routing_generic.cpp index 3d7651c5ac..526b4d2848 100644 --- a/src/surf/surf_routing_generic.cpp +++ b/src/surf/surf_routing_generic.cpp @@ -36,7 +36,7 @@ namespace simgrid { namespace surf { AsGeneric::AsGeneric(const char*name) - : AsNone(name) + : As(name) { } diff --git a/src/surf/surf_routing_generic.hpp b/src/surf/surf_routing_generic.hpp index 9d762b3912..073a2d4bc9 100644 --- a/src/surf/surf_routing_generic.hpp +++ b/src/surf/surf_routing_generic.hpp @@ -6,7 +6,7 @@ #include -#include "surf_routing_none.hpp" +#include "surf_routing.hpp" #ifndef SURF_ROUTING_GENERIC_HPP_ #define SURF_ROUTING_GENERIC_HPP_ @@ -16,7 +16,7 @@ namespace surf { class XBT_PRIVATE AsGeneric; -class XBT_PRIVATE AsGeneric : public AsNone { +class XBT_PRIVATE AsGeneric : public As { public: AsGeneric(const char*name); ~AsGeneric(); diff --git a/src/surf/surf_routing_none.cpp b/src/surf/surf_routing_none.cpp index 8ff5272c0b..887e9aca37 100644 --- a/src/surf/surf_routing_none.cpp +++ b/src/surf/surf_routing_none.cpp @@ -17,10 +17,6 @@ AsNone::AsNone(const char*name) AsNone::~AsNone() {} -xbt_dynar_t AsNone::getOneLinkRoutes() { - return NULL; -} - void AsNone::getRouteAndLatency(NetCard * /*src*/, NetCard * /*dst*/, sg_platf_route_cbarg_t /*res*/, double */*lat*/) {} diff --git a/src/surf/surf_routing_none.hpp b/src/surf/surf_routing_none.hpp index 6a82602d36..16b97a4607 100644 --- a/src/surf/surf_routing_none.hpp +++ b/src/surf/surf_routing_none.hpp @@ -21,7 +21,6 @@ public: ~AsNone(); void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; - xbt_dynar_t getOneLinkRoutes() override; void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; }; -- 2.20.1