Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
routing: move an empty implementation to the super class
[simgrid.git] / src / surf / surf_routing.cpp
index 8bad717..fbc8c5c 100644 (file)
@@ -21,6 +21,7 @@
 #include "src/surf/surf_routing_full.hpp"
 #include "src/surf/surf_routing_vivaldi.hpp"
 
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
 
 namespace simgrid {
 namespace surf {
@@ -35,13 +36,34 @@ namespace surf {
   As::~As()
   {
     xbt_dict_free(&sons_);
-    xbt_dynar_free(&p_indexNetworkElm);
+    xbt_dynar_free(&vertices_);
     xbt_dynar_free(&upDownLinks);
     xbt_free(name_);
     if (netcard_)
       delete netcard_;
   }
 
+  sg_platf_route_cbarg_t As::getBypassRoute(NetCard * /*src*/, NetCard * /*dst*/, double * /*lat*/) {
+    return NULL;
+  }
+
+
+  int As::addComponent(NetCard *elm) {
+    XBT_DEBUG("Load component \"%s\"", elm->getName());
+    xbt_dynar_push_as(vertices_, NetCard*, elm);
+    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
 
 /**
@@ -79,7 +101,6 @@ simgrid::surf::NetCard *sg_netcard_by_name_or_null(const char *name)
 /* Global vars */
 simgrid::surf::RoutingPlatf *routing_platf = NULL;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
 
 /** The current AS in the parsing */
 static simgrid::surf::As *current_routing = NULL;
@@ -186,7 +207,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
     xbt_dict_set(current_routing->sons_, AS->id,
                  (void *) new_as, NULL);
     /* add to the father element list */
-    netcard->setId(current_routing->parseAS(netcard));
+    netcard->setId(current_routing->addComponent(netcard));
   } else {
     THROWF(arg_error, 0, "All defined components must belong to a AS");
   }
@@ -850,7 +871,7 @@ xbt_dict_t surf_AS_get_routing_sons(simgrid::surf::As *as)
 
 xbt_dynar_t surf_AS_get_hosts(simgrid::surf::As *as)
 {
-  xbt_dynar_t elms = as->p_indexNetworkElm;
+  xbt_dynar_t elms = as->vertices_;
   int count = xbt_dynar_length(elms);
   xbt_dynar_t res =  xbt_dynar_new(sizeof(sg_host_t), NULL);
   for (int index = 0; index < count; index++) {