]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
It is useless to mention "tr1", now that compilation is done with -std=c++0x.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 23 May 2011 06:44:37 +0000 (08:44 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 23 May 2011 12:59:01 +0000 (14:59 +0200)
communicator.cpp
cost_func.cpp
deployment.cpp
hostdata.cpp
process.cpp
process.h

index 867d19eb36f1575345569c04fb772e8986be085b..e6a47b4a81e3d7e7ec9662e753982931fb5674e2 100644 (file)
@@ -1,5 +1,5 @@
 #include <algorithm>
 #include <algorithm>
-#include <tr1/functional>
+#include <functional>
 #include <msg/msg.h>
 #include <xbt/log.h>
 
 #include <msg/msg.h>
 #include <xbt/log.h>
 
@@ -24,9 +24,8 @@ namespace {
 communicator::communicator()
     : host(static_cast<hostdata*>(MSG_host_get_data(MSG_host_self())))
 {
 communicator::communicator()
     : host(static_cast<hostdata*>(MSG_host_get_data(MSG_host_self())))
 {
-    using std::tr1::bind;
     receiver_thread = new_msg_thread("receiver",
     receiver_thread = new_msg_thread("receiver",
-                                     bind(&communicator::receiver, this));
+                                     std::bind(&communicator::receiver, this));
     receiver_thread->start();
 }
 
     receiver_thread->start();
 }
 
index 12c20f6a2cd88824de1645f4c7650f4f6488c6a9..d6cba8c88ed667484b1f6af6ce0b95a3ec9244da 100644 (file)
@@ -1,5 +1,5 @@
 #include <algorithm>
 #include <algorithm>
-#include <tr1/functional>
+#include <functional>
 #include <numeric>
 #include <iterator>
 #include <sstream>
 #include <numeric>
 #include <iterator>
 #include <sstream>
@@ -30,13 +30,12 @@ cost_func::~cost_func()
 
 double cost_func::operator()(double amount) const
 {
 
 double cost_func::operator()(double amount) const
 {
-    using std::tr1::bind;
-    using std::tr1::placeholders::_1;
-    using std::tr1::placeholders::_2;
+    using std::placeholders::_1;
+    using std::placeholders::_2;
     return std::accumulate(++factors.begin(), factors.end(), factors.front(),
     return std::accumulate(++factors.begin(), factors.end(), factors.front(),
-                           bind(std::plus<double>(),
-                                bind(std::multiplies<double>(), amount, _1),
-                                _2));
+                           std::bind(std::plus<double>(),
+                                     std::bind(std::multiplies<double>(),
+                                               amount, _1), _2));
 }
 
 std::string cost_func::to_string()
 }
 
 std::string cost_func::to_string()
index 705c1ea859539b528810cad95040ac55c9789ca2..8f52806bb15fc591f28b6c5c6215466fb4770627 100644 (file)
@@ -1,6 +1,6 @@
 #include <algorithm>
 #include <cstdlib>
 #include <algorithm>
 #include <cstdlib>
-#include <tr1/functional>
+#include <functional>
 #include <iomanip>
 #include <numeric>
 #include <sstream>
 #include <iomanip>
 #include <numeric>
 #include <sstream>
@@ -50,8 +50,7 @@ void deployment_generator::set_link(int host1, int host2)
 
 void deployment_generator::distribute_load()
 {
 
 void deployment_generator::distribute_load()
 {
-    using std::tr1::bind;
-    using std::tr1::placeholders::_1;
+    using std::placeholders::_1;
 
     if (!opt::auto_depl::random_distribution) {
         set_load(0, opt::auto_depl::load);
 
     if (!opt::auto_depl::random_distribution) {
         set_load(0, opt::auto_depl::load);
@@ -63,7 +62,7 @@ void deployment_generator::distribute_load()
     double factor = opt::auto_depl::load /
         std::accumulate(loads.begin(), loads.end(), 0.0);
     std::transform(loads.begin(), loads.end(), loads.begin(),
     double factor = opt::auto_depl::load /
         std::accumulate(loads.begin(), loads.end(), 0.0);
     std::transform(loads.begin(), loads.end(), loads.begin(),
-                   bind(std::multiplies<double>(), _1, factor));
+                   std::bind(std::multiplies<double>(), _1, factor));
     for (unsigned i = 0 ; i < hosts.size() ; ++i)
         set_load(i, loads[i]);
 }
     for (unsigned i = 0 ; i < hosts.size() ; ++i)
         set_load(i, loads[i]);
 }
index 17d7a0816a3ae62603637e4935ecfd3d2ddcf09d..ee8fadce107447fa32c0a3e7da307130ac89758f 100644 (file)
@@ -1,6 +1,6 @@
 #include <algorithm>
 #include <cstring>
 #include <algorithm>
 #include <cstring>
-#include <tr1/functional>
+#include <functional>
 #include <stdexcept>
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
 #include <stdexcept>
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
@@ -16,18 +16,18 @@ std::vector<hostdata> hostdata::hosts;
 
 void hostdata::create()
 {
 
 void hostdata::create()
 {
-    using std::tr1::bind;
-    using std::tr1::placeholders::_1;
-    using std::tr1::placeholders::_2;
+    using std::placeholders::_1;
+    using std::placeholders::_2;
 
     int nhosts = MSG_get_host_number();
     m_host_t* host_list = MSG_get_host_table();
     // only sort hosts for automatically created deployment
     if (opt::auto_depl::enabled)
         std::sort(host_list, host_list + nhosts,
 
     int nhosts = MSG_get_host_number();
     m_host_t* host_list = MSG_get_host_table();
     // only sort hosts for automatically created deployment
     if (opt::auto_depl::enabled)
         std::sort(host_list, host_list + nhosts,
-                  bind(std::less<int>(), bind(strcmp,
-                                              bind(MSG_host_get_name, _1),
-                                              bind(MSG_host_get_name, _2)), 0));
+                  std::bind(std::less<int>(),
+                            std::bind(strcmp,
+                                      std::bind(MSG_host_get_name, _1),
+                                      std::bind(MSG_host_get_name, _2)), 0));
     hosts.assign(host_list, host_list + nhosts);
     xbt_free(host_list);
 
     hosts.assign(host_list, host_list + nhosts);
     xbt_free(host_list);
 
index 54fea8aeb2ed8534d4561715b9595b0950c967ef..b36b000f385309ee102c283c7139244d4c3e8a26 100644 (file)
@@ -1,5 +1,5 @@
 #include <algorithm>
 #include <algorithm>
-#include <tr1/functional>
+#include <functional>
 #include <iterator>
 #include <numeric>
 #include <stdexcept>
 #include <iterator>
 #include <numeric>
 #include <stdexcept>
@@ -58,8 +58,7 @@ process::process(int argc, char* argv[])
     comp_iter = lb_iter = 0;
 
     lb_thread = new_msg_thread("loba",
     comp_iter = lb_iter = 0;
 
     lb_thread = new_msg_thread("loba",
-                               std::tr1::bind(&process::load_balance_loop,
-                                              this));
+                               std::bind(&process::load_balance_loop, this));
 
     e_xbt_log_priority_t logp = xbt_log_priority_verbose;
     if (!LOG_ISENABLED(logp))
 
     e_xbt_log_priority_t logp = xbt_log_priority_verbose;
     if (!LOG_ISENABLED(logp))
@@ -70,7 +69,7 @@ process::process(int argc, char* argv[])
         oss << ESSE(neigh.size()) << ": ";
         std::transform(neigh.begin(), neigh.end() - 1,
                        std::ostream_iterator<const char*>(oss, ", "),
         oss << ESSE(neigh.size()) << ": ";
         std::transform(neigh.begin(), neigh.end() - 1,
                        std::ostream_iterator<const char*>(oss, ", "),
-                       std::tr1::mem_fn(&neighbor::get_name));
+                       std::mem_fn(&neighbor::get_name));
         oss << neigh.back().get_name();
     }
     XBT_LOG(logp, "Got %s.", oss.str().c_str());
         oss << neigh.back().get_name();
     }
     XBT_LOG(logp, "Got %s.", oss.str().c_str());
@@ -112,8 +111,7 @@ int process::run()
 
 void process::load_balance_loop()
 {
 
 void process::load_balance_loop()
 {
-    using std::tr1::bind;
-    using std::tr1::placeholders::_1;
+    using std::placeholders::_1;
 
     double next_iter_after_date = MSG_get_clock() + opt::min_lb_iter_duration;
     while (still_running()) {
 
     double next_iter_after_date = MSG_get_clock() + opt::min_lb_iter_duration;
     while (still_running()) {
@@ -144,7 +142,7 @@ void process::load_balance_loop()
         // send
         comm.ctrl_flush(false);
         std::for_each(neigh.begin(), neigh.end(),
         // send
         comm.ctrl_flush(false);
         std::for_each(neigh.begin(), neigh.end(),
-                      bind(&process::ctrl_send, this, _1));
+                      std::bind(&process::ctrl_send, this, _1));
         prev_load_broadcast = expected_load;
         mutex.release();
 
         prev_load_broadcast = expected_load;
         mutex.release();
 
@@ -156,7 +154,7 @@ void process::load_balance_loop()
     XBT_DEBUG("send CTRL_CLOSE to %zu neighbor%s",
               neigh.size(), ESSE(neigh.size()));
     std::for_each(neigh.begin(), neigh.end(),
     XBT_DEBUG("send CTRL_CLOSE to %zu neighbor%s",
               neigh.size(), ESSE(neigh.size()));
     std::for_each(neigh.begin(), neigh.end(),
-                  bind(&process::ctrl_close, this, _1));
+                  std::bind(&process::ctrl_close, this, _1));
     while (ctrl_close_pending) {
         comm.ctrl_flush(false);
         XBT_DEBUG("waiting for %d CTRL CLOSE", ctrl_close_pending);
     while (ctrl_close_pending) {
         comm.ctrl_flush(false);
         XBT_DEBUG("waiting for %d CTRL CLOSE", ctrl_close_pending);
@@ -167,8 +165,7 @@ void process::load_balance_loop()
 
 void process::compute_loop()
 {
 
 void process::compute_loop()
 {
-    using std::tr1::bind;
-    using std::tr1::placeholders::_1;
+    using std::placeholders::_1;
 
     double next_iter_after_date = MSG_get_clock() + opt::min_comp_iter_duration;
     while (still_running()) {
 
     double next_iter_after_date = MSG_get_clock() + opt::min_comp_iter_duration;
     while (still_running()) {
@@ -184,7 +181,7 @@ void process::compute_loop()
         comm.data_flush(false);
         mutex.acquire();
         std::for_each(neigh.begin(), neigh.end(),
         comm.data_flush(false);
         mutex.acquire();
         std::for_each(neigh.begin(), neigh.end(),
-                      bind(&process::data_send, this, _1));
+                      std::bind(&process::data_send, this, _1));
         mutex.release();
 
         if (real_load == 0.0)
         mutex.release();
 
         if (real_load == 0.0)
@@ -206,13 +203,13 @@ void process::compute_loop()
     XBT_VERB("Going to finalize for %s...", __func__);
     // last send, for not losing load scheduled to be sent
     std::for_each(neigh.begin(), neigh.end(),
     XBT_VERB("Going to finalize for %s...", __func__);
     // last send, for not losing load scheduled to be sent
     std::for_each(neigh.begin(), neigh.end(),
-                  bind(&process::data_send, this, _1));
+                  std::bind(&process::data_send, this, _1));
     finalizing = true;
     total_load_running -= real_load;
     XBT_DEBUG("send DATA_CLOSE to %zu neighbor%s",
               neigh.size(), ESSE(neigh.size()));
     std::for_each(neigh.begin(), neigh.end(),
     finalizing = true;
     total_load_running -= real_load;
     XBT_DEBUG("send DATA_CLOSE to %zu neighbor%s",
               neigh.size(), ESSE(neigh.size()));
     std::for_each(neigh.begin(), neigh.end(),
-                  bind(&process::data_close, this, _1));
+                  std::bind(&process::data_close, this, _1));
     while (data_close_pending) {
         comm.data_flush(false);
         XBT_DEBUG("waiting for %d DATA CLOSE", data_close_pending);
     while (data_close_pending) {
         comm.data_flush(false);
         XBT_DEBUG("waiting for %d DATA CLOSE", data_close_pending);
@@ -265,13 +262,12 @@ bool process::still_running()
 
 double process::get_sum_of_to_send() const
 {
 
 double process::get_sum_of_to_send() const
 {
-    using std::tr1::bind;
-    using std::tr1::placeholders::_1;
-    using std::tr1::placeholders::_2;
+    using std::placeholders::_1;
+    using std::placeholders::_2;
 
     return std::accumulate(neigh.begin(), neigh.end(), 0.0,
 
     return std::accumulate(neigh.begin(), neigh.end(), 0.0,
-                           bind(std::plus<double>(),
-                                _1, bind(&neighbor::get_to_send, _2)));
+                           std::bind(std::plus<double>(), _1,
+                                     std::bind(&neighbor::get_to_send, _2)));
 }
 
 void process::load_balance()
 }
 
 void process::load_balance()
@@ -410,12 +406,11 @@ void process::handle_message(message* msg, m_host_t from)
 
 #define print_loads_generic(vec, verbose, logp, cat)                    \
     if (_XBT_LOG_ISENABLEDV((*cat), logp)) {                            \
 
 #define print_loads_generic(vec, verbose, logp, cat)                    \
     if (_XBT_LOG_ISENABLEDV((*cat), logp)) {                            \
-        using std::tr1::bind;                                           \
-        using std::tr1::placeholders::_1;                               \
+        using std::placeholders::_1;                                    \
         XBT_XCLOG(cat, logp, "My load: %g (real); %g (expected).  "     \
                   "Neighbor loads:", real_load, expected_load);         \
         std::for_each(vec.begin(), vec.end(),                           \
         XBT_XCLOG(cat, logp, "My load: %g (real); %g (expected).  "     \
                   "Neighbor loads:", real_load, expected_load);         \
         std::for_each(vec.begin(), vec.end(),                           \
-                      bind(&neighbor::print, _1, verbose, logp, cat));  \
+                      std::bind(&neighbor::print, _1, verbose, logp, cat)); \
     } else ((void)0)
 
 void process::print_loads(bool verbose,
     } else ((void)0)
 
 void process::print_loads(bool verbose,
index ed6e6cf6fbedffc1ab96657aadda320828ca0a2a..4686af4a3f75f358f00769050546ccaa82e0cdbc 100644 (file)
--- a/process.h
+++ b/process.h
@@ -5,10 +5,10 @@
 //#undef USE_UNORDERED_MAP
 
 #include <algorithm>
 //#undef USE_UNORDERED_MAP
 
 #include <algorithm>
-#include <tr1/functional>
+#include <functional>
 #ifdef USE_UNORDERED_MAP
 #ifdef USE_UNORDERED_MAP
-#  include <tr1/unordered_map>
-#  define MAP_TEMPLATE std::tr1::unordered_map
+#  include <unordered_map>
+#  define MAP_TEMPLATE std::unordered_map
 #else
 #  include <map>
 #  define MAP_TEMPLATE std::map
 #else
 #  include <map>
 #  define MAP_TEMPLATE std::map
@@ -169,13 +169,12 @@ private:
 template <typename Compare>
 void process::pneigh_sort_by_load(const Compare& comp)
 {
 template <typename Compare>
 void process::pneigh_sort_by_load(const Compare& comp)
 {
-    using std::tr1::bind;
-    using std::tr1::placeholders::_1;
-    using std::tr1::placeholders::_2;
+    using std::placeholders::_1;
+    using std::placeholders::_2;
     std::sort(pneigh.begin(), pneigh.end(),
     std::sort(pneigh.begin(), pneigh.end(),
-              bind(comp,
-                   bind(&neighbor::get_load, _1),
-                   bind(&neighbor::get_load, _2)));
+              std::bind(comp,
+                        std::bind(&neighbor::get_load, _1),
+                        std::bind(&neighbor::get_load, _2)));
 }
 
 #endif // !PROCESS_H
 }
 
 #endif // !PROCESS_H