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

Private GIT Repository
Set -g1000 in ag_parameters.
[loba.git] / deployment.h
1 #ifndef DEPLOYMENT_H
2 #define DEPLOYMENT_H
3
4 #include <vector>
5
6 // Deploy an application automatically, according to the global parameters
7 void MY_launch_application();
8
9 // Base class for deployment generators...
10 class deployment_generator {
11 public:
12     deployment_generator();
13
14     size_t size() const { return hosts.size(); }
15     void set_load(int host, double load);
16     void set_neighbor(int host, int neighbor);
17     void set_link(int host1, int host2);
18
19     virtual void generate() = 0;
20     void distribute_load();
21     void deploy();
22
23 private:
24     struct host_parameters {
25         host_parameters(): load(0.0) { }
26
27         double load;
28         std::vector<int> neighbors;
29     };
30
31     std::vector<host_parameters> hosts;
32 };
33
34 #define DEPLOYMENT(name)                                        \
35     class deployment_ ## name: public deployment_generator {    \
36     public: void generate();                                    \
37     }
38
39 DEPLOYMENT(btree);
40 DEPLOYMENT(clique);
41 DEPLOYMENT(hcube);
42 DEPLOYMENT(line);
43 DEPLOYMENT(ring);
44 DEPLOYMENT(star);
45 DEPLOYMENT(torus);
46
47 #undef DEPLOYMENT
48
49 #endif // !DEPLOYMENT_H
50
51 // Local variables:
52 // mode: c++
53 // End: