Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move implementation bits of s4u::As into surf::AsImpl
[simgrid.git] / src / surf / surf_routing_floyd.cpp
index c902ac3..dc5c9d7 100644 (file)
@@ -39,41 +39,8 @@ AsFloyd::~AsFloyd(){
   xbt_free(costTable_);
 }
 
-/* Business methods */
-xbt_dynar_t AsFloyd::getOneLinkRoutes()
-{
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
-  sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
-  route->link_list = new std::vector<Link*>();
-
-  int table_size = xbt_dynar_length(vertices_);
-  for(int src=0; src < table_size; src++) {
-    for(int dst=0; dst< table_size; dst++) {
-      route->link_list->clear();
-      NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*);
-      NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*);
-      this->getRouteAndLatency(src_elm, dst_elm, route, NULL);
-
-      if (route->link_list->size() == 1) {
-        void *link = route->link_list->at(0);
-        Onelink *onelink;
-        if (hierarchy_ == SURF_ROUTING_BASE)
-          onelink = new Onelink(link, src_elm, dst_elm);
-        else if (hierarchy_ == SURF_ROUTING_RECURSIVE)
-          onelink = new Onelink(link, route->gw_src, route->gw_dst);
-        else
-          onelink = new Onelink(link, NULL, NULL);
-        xbt_dynar_push(ret, &onelink);
-      }
-    }
-  }
-
-  return ret;
-}
-
 void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat)
 {
-
   size_t table_size = xbt_dynar_length(vertices_);
 
   getRouteCheckParams(src, dst);
@@ -90,7 +57,7 @@ void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbar
     cur = pred;
   } while (cur != src->id());
 
-  if (hierarchy_ == SURF_ROUTING_RECURSIVE) {
+  if (hierarchy_ == AsImpl::ROUTING_RECURSIVE) {
     route->gw_src = xbt_dynar_getlast_as(route_stack, sg_platf_route_cbarg_t)->gw_src;
     route->gw_dst = xbt_dynar_getfirst_as(route_stack, sg_platf_route_cbarg_t)->gw_dst;
   }
@@ -99,7 +66,7 @@ void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbar
   while (!xbt_dynar_is_empty(route_stack)) {
     sg_platf_route_cbarg_t e_route = xbt_dynar_pop_as(route_stack, sg_platf_route_cbarg_t);
 
-    if (hierarchy_ == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL && strcmp(prev_dst_gw->name(), e_route->gw_src->name())) {
+    if (hierarchy_ == AsImpl::ROUTING_RECURSIVE && prev_dst_gw != NULL && strcmp(prev_dst_gw->name(), e_route->gw_src->name())) {
       routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src, route->link_list, lat);
     }
 
@@ -202,7 +169,7 @@ void AsFloyd::Seal(){
   }
 
   /* Add the loopback if needed */
-  if (routing_platf->loopback_ && hierarchy_ == SURF_ROUTING_BASE) {
+  if (routing_platf->loopback_ && hierarchy_ == AsImpl::ROUTING_BASE) {
     for (unsigned int i = 0; i < table_size; i++) {
       sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i);
       if (!e_route) {