From: Martin Quinson Date: Sat, 13 Feb 2016 10:02:31 +0000 (+0100) Subject: routing: dedupplicate code X-Git-Tag: v3_13~844 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c4ffa9d533441c926ec687986415b635629d496a routing: dedupplicate code --- diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 5ad4254dee..b484350dd7 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -49,6 +49,16 @@ namespace surf { return xbt_dynar_length(vertices_)-1; } + void As::parseRoute(sg_platf_route_cbarg_t /*route*/){ + THROW_IMPOSSIBLE; /* No. */ + } + void As::parseASroute(sg_platf_route_cbarg_t /*route*/){ + THROW_IMPOSSIBLE; + } + void As::parseBypassroute(sg_platf_route_cbarg_t /*e_route*/){ + THROW_IMPOSSIBLE; + } + }} // namespace simgrid::surf /** diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index e5eed86560..a97b766440 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -98,14 +98,11 @@ public: virtual sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst,double *lat)=0; - /* The parser calls the following functions to inform the routing models - * that a new element is added to the AS currently built. - * - * Of course, only the routing model of this AS is informed, not every ones */ + /* Add content to the AS, at parsing time. It should be sealed afterward. */ virtual int addComponent(NetCard *elm); /* A host, a router or an AS, whatever */ - virtual void parseRoute(sg_platf_route_cbarg_t route)=0; - virtual void parseASroute(sg_platf_route_cbarg_t route)=0; - virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; + virtual void parseRoute(sg_platf_route_cbarg_t route); + virtual void parseASroute(sg_platf_route_cbarg_t route); + virtual void parseBypassroute(sg_platf_route_cbarg_t e_route); }; struct XBT_PRIVATE NetCardImpl : public NetCard { diff --git a/src/surf/surf_routing_generic.cpp b/src/surf/surf_routing_generic.cpp index 2e8ef8014a..595568e0fd 100644 --- a/src/surf/surf_routing_generic.cpp +++ b/src/surf/surf_routing_generic.cpp @@ -35,18 +35,6 @@ void routing_route_free(sg_platf_route_cbarg_t route) namespace simgrid { namespace surf { -void AsGeneric::parseRoute(sg_platf_route_cbarg_t /*route*/){ - THROW_IMPOSSIBLE; -} - -void AsGeneric::parseASroute(sg_platf_route_cbarg_t /*route*/){ - THROW_IMPOSSIBLE; -} - -void AsGeneric::getRouteAndLatency(NetCard */*src*/, NetCard */*dst*/, sg_platf_route_cbarg_t /*into*/, double */*latency*/){ - THROW_IMPOSSIBLE; -} - AsGeneric::AsGeneric(const char*name) : AsNone(name) { diff --git a/src/surf/surf_routing_generic.hpp b/src/surf/surf_routing_generic.hpp index bd5d3c560d..33efa904b1 100644 --- a/src/surf/surf_routing_generic.hpp +++ b/src/surf/surf_routing_generic.hpp @@ -21,16 +21,10 @@ public: AsGeneric(const char*name); ~AsGeneric(); - virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; virtual sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst, double *lat) override; - /* The parser calls the following functions to inform the routing models - * that a new element is added to the AS currently built. - * - * Of course, only the routing model of this AS is informed, not every ones */ - virtual void parseRoute(sg_platf_route_cbarg_t route) override; - virtual void parseASroute(sg_platf_route_cbarg_t route) override; + /* Add content to the AS, at parsing time */ virtual void parseBypassroute(sg_platf_route_cbarg_t e_route) override; virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order); diff --git a/src/surf/surf_routing_none.cpp b/src/surf/surf_routing_none.cpp index ddd0dd8e35..88207226db 100644 --- a/src/surf/surf_routing_none.cpp +++ b/src/surf/surf_routing_none.cpp @@ -35,17 +35,5 @@ void AsNone::getGraph(xbt_graph_t /*graph*/, xbt_dict_t /*nodes*/, xbt_dict_t /* sg_platf_route_cbarg_t AsNone::getBypassRoute(NetCard * /*src*/, NetCard * /*dst*/, double * /*lat*/) { return NULL; } - -void AsNone::parseRoute(sg_platf_route_cbarg_t /*route*/){ - THROW_IMPOSSIBLE; /* No. */ -} - -void AsNone::parseASroute(sg_platf_route_cbarg_t /*route*/){ - THROW_IMPOSSIBLE; -} -void AsNone::parseBypassroute(sg_platf_route_cbarg_t /*e_route*/){ - THROW_IMPOSSIBLE; -} - } } diff --git a/src/surf/surf_routing_none.hpp b/src/surf/surf_routing_none.hpp index b537f9d183..c1d45b13c8 100644 --- a/src/surf/surf_routing_none.hpp +++ b/src/surf/surf_routing_none.hpp @@ -25,14 +25,6 @@ public: xbt_dynar_t getOneLinkRoutes() override; void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst, double *lat) override; - - /* The parser calls the following functions to inform the routing models - * that a new element is added to the AS currently built. - * - * Of course, only the routing model of this AS is informed, not every ones */ - void parseRoute(sg_platf_route_cbarg_t route) override; - void parseASroute(sg_platf_route_cbarg_t route) override; - void parseBypassroute(sg_platf_route_cbarg_t e_route) override; }; }