Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove 'using namespace foo;' in headers
authorGabriel Corona <gabriel.corona@loria.fr>
Wed, 9 Dec 2015 12:25:12 +0000 (13:25 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Wed, 9 Dec 2015 12:25:12 +0000 (13:25 +0100)
13 files changed:
src/surf/host_clm03.cpp
src/surf/host_ptask_L07.cpp
src/surf/host_ptask_L07.hpp
src/surf/network_cm02.cpp
src/surf/network_ib.cpp
src/surf/network_interface.cpp
src/surf/network_smpi.cpp
src/surf/ns3/ns3_simulator.h
src/surf/surf_interface.hpp
src/surf/surf_routing_cluster_fat_tree.cpp
src/surf/surf_routing_cluster_fat_tree.hpp
src/surf/surf_routing_generic.cpp
src/surf/vm_hl13.cpp

index 5a48110..e7151db 100644 (file)
@@ -4,6 +4,10 @@
 /* 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. */
 
 /* 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 <cstdlib>
+
+#include <algorithm>
+
 #include "host_clm03.hpp"
 
 #include "cpu_cas01.hpp"
 #include "host_clm03.hpp"
 
 #include "cpu_cas01.hpp"
@@ -62,7 +66,7 @@ double HostCLM03Model::shareResources(double now){
                typeid(surf_network_model).name(), min_by_net,
                        typeid(surf_storage_model).name(), min_by_sto);
 
                typeid(surf_network_model).name(), min_by_net,
                        typeid(surf_storage_model).name(), min_by_sto);
 
-  double res = max(max(min_by_cpu, min_by_net), min_by_sto);
+  double res = std::max(std::max(min_by_cpu, min_by_net), min_by_sto);
   if (min_by_cpu >= 0.0 && min_by_cpu < res)
        res = min_by_cpu;
   if (min_by_net >= 0.0 && min_by_net < res)
   if (min_by_cpu >= 0.0 && min_by_cpu < res)
        res = min_by_cpu;
   if (min_by_net >= 0.0 && min_by_net < res)
index ff196aa..57367bb 100644 (file)
@@ -4,6 +4,10 @@
 /* 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. */
 
 /* 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 <cstdlib>
+
+#include <algorithm>
+
 #include "host_ptask_L07.hpp"
 
 #include "cpu_interface.hpp"
 #include "host_ptask_L07.hpp"
 
 #include "cpu_interface.hpp"
@@ -596,7 +600,8 @@ void L07Action::updateBound()
     if (m_rate < 0)
       lmm_update_variable_bound(ptask_maxmin_system, getVariable(), lat_bound);
     else
     if (m_rate < 0)
       lmm_update_variable_bound(ptask_maxmin_system, getVariable(), lat_bound);
     else
-      lmm_update_variable_bound(ptask_maxmin_system, getVariable(), min(m_rate, lat_bound));
+      lmm_update_variable_bound(ptask_maxmin_system, getVariable(),
+        std::min(m_rate, lat_bound));
   }
 }
 
   }
 }
 
index 40d0fa5..60454c9 100644 (file)
@@ -4,6 +4,10 @@
 /* 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. */
 
 /* 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 <cstdlib>
+
+#include <vector>
+
 #include <xbt/base.h>
 
 #include "host_interface.hpp"
 #include <xbt/base.h>
 
 #include "host_interface.hpp"
@@ -170,7 +174,7 @@ public:
   void setPriority(double priority);
   double getRemains();
 
   void setPriority(double priority);
   double getRemains();
 
-  vector<RoutingEdge*> * p_edgeList = new vector<RoutingEdge*>();
+  std::vector<RoutingEdge*> * p_edgeList = new std::vector<RoutingEdge*>();
   double *p_computationAmount;
   double *p_communicationAmount;
   double m_latency;
   double *p_computationAmount;
   double *p_communicationAmount;
   double m_latency;
index ff820b2..50fb7be 100644 (file)
@@ -4,6 +4,8 @@
 /* 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. */
 
 /* 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 "network_cm02.hpp"
 #include "maxmin_private.hpp"
 #include "simgrid/sg_config.h"
 #include "network_cm02.hpp"
 #include "maxmin_private.hpp"
 #include "simgrid/sg_config.h"
@@ -406,7 +408,7 @@ Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst,
        link = static_cast<NetworkCm02Link*>(_link);
     double bb = bandwidthFactor(size) * link->getBandwidth();
     bandwidth_bound =
        link = static_cast<NetworkCm02Link*>(_link);
     double bb = bandwidthFactor(size) * link->getBandwidth();
     bandwidth_bound =
-        (bandwidth_bound < 0.0) ? bb : min(bandwidth_bound, bb);
+        (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb);
   }
 
   action->m_latCurrent = action->m_latency;
   }
 
   action->m_latCurrent = action->m_latency;
@@ -442,7 +444,7 @@ Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst,
   if (action->m_rate < 0) {
     lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? sg_tcp_gamma / (2.0 * action->m_latCurrent) : -1.0);
   } else {
   if (action->m_rate < 0) {
     lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? sg_tcp_gamma / (2.0 * action->m_latCurrent) : -1.0);
   } else {
-    lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)) : action->m_rate);
+    lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? std::min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)) : action->m_rate);
   }
 
   xbt_dynar_foreach(route, i, _link) {
   }
 
   xbt_dynar_foreach(route, i, _link) {
@@ -640,7 +642,7 @@ void NetworkCm02Link::updateLatency(double value, double date){
       lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->m_latCurrent));
     else {
       lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
       lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->m_latCurrent));
     else {
       lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
-                                min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)));
+                                std::min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)));
 
       if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) {
         XBT_INFO("Flow is limited BYBANDWIDTH");
 
       if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) {
         XBT_INFO("Flow is limited BYBANDWIDTH");
index 98ee6c5..4e51c2b 100644 (file)
@@ -4,6 +4,9 @@
 /* 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. */
 
 /* 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"
 #include "simgrid/sg_config.h"
 #include "maxmin_private.hpp"
 #include "network_ib.hpp"
 #include "simgrid/sg_config.h"
 #include "maxmin_private.hpp"
@@ -53,7 +56,7 @@ static void IB_action_init_callback(NetworkAction *action,RoutingEdge *src, Rout
     xbt_die("could not find dst node active comms !");  
  // act_dst->rate=rate;
   
     xbt_die("could not find dst node active comms !");  
  // act_dst->rate=rate;
   
-  ((NetworkIBModel*)surf_network_model)->active_comms[action]=make_pair(act_src, act_dst);
+  ((NetworkIBModel*)surf_network_model)->active_comms[action]=std::make_pair(act_src, act_dst);
   //post the action in the second dist, to retrieve in the other callback
   XBT_DEBUG("IB callback - action %p init", action);
 
   //post the action in the second dist, to retrieve in the other callback
   XBT_DEBUG("IB callback - action %p init", action);
 
@@ -136,7 +139,7 @@ void NetworkIBModel::computeIBfactors(IBNode *root) {
        my_penalty_out = num_comm_out * Bs;
     }
 
        my_penalty_out = num_comm_out * Bs;
     }
 
-    max_penalty_out = max(max_penalty_out,my_penalty_out);
+    max_penalty_out = std::max(max_penalty_out,my_penalty_out);
   }
 
   for (std::vector<ActiveComm*>::iterator it= root->ActiveCommsUp.begin(); it != root->ActiveCommsUp.end(); ++it) {
   }
 
   for (std::vector<ActiveComm*>::iterator it= root->ActiveCommsUp.begin(); it != root->ActiveCommsUp.end(); ++it) {
@@ -149,7 +152,7 @@ void NetworkIBModel::computeIBfactors(IBNode *root) {
                      * Be 
                      * (*it)->destination->ActiveCommsDown.size();//number of different nodes sending to dest
     
                      * Be 
                      * (*it)->destination->ActiveCommsDown.size();//number of different nodes sending to dest
     
-    double penalty=max(my_penalty_in,max_penalty_out);
+    double penalty = std::max(my_penalty_in,max_penalty_out);
     
     double rate_before_update = (*it)->action->getBound();
     //save initial rate of the action
     
     double rate_before_update = (*it)->action->getBound();
     //save initial rate of the action
index 15df730..b64761a 100644 (file)
@@ -4,6 +4,8 @@
 /* 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. */
 
 /* 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 "network_interface.hpp"
 #include "simgrid/sg_config.h"
 
 #include "network_interface.hpp"
 #include "simgrid/sg_config.h"
 
@@ -164,7 +166,7 @@ double NetworkModel::shareResourcesFull(double now)
     }
 #endif
     if (action->m_latency > 0) {
     }
 #endif
     if (action->m_latency > 0) {
-      minRes = (minRes < 0) ? action->m_latency : min(minRes, action->m_latency);
+      minRes = (minRes < 0) ? action->m_latency : std::min(minRes, action->m_latency);
     }
   }
 
     }
   }
 
index 045ccc5..c30c13f 100644 (file)
@@ -4,6 +4,12 @@
 /* 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. */
 
 /* 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 <cstddef>
+
+#include <algorithm>
+
+#include <xbt/log.h>
+
 #include "network_smpi.hpp"
 #include "simgrid/sg_config.h"
 
 #include "network_smpi.hpp"
 #include "simgrid/sg_config.h"
 
@@ -208,7 +214,7 @@ double NetworkSmpiModel::latencyFactor(double size)
 
 double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double size)
 {
 
 double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double size)
 {
-  return rate < 0 ? bound : min(bound, rate * bandwidthFactor(size));
+  return rate < 0 ? bound : std::min(bound, rate * bandwidthFactor(size));
 }
 
 /************
 }
 
 /************
index 04f324a..740c7e1 100644 (file)
@@ -9,6 +9,8 @@
 
 #ifdef __cplusplus
 
 
 #ifdef __cplusplus
 
+#include <cstdint>
+
 #include "ns3/core-module.h"
 #include "my-point-to-point-helper.h"
 
 #include "ns3/core-module.h"
 #include "my-point-to-point-helper.h"
 
 #include "ns3/inet-socket-address.h"
 #include "ns3/tcp-socket-factory.h"
 
 #include "ns3/inet-socket-address.h"
 #include "ns3/tcp-socket-factory.h"
 
-using namespace ns3;
-using namespace std;
-
 struct MySocket{
 struct MySocket{
-  uint32_t bufferedBytes;
-  uint32_t sentBytes;
-  uint32_t remaining;
-  uint32_t totalBytes;
+  std::uint32_t bufferedBytes;
+  std::uint32_t sentBytes;
+  std::uint32_t remaining;
+  std::uint32_t totalBytes;
   char finished;
   void* action;
 };
   char finished;
   void* action;
 };
@@ -42,12 +41,12 @@ private:
 public:
   NS3Sim();
   ~NS3Sim();
 public:
   NS3Sim();
   ~NS3Sim();
-  void create_flow_NS3(Ptr<Node> src,
-            Ptr<Node> dst,
-            uint16_t port_number,
+  void create_flow_NS3(ns3::Ptr<ns3::Node> src,
+            ns3::Ptr<ns3::Node> dst,
+            std::uint16_t port_number,
             double start,
             const char *addr,
             double start,
             const char *addr,
-            uint32_t TotalBytes,
+            std::uint32_t TotalBytes,
             void * action);
   void simulator_start(double min);
   void* get_action_from_socket(void *socket);
             void * action);
   void simulator_start(double min);
   void* get_action_from_socket(void *socket);
index 1d5611f..213e6d4 100644 (file)
@@ -75,8 +75,6 @@ namespace surf {
 extern XBT_PRIVATE tmgr_history_t history;
 #define NO_MAX_DURATION -1.0
 
 extern XBT_PRIVATE tmgr_history_t history;
 #define NO_MAX_DURATION -1.0
 
-using namespace std;
-
 /*********
  * Utils *
  *********/
 /*********
  * Utils *
  *********/
index 6527e15..e7f1c66 100644 (file)
@@ -1,3 +1,11 @@
+#include <cstdlib>
+
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
+#include <iostream>
+
 #include "surf_routing_cluster_fat_tree.hpp"
 #include "xbt/lib.h"
 
 #include "surf_routing_cluster_fat_tree.hpp"
 #include "xbt/lib.h"
 
@@ -407,8 +415,8 @@ void AsClusterFatTree::addLink(FatTreeNode *parent, unsigned int parentPort,
 
 void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t 
                                                 cluster) {
 
 void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t 
                                                 cluster) {
-  std::vector<string> parameters;
-  std::vector<string> tmp;
+  std::vector<std::string> parameters;
+  std::vector<std::string> tmp;
   boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
  
 
   boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
  
 
@@ -455,12 +463,12 @@ void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t
 }
 
 
 }
 
 
-void AsClusterFatTree::generateDotFile(const string& filename) const {
-  ofstream file;
+void AsClusterFatTree::generateDotFile(const std::string& filename) const {
+  std::ofstream file;
   /* Maybe should we get directly a char*, as open takes strings only beginning
    * with C++11...
    */
   /* Maybe should we get directly a char*, as open takes strings only beginning
    * with C++11...
    */
-  file.open(filename.c_str(), ios::out | ios::trunc); 
+  file.open(filename.c_str(), std::ios::out | std::ios::trunc); 
   
   if(file.is_open()) {
     file << "graph AsClusterFatTree {\n";
   
   if(file.is_open()) {
     file << "graph AsClusterFatTree {\n";
index 91a2c46..78cbfae 100644 (file)
@@ -7,6 +7,10 @@
 #ifndef SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
 #define SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
 
 #ifndef SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
 #define SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
 
+#include <string>
+#include <map>
+#include <vector>
+
 #include <xbt/base.h>
 
 #include "surf_routing_cluster.hpp"
 #include <xbt/base.h>
 
 #include "surf_routing_cluster.hpp"
@@ -132,7 +136,7 @@ public:
   /** \brief Add a processing node.
    */
   void addProcessingNode(int id);
   /** \brief Add a processing node.
    */
   void addProcessingNode(int id);
-  void generateDotFile(const string& filename = "fatTree.dot") const;
+  void generateDotFile(const std::string& filename = "fatTree.dot") const;
 
 private:
   
 
 private:
   
index febb60a..fc14c8f 100644 (file)
@@ -4,11 +4,20 @@
 /* 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. */
 
 /* 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 <cstdlib>
+
+#include <algorithm>
+
+#include <xbt/dict.h>
+#include <xbt/log.h>
+#include <xbt/sysdep.h>
+#include <xbt/dynar.h>
+#include <xbt/graph.h>
+
 #include "simgrid/platf_interface.h"    // platform creation API internal interface
 
 #include "surf_routing_generic.hpp"
 #include "network_interface.hpp"
 #include "simgrid/platf_interface.h"    // platform creation API internal interface
 
 #include "surf_routing_generic.hpp"
 #include "network_interface.hpp"
-#include "xbt/graph.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
@@ -271,7 +280,7 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdge *src,
     int max_index_src = path_src->used - 1;
     int max_index_dst = path_dst->used - 1;
 
     int max_index_src = path_src->used - 1;
     int max_index_dst = path_dst->used - 1;
 
-    int max_index = max(max_index_src, max_index_dst);
+    int max_index = std::max(max_index_src, max_index_dst);
     int i, max;
 
     for (max = 0; max <= max_index; max++) {
     int i, max;
 
     for (max = 0; max <= max_index; max++) {
index 7d7373e..09eefdd 100644 (file)
@@ -4,6 +4,8 @@
 /* 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. */
 
 /* 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 "cpu_cas01.hpp"
 #include "vm_hl13.hpp"
 
 #include "cpu_cas01.hpp"
 #include "vm_hl13.hpp"
 
@@ -110,7 +112,7 @@ double VMHL13Model::shareResources(double now)
                typeid(surf_network_model).name(), min_by_net,
             typeid(surf_storage_model).name(), min_by_sto);
 
                typeid(surf_network_model).name(), min_by_net,
             typeid(surf_storage_model).name(), min_by_sto);
 
-  double ret = max(max(min_by_cpu, min_by_net), min_by_sto);
+  double ret = std::max(std::max(min_by_cpu, min_by_net), min_by_sto);
   if (min_by_cpu >= 0.0 && min_by_cpu < ret)
        ret = min_by_cpu;
   if (min_by_net >= 0.0 && min_by_net < ret)
   if (min_by_cpu >= 0.0 && min_by_cpu < ret)
        ret = min_by_cpu;
   if (min_by_net >= 0.0 && min_by_net < ret)