From 56cc59cf44ec64440ba4d1c0d005196195c758e6 Mon Sep 17 00:00:00 2001 From: hugues Date: Sat, 25 Mar 2006 15:07:51 +0000 Subject: Nettoyage du repository glagen git-svn-id: file:///usr/local/opt/svn/repos/glagen@12 0f7e0d06-a6f9-0310-a55f-d5f984f55e4c --- tags/START/glagen/algo_distribue/main.cc | 113 ------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 tags/START/glagen/algo_distribue/main.cc (limited to 'tags/START/glagen/algo_distribue/main.cc') diff --git a/tags/START/glagen/algo_distribue/main.cc b/tags/START/glagen/algo_distribue/main.cc deleted file mode 100644 index e78d461..0000000 --- a/tags/START/glagen/algo_distribue/main.cc +++ /dev/null @@ -1,113 +0,0 @@ -// Algo distribue - -// glagen_divide [n] -// n indique le nombre d'ordinateur en reseau exclut le serveur - -#include -#include -#include - -// Load Tree -#include "tree/node.hh" -#include "tree/tree.hh" - -// Load Network -#include "network/Server.hh" -#include "network/Client.hh" - -// Load Data -#include "network/data/Data_string.hh" - -// Load Tool -#include "tools/matrix.hh" - -#include "Distribue.hh" - -#include -#include - -// Prototype : test d'essais avec 2 clients -// On changera suivant les donnees passes par GTK -// Il faut que le nombre de client soit superieur ou egale -// au nombre de noeud fils par rapport au noeud principal -#define NB_CLIENT 2 - -char gl_handle; - -Tree *create_tree(); - -void help(char *prog_name) -{ - std::cout << prog_name << " [port]" << std::endl; - exit(0); -} - -void signal_alarm(int) -{ - gl_handle = gl_handle | 1; -} - -void check_args(int argc, char *argv1, char *argv2) -{ - int current; - - if (argc != 2) - { - std::cerr << "Error server : Error parameters" << std::endl; - help(argv1); - } - for (current = 0; argv2[current] != '\0'; current++) - if (argv2[current] < '0' || argv2[current] > '9') - { - std::cerr << "Error server : Error parameters" << std::endl; - help(argv1); - } -} - -int main(int argc, char *argv[]) -{ - // Exemple de creation d'un arbre (donnees string) - // On peut appele une classe abstraite dont ses fils sont - // les types de donnees des librairies (ex: Tree) - Tree* tree; - tree = create_tree(); - - // Calcul de l'algo distribue : calcul l'attribution des taches - // pour chaque client - Distribue network(*tree); - std::cout << "Matrice calcule" << std::endl - << network.get_matrix() << std::endl; - - // Execution du serveur - check_args(argc, argv[0], argv[1]); - Server server(atoi(argv[1]), NB_CLIENT); - - // Transfert des donnees - network.transfer(server); - - return (0); -} - - - -Tree *create_tree() -{ - string root = "Connection..."; - string a = "Est-ce que ca fonctionne ?"; - string b = "1212123"; - string c = "OK recu 5/5"; - Tree tree(root); - tree.add_node(a); - tree.add_node(b); - tree.add_node(c); - - Tree* main_tree = new Tree(string("Execution...")); - main_tree->add_tree(tree); - - Tree tree2(string("Une tentative de suicide")); - tree2.add_node(string("Ou ca?")); - tree2.add_node(string("A Epita")); - tree2.add_node(string("Ping pong ping")); - main_tree->add_tree(tree2); - return (main_tree); -} -- cgit v1.2.3