Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill useless code now that As::Seal() exists
[simgrid.git] / src / surf / surf_routing_full.cpp
index a3ffd03..f80b2f6 100644 (file)
@@ -17,38 +17,35 @@ AS_t model_full_create(void)
   return new simgrid::surf::AsFull();
 }
 
-void model_full_end(AS_t _routing)
-{
+namespace simgrid {
+namespace surf {
+void AsFull::Seal() {
   int i;
   sg_platf_route_cbarg_t e_route;
 
   /* set utils vars */
-  simgrid::surf::AsFull *routing = static_cast<simgrid::surf::AsFull*>(_routing);
-  int table_size = (int)xbt_dynar_length(routing->p_indexNetworkElm);
+  int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
 
   /* Create table if necessary */
-  if (!routing->p_routingTable)
-    routing->p_routingTable = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
+  if (!p_routingTable)
+    p_routingTable = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
 
   /* Add the loopback if needed */
-  if (routing_platf->p_loopback && routing->p_hierarchy == SURF_ROUTING_BASE) {
+  if (routing_platf->p_loopback && p_hierarchy == SURF_ROUTING_BASE) {
     for (i = 0; i < table_size; i++) {
-      e_route = routing->TO_ROUTE_FULL(i, i);
+      e_route = TO_ROUTE_FULL(i, i);
       if (!e_route) {
         e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
         e_route->gw_src = NULL;
         e_route->gw_dst = NULL;
         e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
         xbt_dynar_push(e_route->link_list, &routing_platf->p_loopback);
-        routing->TO_ROUTE_FULL(i, i) = e_route;
+        TO_ROUTE_FULL(i, i) = e_route;
       }
     }
   }
 }
 
-namespace simgrid {
-namespace surf {
-
 AsFull::~AsFull(){
   if (p_routingTable) {
     int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
@@ -80,10 +77,10 @@ xbt_dynar_t AsFull::getOneLinkRoutes()
           void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
           Onelink *onelink;
           if (p_hierarchy == SURF_ROUTING_BASE) {
-               NetCard *tmp_src = xbt_dynar_get_as(p_indexNetworkElm, src, sg_netcard_t);
+          NetCard *tmp_src = xbt_dynar_get_as(p_indexNetworkElm, src, sg_netcard_t);
             tmp_src->setId(src);
-               NetCard *tmp_dst = xbt_dynar_get_as(p_indexNetworkElm, dst, sg_netcard_t);
-               tmp_dst->setId(dst);
+          NetCard *tmp_dst = xbt_dynar_get_as(p_indexNetworkElm, dst, sg_netcard_t);
+          tmp_dst->setId(dst);
             onelink = new Onelink(link, tmp_src, tmp_dst);
           } else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
             onelink = new Onelink(link, route->gw_src, route->gw_dst);
@@ -213,11 +210,11 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route)
       XBT_DEBUG("Load ASroute from \"%s\" to \"%s\"", src, dst);
       if (!route->gw_src ||
           route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
-       surf_parse_error("The src_gateway \"%s\" does not exist!",
+      surf_parse_error("The src_gateway \"%s\" does not exist!",
                 route->gw_src ? route->gw_src->getName() : "(null)");
       if (!route->gw_dst ||
           route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
-       surf_parse_error("The dst_gateway \"%s\" does not exist!",
+      surf_parse_error("The dst_gateway \"%s\" does not exist!",
                 route->gw_dst ? route->gw_dst->getName() : "(null)");
       XBT_DEBUG("ASroute goes from \"%s\" to \"%s\"",
                 route->gw_src->getName(), route->gw_dst->getName());