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

Private GIT Repository
Consolidate helper functions from options.cpp in one block.
[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         double load;
25         std::vector<int> neighbors;
26     };
27
28     std::vector<host_parameters> hosts;
29 };
30
31 #define DEPLOYMENT(name)                                        \
32     class deployment_ ## name: public deployment_generator {    \
33     public: void generate();                                    \
34     }
35
36 DEPLOYMENT(btree);
37 DEPLOYMENT(clique);
38 DEPLOYMENT(hcube);
39 DEPLOYMENT(line);
40 DEPLOYMENT(ring);
41 DEPLOYMENT(star);
42 DEPLOYMENT(torus);
43
44 #undef DEPLOYMENT
45
46 #endif // !DEPLOYMENT_H
47
48 // Local variables:
49 // mode: c++
50 // End: