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

Private GIT Repository
Use new defined variadic logging macros.
[loba.git] / neighbor.cpp
1 #include <limits>
2 #include <msg/msg.h>
3
4 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(proc); // needed to compile neighbor.h
5
6 #include "misc.h"
7
8 #include "neighbor.h"
9
10 neighbor::neighbor(const char* hostname)
11     : host(static_cast<hostdata*>(MSG_host_get_data(MSG_get_host_by_name(hostname))))
12     , load(std::numeric_limits<double>::infinity())
13     , debt(0.0)
14     , to_send(0.0)
15 {
16 }
17
18 neighbor::~neighbor()
19 {
20 }
21
22 void neighbor::print(bool verbose,
23                      e_xbt_log_priority_t logp, xbt_log_category_t cat) const
24 {
25     if (verbose)
26         XBT_XCLOG(cat, logp, "%s: load = %g ; debt = %g ; to_send = %g",
27                   get_name(), get_load(), get_debt(), get_to_send());
28     else
29         XBT_XCLOG(cat, logp, "%s: load = %g", get_name(), get_load());
30 }