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

Private GIT Repository
Add copyright, and license files.
[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     virtual ~deployment_generator() { }
14
15     size_t size() const { return hosts.size(); }
16     void set_load(int host, double load);
17     void set_neighbor(int host, int neighbor);
18     void set_link(int host1, int host2);
19
20     virtual void generate() = 0;
21     void distribute_load();
22     void deploy();
23
24 private:
25     struct host_parameters {
26         host_parameters(): load(0.0) { }
27
28         double load;
29         std::vector<int> neighbors;
30     };
31
32     std::vector<host_parameters> hosts;
33 };
34
35 #define DEPLOYMENT(name)                                        \
36     class deployment_ ## name: public deployment_generator {    \
37     public: void generate();                                    \
38     }
39
40 DEPLOYMENT(btree);
41 DEPLOYMENT(clique);
42 DEPLOYMENT(hcube);
43 DEPLOYMENT(line);
44 DEPLOYMENT(ring);
45 DEPLOYMENT(star);
46 DEPLOYMENT(torus);
47
48 #undef DEPLOYMENT
49
50 #endif // !DEPLOYMENT_H
51
52 // Local variables:
53 // mode: c++
54 // End: