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

Private GIT Repository
Wip++...
[loba.git] / process.h
index ea350038a168e92199ac5bb35ea90952596184a5..58024265d8b0ac06fb43755966f0eaff02d814f2 100644 (file)
--- a/process.h
+++ b/process.h
@@ -1,22 +1,52 @@
 #ifndef PROCESS_H
 #define PROCESS_H
 
+#define USE_UNORDERED_MAP 1
+//#undef USE_UNORDERED_MAP
+
 #include <vector>
-#include <xbt/log.h>
+#ifdef USE_UNORDERED_MAP
+#  include <tr1/unordered_map>
+#  define MAP_TEMPLATE std::tr1::unordered_map
+#else
+#  include <map>
+#  define MAP_TEMPLATE std::map
+#endif
+#include <msg/msg.h>
 #include "communicator.h"
 #include "neighbor.h"
 
 class process {
 public:
-    process(int argc, char *argv[]);
-    ~process() { };
-    void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info);
+    process(int argc, char* argv[]);
+    ~process();
     int run();
 
 private:
-    communicator comm;
     std::vector<neighbor> neigh;
+    MAP_TEMPLATE<m_host_t, neighbor*> rev_neigh;
+    std::vector<neighbor*> pneigh;
+
+    communicator comm;
+    int ctrl_close_pending;
+    int data_close_pending;
+
+    unsigned iter;
+
     double load;
+    double expected_load;
+
+    void compute();
+    virtual double load_balance(double my_load);
+    void send1_no_bookkeeping(neighbor& nb);
+    void send1_bookkeeping(neighbor& nb);
+    void send();
+    bool receive(bool wait_for_close);
+    void finalize1(neighbor& nb);
+    void finalize();
+    void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info);
+
+    void insert_neighbor_in_map(neighbor& nb);
 };
 
 #endif // !PROCESS_H