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

Private GIT Repository
58024265d8b0ac06fb43755966f0eaff02d814f2
[loba.git] / process.h
1 #ifndef PROCESS_H
2 #define PROCESS_H
3
4 #define USE_UNORDERED_MAP 1
5 //#undef USE_UNORDERED_MAP
6
7 #include <vector>
8 #ifdef USE_UNORDERED_MAP
9 #  include <tr1/unordered_map>
10 #  define MAP_TEMPLATE std::tr1::unordered_map
11 #else
12 #  include <map>
13 #  define MAP_TEMPLATE std::map
14 #endif
15 #include <msg/msg.h>
16 #include "communicator.h"
17 #include "neighbor.h"
18
19 class process {
20 public:
21     process(int argc, char* argv[]);
22     ~process();
23     int run();
24
25 private:
26     std::vector<neighbor> neigh;
27     MAP_TEMPLATE<m_host_t, neighbor*> rev_neigh;
28     std::vector<neighbor*> pneigh;
29
30     communicator comm;
31     int ctrl_close_pending;
32     int data_close_pending;
33
34     unsigned iter;
35
36     double load;
37     double expected_load;
38
39     void compute();
40     virtual double load_balance(double my_load);
41     void send1_no_bookkeeping(neighbor& nb);
42     void send1_bookkeeping(neighbor& nb);
43     void send();
44     bool receive(bool wait_for_close);
45     void finalize1(neighbor& nb);
46     void finalize();
47     void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info);
48
49     void insert_neighbor_in_map(neighbor& nb);
50 };
51
52 #endif // !PROCESS_H
53
54 // Local variables:
55 // mode: c++
56 // End: