From: Arnaud Giersch Date: Tue, 15 Feb 2011 10:15:27 +0000 (+0100) Subject: Cosmetics: move around some code. X-Git-Tag: v0.1~127 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/de9d56dddba96f345ba109a8cdb0a2986cd59292?ds=sidebyside Cosmetics: move around some code. --- diff --git a/process.cpp b/process.cpp index c104ecd..470ad41 100644 --- a/process.cpp +++ b/process.cpp @@ -265,32 +265,6 @@ void process::send(neighbor& nb, double amount) nb.set_load(nb.get_load() + amount); } -#define print_loads_generic(vec, verbose, logp, cat) \ - if (_XBT_LOG_ISENABLEDV((*cat), logp)) { \ - using std::tr1::bind; \ - using std::tr1::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(), \ - bind(&neighbor::print, _1, verbose, logp, cat)); \ - } else ((void)0) - -void process::print_loads(bool verbose, - e_xbt_log_priority_t logp, - xbt_log_category_t cat) const -{ - print_loads_generic(neigh, verbose, logp, cat); -} - -void process::print_loads_p(bool verbose, - e_xbt_log_priority_t logp, - xbt_log_category_t cat) const -{ - print_loads_generic(pneigh, verbose, logp, cat); -} - -#undef print_loads_generic - void process::ctrl_send(neighbor& nb) { double info_to_send = get_load(); @@ -395,6 +369,32 @@ void process::handle_message(message* msg, m_host_t from) delete msg; } +#define print_loads_generic(vec, verbose, logp, cat) \ + if (_XBT_LOG_ISENABLEDV((*cat), logp)) { \ + using std::tr1::bind; \ + using std::tr1::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(), \ + bind(&neighbor::print, _1, verbose, logp, cat)); \ + } else ((void)0) + +void process::print_loads(bool verbose, + e_xbt_log_priority_t logp, + xbt_log_category_t cat) const +{ + print_loads_generic(neigh, verbose, logp, cat); +} + +void process::print_loads_p(bool verbose, + e_xbt_log_priority_t logp, + xbt_log_category_t cat) const +{ + print_loads_generic(pneigh, verbose, logp, cat); +} + +#undef print_loads_generic + // Local variables: // mode: c++ // End: