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

Private GIT Repository
Add support for a constant random, for testing.
[loba.git] / deployment.h
index 4dde4806fae3ec5f09c92fb9c0f0c95b01d65dfa..b3fa43a6b29b14faccb3ddf65ad82fd1fbcd31d4 100644 (file)
@@ -1,8 +1,51 @@
 #ifndef DEPLOYMENT_H
 #define DEPLOYMENT_H
 
+#include <vector>
+
+// Deploy an application automatically, according to the global parameters
 void MY_launch_application();
 
+// Base class for deployment generators...
+class deployment_generator {
+public:
+    deployment_generator();
+
+    size_t size() const { return hosts.size(); }
+    void set_load(int host, double load);
+    void set_neighbor(int host, int neighbor);
+    void set_link(int host1, int host2);
+
+    virtual void generate() = 0;
+    void distribute_load();
+    void deploy();
+
+private:
+    struct host_parameters {
+        host_parameters(): load(0.0) { }
+
+        double load;
+        std::vector<int> neighbors;
+    };
+
+    std::vector<host_parameters> hosts;
+};
+
+#define DEPLOYMENT(name)                                        \
+    class deployment_ ## name: public deployment_generator {    \
+    public: void generate();                                    \
+    }
+
+DEPLOYMENT(btree);
+DEPLOYMENT(clique);
+DEPLOYMENT(hcube);
+DEPLOYMENT(line);
+DEPLOYMENT(ring);
+DEPLOYMENT(star);
+DEPLOYMENT(torus);
+
+#undef DEPLOYMENT
+
 #endif // !DEPLOYMENT_H
 
 // Local variables: