Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove "using namespace"
[simgrid.git] / src / surf / network_ib.cpp
index ff2211b..831dbdb 100644 (file)
@@ -4,7 +4,6 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <algorithm>
 #include <utility>
 
 #include "network_ib.hpp"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
 
 static void IB_create_host_callback(simgrid::s4u::Host& host){
-  using namespace simgrid::surf;
+  using simgrid::surf::NetworkIBModel;
+  using simgrid::surf::IBNode;
 
   static int id=0;
   // pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives
-  if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
+  if(((NetworkIBModel*)surf_network_model)->active_nodes==nullptr)
     ((NetworkIBModel*)surf_network_model)->active_nodes=xbt_dict_new();
 
   IBNode* act = new IBNode(id);
 
   id++;
   xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes,
-      host.name().c_str(), act, NULL);
+      host.name().c_str(), act, nullptr);
 
 }
 
@@ -35,7 +35,9 @@ static void IB_action_state_changed_callback(
     simgrid::surf::NetworkAction *action,
     simgrid::surf::Action::State statein, simgrid::surf::Action::State stateout)
 {
-  using namespace simgrid::surf;
+  using simgrid::surf::NetworkIBModel;
+  using simgrid::surf::IBNode;
+
   if(statein!=simgrid::surf::Action::State::running || stateout!=simgrid::surf::Action::State::done)
     return;
   std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
@@ -49,7 +51,7 @@ static void IB_action_state_changed_callback(
 
 
 static void IB_action_init_callback(
-    simgrid::surf::NetworkAction *action, simgrid::surf::NetCard *src, simgrid::surf::NetCard *dst)
+    simgrid::surf::NetworkAction *action, simgrid::routing::NetCard *src, simgrid::routing::NetCard *dst)
 {
   simgrid::surf::NetworkIBModel* ibModel = (simgrid::surf::NetworkIBModel*)surf_network_model;
 
@@ -102,7 +104,7 @@ namespace simgrid {
     NetworkIBModel::NetworkIBModel()
     : NetworkSmpiModel() {
       haveGap_=false;
-      active_nodes=NULL;
+      active_nodes=nullptr;
 
       const char* IB_factors_string=xbt_cfg_get_string("smpi/IB-penalty-factors");
       xbt_dynar_t radical_elements = xbt_str_split(IB_factors_string, ";");
@@ -119,9 +121,9 @@ namespace simgrid {
 
     NetworkIBModel::~NetworkIBModel()
     {
-      xbt_dict_cursor_t cursor = NULL;
-      IBNode* instance = NULL;
-      char *name = NULL;
+      xbt_dict_cursor_t cursor = nullptr;
+      IBNode* instance = nullptr;
+      char *name = nullptr;
       xbt_dict_foreach(active_nodes, cursor, name, instance)
       delete instance;
       xbt_dict_free(&active_nodes);
@@ -197,7 +199,7 @@ namespace simgrid {
         return;
 
       bool* updated=(bool*)xbt_malloc0(xbt_dict_size(active_nodes)*sizeof(bool));
-      ActiveComm* comm=NULL;
+      ActiveComm* comm=nullptr;
       if(remove){
         if(to->ActiveCommsDown[from]==1)
           to->ActiveCommsDown.erase(from);