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

Private GIT Repository
Terminate smoothly on CTRL-C.
[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 deploy();
21
22 private:
23     struct host_parameters {
24         host_parameters(): load(0.0) { }
25
26         double load;
27         std::vector<int> neighbors;
28     };
29
30     std::vector<host_parameters> hosts;
31 };
32
33 #define DEPLOYMENT(name)                                        \
34     class deployment_ ## name: public deployment_generator {    \
35     public: void generate();                                    \
36     }
37
38 DEPLOYMENT(btree);
39 DEPLOYMENT(clique);
40 DEPLOYMENT(hcube);
41 DEPLOYMENT(line);
42 DEPLOYMENT(ring);
43 DEPLOYMENT(star);
44 DEPLOYMENT(torus);
45
46 #undef DEPLOYMENT
47
48 #endif // !DEPLOYMENT_H
49
50 // Local variables:
51 // mode: c++
52 // End: