Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move some content out of parsing to the classes
[simgrid.git] / src / kernel / routing / AsFull.cpp
index e0b6cda..a87cec6 100644 (file)
@@ -13,9 +13,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 namespace simgrid {
 namespace kernel {
 namespace routing {
-  AsFull::AsFull(const char*name)
-    : AsRoutedGraph(name)
-  {
+AsFull::AsFull(As* father, const char* name) : AsRoutedGraph(father, name)
+{
   }
 
 void AsFull::seal() {
@@ -23,7 +22,7 @@ void AsFull::seal() {
   sg_platf_route_cbarg_t e_route;
 
   /* set utils vars */
-  int table_size = (int)xbt_dynar_length(vertices_);
+  int table_size = static_cast<int>(vertices_.size());
 
   /* Create table if necessary */
   if (!routingTable_)
@@ -47,11 +46,10 @@ void AsFull::seal() {
 
 AsFull::~AsFull(){
   if (routingTable_) {
-    int table_size = (int)xbt_dynar_length(vertices_);
-    int i, j;
+    int table_size = static_cast<int>(vertices_.size());
     /* Delete routing table */
-    for (i = 0; i < table_size; i++)
-      for (j = 0; j < table_size; j++) {
+    for (int i = 0; i < table_size; i++)
+      for (int j = 0; j < table_size; j++) {
         if (TO_ROUTE_FULL(i,j)){
           delete TO_ROUTE_FULL(i,j)->link_list;
           xbt_free(TO_ROUTE_FULL(i,j));
@@ -67,7 +65,7 @@ void AsFull::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg
       src->name(), src->id(), dst->name(), dst->id());
 
   /* set utils vars */
-  size_t table_size = xbt_dynar_length(vertices_);
+  size_t table_size = vertices_.size();
 
   sg_platf_route_cbarg_t e_route = nullptr;
 
@@ -79,7 +77,7 @@ void AsFull::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg
     for (auto link : *e_route->link_list) {
       res->link_list->push_back(link);
       if (lat)
-        *lat += static_cast<Link*>(link)->getLatency();
+        *lat += static_cast<Link*>(link)->latency();
     }
   }
 }
@@ -93,7 +91,7 @@ void AsFull::addRoute(sg_platf_route_cbarg_t route)
 
   addRouteCheckParams(route);
 
-  size_t table_size = xbt_dynar_length(vertices_);
+  size_t table_size = vertices_.size();
 
   if (!routingTable_)
     routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);