Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
routing: dedupplicate code
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 13 Feb 2016 10:02:31 +0000 (11:02 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 13 Feb 2016 10:02:31 +0000 (11:02 +0100)
src/surf/surf_routing.cpp
src/surf/surf_routing.hpp
src/surf/surf_routing_generic.cpp
src/surf/surf_routing_generic.hpp
src/surf/surf_routing_none.cpp
src/surf/surf_routing_none.hpp

index 5ad4254..b484350 100644 (file)
@@ -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
 
 /**
index e5eed86..a97b766 100644 (file)
@@ -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 {
index 2e8ef80..595568e 100644 (file)
@@ -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)
 {
index bd5d3c5..33efa90 100644 (file)
@@ -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);
index ddd0dd8..8820722 100644 (file)
@@ -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;
-}
-
 }
 }
index b537f9d..c1d45b1 100644 (file)
@@ -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;
 };
 
 }