summaryrefslogtreecommitdiff
path: root/tags/START/glagen/algo_distribue
diff options
context:
space:
mode:
authorhugues <hugues@0f7e0d06-a6f9-0310-a55f-d5f984f55e4c>2006-03-25 15:07:51 +0000
committerHugues Hiegel <hugues@hiegel.fr>2008-03-18 10:06:55 +0100
commit56cc59cf44ec64440ba4d1c0d005196195c758e6 (patch)
tree0e4bc431438a05c2e32b8703a8c79dcbf26a7cbf /tags/START/glagen/algo_distribue
parentd49be924baa2759aefa5b5311a35adf50db48e12 (diff)
Nettoyage du repository glagenHEADmaster
git-svn-id: file:///usr/local/opt/svn/repos/glagen@12 0f7e0d06-a6f9-0310-a55f-d5f984f55e4c
Diffstat (limited to 'tags/START/glagen/algo_distribue')
-rw-r--r--tags/START/glagen/algo_distribue/Distribue.cc1
-rw-r--r--tags/START/glagen/algo_distribue/Distribue.hh97
-rw-r--r--tags/START/glagen/algo_distribue/Makefile51
-rw-r--r--tags/START/glagen/algo_distribue/main.cc113
-rw-r--r--tags/START/glagen/algo_distribue/network/Client.cc1
-rw-r--r--tags/START/glagen/algo_distribue/network/Client.hh113
-rw-r--r--tags/START/glagen/algo_distribue/network/Makefile62
-rw-r--r--tags/START/glagen/algo_distribue/network/Server.cc1
-rw-r--r--tags/START/glagen/algo_distribue/network/Server.hh218
-rw-r--r--tags/START/glagen/algo_distribue/network/data/Data.cc1
-rw-r--r--tags/START/glagen/algo_distribue/network/data/Data.hh78
-rw-r--r--tags/START/glagen/algo_distribue/network/data/Data_exemple.cc1
-rw-r--r--tags/START/glagen/algo_distribue/network/data/Data_exemple.hh66
-rw-r--r--tags/START/glagen/algo_distribue/network/data/Data_string.cc1
-rw-r--r--tags/START/glagen/algo_distribue/network/data/Data_string.hh60
-rw-r--r--tags/START/glagen/algo_distribue/network/main_client.cc54
-rw-r--r--tags/START/glagen/algo_distribue/network/main_server.cc73
-rw-r--r--tags/START/glagen/algo_distribue/tools/matrix.cc3
-rw-r--r--tags/START/glagen/algo_distribue/tools/matrix.hh324
-rw-r--r--tags/START/glagen/algo_distribue/tree/Makefile45
-rw-r--r--tags/START/glagen/algo_distribue/tree/main.cc99
-rw-r--r--tags/START/glagen/algo_distribue/tree/node.cc11
-rw-r--r--tags/START/glagen/algo_distribue/tree/node.hh78
-rw-r--r--tags/START/glagen/algo_distribue/tree/tree.cc11
-rw-r--r--tags/START/glagen/algo_distribue/tree/tree.hh51
25 files changed, 0 insertions, 1613 deletions
diff --git a/tags/START/glagen/algo_distribue/Distribue.cc b/tags/START/glagen/algo_distribue/Distribue.cc
deleted file mode 100644
index 09efc50..0000000
--- a/tags/START/glagen/algo_distribue/Distribue.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include "Distribue.hh"
diff --git a/tags/START/glagen/algo_distribue/Distribue.hh b/tags/START/glagen/algo_distribue/Distribue.hh
deleted file mode 100644
index ff3b76d..0000000
--- a/tags/START/glagen/algo_distribue/Distribue.hh
+++ /dev/null
@@ -1,97 +0,0 @@
-// Classe Distribue
-
-
-
-#ifndef DISTRIBUE_HH_
-# define DISTRIBUE_HH_
-
-#include "tree/tree.hh"
-#include "tree/node.hh"
-#include "network/data/Data.hh"
-#include "network/Server.hh"
-#include "tools/matrix.hh"
-
-template<class TYPENODE> class Distribue
-{
-public:
- Distribue(const Tree<TYPENODE>& tree)
- : _tree(tree),
- _size(tree.get_node_root().get_number_node()),
- _mat(new Matrix<int> (_size, _size))
- {
- unsigned int ptr1 = 0, ptr2 = 0;
- std::list< Node<TYPENODE> > ptr_node = *new std::list< Node<TYPENODE> >;
- ptr_node.push_back(tree.get_node_root());
- while (ptr_node.size())
- {
- std::list< Node<TYPENODE> >::iterator childs = ptr_node.begin();
- std::list< Node<TYPENODE> >::iterator child =
- childs->get_childs()->begin();
- for (; child != childs->get_childs()->end(); ++child)
- {
- ptr_node.push_back(*child);
- (*_mat)(++ptr2, ptr1) = 1;
- }
- ptr_node.pop_front();
- ptr1++;
- }
- }
-
- void depend(std::list<TYPENODE>& data, const unsigned int& ptr)
- {
- data.push_back(_tree.get_node_root().get_node_course_width(ptr).get_data());
- for (unsigned int i = 0; i < _size; ++i)
- if ((*_mat)(i, ptr))
- depend(data, i);
- }
-
- void transfer(Server& server)
- {
- // Calcul du nombre de client necessaire
- unsigned int j = 0;
- std::list< list<TYPENODE> > list_data =
- *new std::list< list<TYPENODE> >;
- std::list<TYPENODE> data = *new std::list<TYPENODE>;
- for (unsigned int i = 1; i < _size; ++i)
- {
- if ((*_mat)(i, 0)) // Ne prend que les noeuds fils du noeud root
- {
- ++j;
- this->depend(data, i);
- list_data.push_back(data);
- data = *new std::list<TYPENODE>;
- }
- }
- if (server.get_nb_client() < j)
- {
- std::cout << "Need more client" << std::endl;
- exit(-1);
- }
-
- std::list<int>::const_iterator fd_client =
- server.get_list_fd()->begin();
- data = *new std::list<TYPENODE>;
- for (unsigned int i = 1; i < _size; ++i)
- {
- if ((*_mat)(i, 0)) // Ne prend que les noeuds fils du noeud root
- {
- ++j;
- this->depend(data, i);
- server.send_data(*fd_client++, Data<TYPENODE>(&data));
- data = *new std::list<TYPENODE>;
- }
- }
- }
-
- Matrix<int>& get_matrix()
- {
- return (*_mat);
- }
-
-private:
- Tree<TYPENODE> _tree;
- unsigned int _size;
- Matrix<int> *_mat;
-};
-
-#endif // DISTRIBUTE_HH_
diff --git a/tags/START/glagen/algo_distribue/Makefile b/tags/START/glagen/algo_distribue/Makefile
deleted file mode 100644
index fb30eba..0000000
--- a/tags/START/glagen/algo_distribue/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-##
-## Makefile for in
-##
-## Made by meng-tih lam
-## Login <lam_m@epita.fr>
-##
-## Started on Thu Feb 7 19:08:57 2002 meng-tih lam
-
-##
-
-NAME = glagen_divide
-SRC_TOOLS = tools/matrix.cc
-SRC_DATA = network/data/Data.cc network/data/Data_exemple.cc
-SRC_TREE = tree/node.cc tree/tree.cc
-SRC_NETWORK = network/Server.cc network/Client.cc
-SRC_MAIN = Distribue.cc main.cc
-SRCS = ${SRC_TOOLS} ${SRC_TREE} ${SRC_NETWORK}\
- ${SRC_DATA} ${SRC_MAIN}
-
-OBJS = $(SRCS:.cc=.o)
-
-ARCHI_i586 = -g2 -Wall -W -Werror -O3
-ARCHI_NetBSD = -g2 -Wall -W -Werror -O3 -I/usr/X11R6/include
-ARCHI_sun4 = -g2 -Wall -W -Werror -O3
-ARCHI_alpha = -g2 -Wall -W -Werror -O3
-
-LIB_i586 =
-LIB_NetBSD = -L/usr/pkg/lib -L/usr/X11R6/lib -lGL -lGLU -lglut
-LIB_alpha =
-LIB_sun4 =
-
-CPPFLAGS = -I.
-CC = g++
-RM = rm -f
-
-.PHONY: all clean deps
-
-all: $(OBJS)
- $(CC) -o $(NAME) $(CFLAGS) $(OBJS)\
- $(LIB_${HOSTTYPE}) $(ARCHI_${HOSTTYPE})
-
-.cc.o:
- $(CC) $(ARCHI_${HOSTTYPE}) $(CPPFLAGS) -c $< -o $(<:.cc=.o)
-
-clean:
- $(RM) $(OBJS) $(NAME) *~ \#*\#
-
-deps:
- makedepend $(SRC) 2>/dev/null
-
-re: clean all
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 <iostream>
-#include <list>
-#include <string>
-
-// 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 <stdlib.h>
-#include <assert.h>
-
-// 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<Data_string> *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<Abstraite*>)
- Tree<Data_string>* tree;
- tree = create_tree();
-
- // Calcul de l'algo distribue : calcul l'attribution des taches
- // pour chaque client
- Distribue<Data_string> 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<Data_string> *create_tree()
-{
- string root = "Connection...";
- string a = "Est-ce que ca fonctionne ?";
- string b = "1212123";
- string c = "OK recu 5/5";
- Tree<Data_string> tree(root);
- tree.add_node(a);
- tree.add_node(b);
- tree.add_node(c);
-
- Tree<Data_string>* main_tree = new Tree<Data_string>(string("Execution..."));
- main_tree->add_tree(tree);
-
- Tree<Data_string> 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);
-}
diff --git a/tags/START/glagen/algo_distribue/network/Client.cc b/tags/START/glagen/algo_distribue/network/Client.cc
deleted file mode 100644
index 23ccb2c..0000000
--- a/tags/START/glagen/algo_distribue/network/Client.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include "Client.hh"
diff --git a/tags/START/glagen/algo_distribue/network/Client.hh b/tags/START/glagen/algo_distribue/network/Client.hh
deleted file mode 100644
index 923b83e..0000000
--- a/tags/START/glagen/algo_distribue/network/Client.hh
+++ /dev/null
@@ -1,113 +0,0 @@
-// Classe Client
-
-#ifndef CLIENT_HH_
-# define CLIENT_HH_
-
-#include <list>
-#include <iostream>
-#include <string>
-#include <stdio.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <signal.h>
-#include <netdb.h>
-#include <assert.h>
-#include <unistd.h>
-
-#include "data/Data.hh"
-
-class Client
-{
-public:
- Client(char* host, const int& port)
- {
- char *c;
- int sock;
- struct sockaddr_in sa;
- long addr;
- struct hostent *host_info;
-
- if ((host_info = gethostbyname(host)) == 0)
- this->error();
- c = host_info->h_addr;
- addr = c[0] << 24 | c[1] << 16 | c[2] << 8 | c[3];
- if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
- this->error();
- sa.sin_family = AF_INET;
- sa.sin_port = htons(port);
- sa.sin_addr.s_addr = htonl(addr);
- if (connect(sock, (struct sockaddr *)&sa, sizeof (sa)) == -1)
- this->error();
- _fd_server = sock;
- }
-
- void error()
- {
- std::cerr << "Error client : ";
- perror("");
- exit(errno);
- }
-
- template <class TYPEDATA>
- void send_data(const Data<TYPEDATA>& data) const
- {
- data.send(_fd_server);
- }
-
- template <class TYPEDATA>
- void received_data(Data<TYPEDATA>& data)
- {
- data.receive(_fd_server);
- }
-
- void wait_signal()
- {
- unsigned char sig = 0;
- read(_fd_server, &sig, sizeof(unsigned char));
- if (sig != 42)
- {
- std::cout << "Erreur de transmission" << std::endl;
- exit(1);
- }
- std::cout << "En communication avec le serveur..." << std::endl;
- }
-
- void send_signal()
- {
- unsigned char sig = 42;
- write(_fd_server, &sig, sizeof(unsigned char));
- }
-
- int do_select()
- {
- fd_set rd;
- char buf[256];
- int n;
-
- FD_ZERO(&rd);
- FD_SET(0, &rd);
- FD_SET(_fd_server, &rd);
- if (select(_fd_server + 1, &rd, 0, 0, 0) == -1)
- this->error();
- if (FD_ISSET(_fd_server, &rd))
- {
- n = read(_fd_server, buf, 150);
- if (n <= 0)
- return (1);
- write(1, buf, n);
- fflush(0);
- }
- if (FD_ISSET(0, &rd))
- {
- n = read(0, buf, 100);
- write(_fd_server, buf, n);
- }
- return (0);
- }
-
-
-private:
- int _fd_server;
-};
-
-#endif // CLIENT_HH_
diff --git a/tags/START/glagen/algo_distribue/network/Makefile b/tags/START/glagen/algo_distribue/network/Makefile
deleted file mode 100644
index 18878df..0000000
--- a/tags/START/glagen/algo_distribue/network/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-##
-## Makefile for in
-##
-## Made by meng-tih lam
-## Login <lam_m@epita.fr>
-##
-## Started on Thu Feb 7 19:08:57 2002 meng-tih lam
-
-##
-
-NAME_SERVER = glagen_server
-NAME_CLIENT = glagen_client
-SRC_DATA = data/Data.cc\
- data/Data_exemple.cc\
- data/Data_string.cc
-SRC_SERVER = Server.cc main_server.cc
-SRC_CLIENT = Client.cc main_client.cc
-
-OBJ_SERVER = $(SRC:.cc=.o) $(SRC_SERVER:.cc=.o)
-OBJ_CLIENT = $(SRC:.cc=.o) $(SRC_CLIENT:.cc=.o)
-
-ARCHI_i586 = -g2 -Wall -W -Werror -O3
-ARCHI_NetBSD = -g2 -Wall -W -Werror -O3 -I/usr/X11R6/include
-ARCHI_sun4 = -g2 -Wall -W -Werror -O3
-ARCHI_alpha = -g2 -Wall -W -Werror -O3
-
-LIB_i586 = -lc
-LIB_NetBSD = -L/usr/pkg/lib -L/usr/X11R6/lib -lGL -lGLU -lglut -lc
-LIB_alpha =
-LIB_sun4 = -lsocket -lnsl
-
-CPPFLAGS = -I.
-CC = g++
-RM = rm -f
-
-.PHONY: all clean deps
-
-all: server client
-
-server: $(NAME_SERVER)
-
-client: $(NAME_CLIENT)
-
-$(NAME_SERVER): $(OBJ_SERVER)
- $(CC) -o $(NAME_SERVER) $(CFLAGS) $(OBJ_SERVER)\
- $(LIB_${HOSTTYPE}) $(ARCHI_${HOSTTYPE})
-
-$(NAME_CLIENT): $(OBJ_CLIENT)
- $(CC) -o $(NAME_CLIENT) $(CFLAGS) $(OBJ_CLIENT)\
- $(LIB_${HOSTTYPE}) $(ARCHI_${HOSTTYPE})
-
-.cc.o:
- $(CC) $(ARCHI_${HOSTTYPE}) $(CPPFLAGS) -c $<
-
-clean:
- $(RM) $(OBJ_SERVER) $(OBJ_CLIENT) $(NAME_SERVER) $(NAME_CLIENT)\
- *~ \#*\#
-
-deps:
- makedepend $(SRC) 2>/dev/null
-
-re: clean all
diff --git a/tags/START/glagen/algo_distribue/network/Server.cc b/tags/START/glagen/algo_distribue/network/Server.cc
deleted file mode 100644
index 63f45ff..0000000
--- a/tags/START/glagen/algo_distribue/network/Server.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include "Server.hh"
diff --git a/tags/START/glagen/algo_distribue/network/Server.hh b/tags/START/glagen/algo_distribue/network/Server.hh
deleted file mode 100644
index fdfecb4..0000000
--- a/tags/START/glagen/algo_distribue/network/Server.hh
+++ /dev/null
@@ -1,218 +0,0 @@
-// Classe Server
-
-#ifndef SERVER_HH_
-# define SERVER_HH_
-
-#include <list>
-#include <iostream>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <signal.h>
-#include <poll.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <assert.h>
-#include "data/Data.hh"
-
-extern char gl_handle;
-
-extern void signal_alarm(int);
-
-template<class TYPEDATA> class Data;
-
-class Server
-{
-public:
- Server(const int& port, const unsigned int& nb_client_max)
- {
- _port = port;
- _client_max = nb_client_max;
- _fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
- _sock_in = new struct sockaddr_in;
- _sock_in->sin_family = PF_INET;
- _sock_in->sin_port = htons(port);
- _sock_in->sin_addr.s_addr = INADDR_ANY;
- if ((bind(_fd, (struct sockaddr *)_sock_in, sizeof (*_sock_in)) == -1)
- || (listen(_fd, 5) == -1))
- this->error();
- std::cout << "Server started. Listening on port " << _port << std::endl;
- _fd_client = new std::list<int>;
- this->start_signal();
- this->start();
- }
-
- void start()
- {
- int fd_client;
- socklen_t len;
- struct sockaddr_in sock_client;
-
- len = sizeof (struct sockaddr_in);
- while (gl_handle != -1 && this->_fd_client->size() < _client_max)
- {
- fd_client = 0;
- if ((fd_client = accept(this->_fd,
- (struct sockaddr *)&(sock_client), &len)) > 0)
- gl_handle = gl_handle | 2;
- std::list<int> list_fd;
- if (2 == (gl_handle & 2))
- {
- this->accept_client(fd_client);
- this->send_signal(fd_client);
- std::cout << "Number of connected clients :"
- << this->_fd_client->size() << std::endl;
- }
- gl_handle = 0;
- this->test_client();
- }
- }
-
- void test_client()
- {
- if (_fd_client->size())
- {
- std::list<int>::const_iterator fd_client_tmp;
- std::list<int>::const_iterator fd_client = _fd_client->begin();
- int i = 0;
- while (fd_client != _fd_client->end())
- {
- i++;
- char c = 0;
- errno = 0;
- fd_client_tmp = fd_client;
- read(*fd_client, &c, sizeof(char));
- ++fd_client;
- if (errno == 0)
- this->remove_client(*fd_client_tmp);
- }
- }
- }
-
- void error()
- {
- std::cerr << "Error server : ";
- perror("");
- exit(errno);
- }
-
- void remove_client(const int& fd)
- {
- _fd_client->remove(fd);
- std::cout << "Client in the file descriptor : " << fd
- << " are disconnected" << std::endl;
- std::cout << "Number of connected clients :"
- << this->_fd_client->size() << std::endl;
- }
-
- void wait_signal(std::list<int>& list_fd) // retourne la liste des files descriptors a lire
- {
- struct pollfd poll_fd[_fd_client->size()];
- std::list<int>::const_iterator fd = _fd_client->begin();
- for (int i = 0; fd != _fd_client->end(); ++fd, ++i)
- {
- poll_fd[i].fd = *fd;
- poll_fd[i].events = POLLIN;
- }
- if (poll(poll_fd, _fd_client->size(), 0) < 0)
- assert(0);
- for (unsigned int i = 0; i < _fd_client->size(); ++i)
- if (poll_fd[i].revents != 0)
- {
- unsigned char sig = 0;
- unsigned int length = 0;
- do
- {
- errno = 0;
- length = read(poll_fd[i].fd, &sig, sizeof(unsigned char));
- }
- while (errno == 4);
- if (errno)
- {
- perror("");
- exit(errno);
- }
- if (length == 0)
- remove_client(poll_fd[i].fd);
- else
- if (sig == 42)
- {
- list_fd.push_back(poll_fd[i].fd);
- std::cout << "Reception signal sur le file descriptor :"
- << poll_fd[i].fd << std::endl;
- }
- else
- {
- std::cout << "Erreur de reception sur le file descriptor :"
- << poll_fd[i].fd << std::endl;
- exit(2);
- }
- poll_fd[i].revents = 0;
- }
- }
-
- void send_signal(const int& fd)
- {
- unsigned char sig = 42;
- write(fd, &sig, sizeof(unsigned char));
- }
-
- void start_signal()
- {
- struct sigaction alarm;
-
- alarm.sa_handler = signal_alarm;
- alarm.sa_flags = 0;
- sigemptyset(&(alarm.sa_mask));
- sigaddset(&(alarm.sa_mask), SIGALRM);
- sigaction(SIGALRM, &alarm, 0);
- ualarm(1, 100000);
- }
-
- template<class TYPEDATA>
- void send_data(const int& fd, const Data<TYPEDATA>& data)
- {
- data.send(fd);
- }
-
- template<class TYPEDATA>
- void send_data(const Data<TYPEDATA>& data,
- const std::list<int>& fd_client)
- {
- std::list<int>::const_iterator fd = fd_client.begin();
- for (; fd != fd_client.end(); ++fd)
- data.send(*fd);
- }
-
- template<class TYPEDATA>
- void received_data(Data<TYPEDATA>& data, const std::list<int>& fd_client)
- {
- std::list<int>::const_iterator fd = fd_client.begin();
- for (; fd != fd_client.end(); ++fd)
- data.receive(*fd);
- }
-
- void accept_client(const int& fd)
- {
- std::cout << "Client connected on file descriptor: " << fd << std::endl;
- _fd_client->push_back(fd);
- }
-
- int get_fd() const { return (_fd); }
-
- int get_port() const { return (_port); }
-
- std::list<int>* get_list_fd() const { return (_fd_client); }
-
- unsigned int get_nb_client() const { return (_fd_client->size()); }
-
-private:
- std::list<int> *_fd_client;
- struct sockaddr_in *_sock_in;
- int _port;
- unsigned int _client_max;
- int _fd;
-};
-
-#endif // SERVER_HH_
diff --git a/tags/START/glagen/algo_distribue/network/data/Data.cc b/tags/START/glagen/algo_distribue/network/data/Data.cc
deleted file mode 100644
index d3bbe6a..0000000
--- a/tags/START/glagen/algo_distribue/network/data/Data.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include "Data.hh"
diff --git a/tags/START/glagen/algo_distribue/network/data/Data.hh b/tags/START/glagen/algo_distribue/network/data/Data.hh
deleted file mode 100644
index 3b630ff..0000000
--- a/tags/START/glagen/algo_distribue/network/data/Data.hh
+++ /dev/null
@@ -1,78 +0,0 @@
-// Classe Data
-
-// Dans le TYPEDATA, il faut l'implementation de toString (retourne un string)
-// et de type (retourne unsigned short int)
-
-// Type 0: char
-// Type 1: unsigned char
-// Type 2: int
-// Type 3: unsigned int
-// Type 4: short int
-// Type 5: unsigned short int
-// Type 6: long int
-// Type 7: unsigned long int
-// Type 8: float
-// Type 9: double
-// Type 10: long double
-
-#ifndef DATA_HH_
-# define DATA_HH_
-
-#include <list>
-#include <iostream>
-#include <stdio.h>
-
-#include <errno.h>
-
-template<class TYPEDATA> class Data
-{
-public:
- Data() : _data(new std::list<TYPEDATA>) {};
-
- Data(std::list<TYPEDATA>* data) : _data(data) {};
-
- void error()
- {
- perror("");
- exit(errno);
- }
-
- void add_data(const TYPEDATA& data) { _data->push_back(data); };
-
- void send(const int& fd) const
- {
- std::list<TYPEDATA>::iterator data = _data->begin();
- unsigned int size = _data->size();
- std::cout << "Taille a ecrire:" << size << std::endl;
- write(fd, &size, sizeof(unsigned int));
- for (; data != _data->end(); ++data)
- data->write_data(fd);
- }
-
- void receive(const int& fd)
- {
- unsigned int size = 0;
- do
- {
- errno = 0;
- read(fd, &size, sizeof(unsigned int));
- }
- while(errno == 4);
- if (errno)
- this->error();
- std::cout << "Taille lu: " << size << std::endl;
- TYPEDATA data;
- for (unsigned int i = 0; i < size; ++i)
- {
- data.read_data(fd);
- _data->push_back(data);
- }
- }
-
- std::list<TYPEDATA>* get_data() { return (_data); }
-
-private:
- std::list<TYPEDATA>* _data;
-};
-
-#endif // DATA_HH_
diff --git a/tags/START/glagen/algo_distribue/network/data/Data_exemple.cc b/tags/START/glagen/algo_distribue/network/data/Data_exemple.cc
deleted file mode 100644
index 9578493..0000000
--- a/tags/START/glagen/algo_distribue/network/data/Data_exemple.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include "Data_exemple.hh"
diff --git a/tags/START/glagen/algo_distribue/network/data/Data_exemple.hh b/tags/START/glagen/algo_distribue/network/data/Data_exemple.hh
deleted file mode 100644
index ca1291b..0000000
--- a/tags/START/glagen/algo_distribue/network/data/Data_exemple.hh
+++ /dev/null
@@ -1,66 +0,0 @@
-// Classe Data_exemple
-
-// Un exemple sur un point de coordonnees 3D
-
-#ifndef DATA_EXEMPLE_HH_
-# define DATA_EXEMPLE_HH_
-
-#include <iostream>
-#include <unistd.h> // Pour write/read
-
-#include <errno.h>
-
-class Data_exemple
-{
-public:
- Data_exemple() : _x(0), _y(0), _z(0) {};
- Data_exemple(int x, int y, int z) : _x(x), _y(y), _z(z) {};
-
- void write_data(const int& fd) const
- {
- std::cout << "Donnees envoyes au serveur" << std::endl;
- std::cout << _x << std::endl;
- std::cout << _y << std::endl;
- std::cout << _z << std::endl;
- write(fd, &_x, sizeof(int));
- write(fd, &_y, sizeof(int));
- write(fd, &_z, sizeof(int));
- }
-
- void read_data(const int& fd)
- {
- do
- {
- errno = 0;
- read(fd, &_x, sizeof(int));
- }
- while (errno == 4);
-
- do
- {
- errno = 0;
- read(fd, &_y, sizeof(int));
- }
- while (errno == 4);
-
- do
- {
- errno = 0;
- read(fd, &_z, sizeof(int));
- }
- while (errno == 4);
-
- std::cout << "Reception message sur le file descriptor :" << fd
- << std::endl;
- std::cout << _x << std::endl;
- std::cout << _y << std::endl;
- std::cout << _z << std::endl;
- }
-
-private:
- int _x;
- int _y;
- int _z;
-};
-
-#endif // DATA_EXEMPLE
diff --git a/tags/START/glagen/algo_distribue/network/data/Data_string.cc b/tags/START/glagen/algo_distribue/network/data/Data_string.cc
deleted file mode 100644
index 9578493..0000000
--- a/tags/START/glagen/algo_distribue/network/data/Data_string.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include "Data_exemple.hh"
diff --git a/tags/START/glagen/algo_distribue/network/data/Data_string.hh b/tags/START/glagen/algo_distribue/network/data/Data_string.hh
deleted file mode 100644
index a395725..0000000
--- a/tags/START/glagen/algo_distribue/network/data/Data_string.hh
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef DATA_STRING_HH_
-# define DATA_STRING_HH_
-
-#include <iostream>
-#include <string>
-#include <unistd.h> // Pour write/read
-
-#include <errno.h>
-
-class Data_string
-{
-public:
- Data_string() : _str("") {};
- Data_string(const string& str) : _str(str) {};
-
- void write_data(const int& fd) const
- {
-
- std::cout << "Donnees envoyes" << std::endl << _str << std::endl;
- unsigned int size = _str.size();
- write(fd, &size, sizeof(unsigned int));
- for (unsigned int i = 0; i < size; ++i)
- {
- char car = _str[i];
- write(fd, &car, sizeof(char));
- }
- }
-
- void read_data(const int& fd)
- {
- unsigned int size = 0;
- do
- {
- errno = 0;
- read(fd, &size, sizeof(size));
- }
- while (errno == 4);
-
- _str = "";
- for (unsigned int i = 0; i < size; ++i)
- {
- char car;
- do
- {
- errno = 0;
- read(fd, &car, sizeof(char));
- }
- while (errno == 4);
- _str += car;
- }
-
- std::cout << "Reception message sur le file descriptor :" << fd
- << std::endl << _str << std::endl;
- }
-
-private:
- string _str;
-};
-
-#endif // DATA_STRING
diff --git a/tags/START/glagen/algo_distribue/network/main_client.cc b/tags/START/glagen/algo_distribue/network/main_client.cc
deleted file mode 100644
index 66cb083..0000000
--- a/tags/START/glagen/algo_distribue/network/main_client.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Main du client
-
-#include <unistd.h>
-#include <assert.h>
-#include "Client.hh"
-#include "data/Data_exemple.hh"
-#include "data/Data_string.hh"
-
-void help(char *prog_name)
-{
- std::cout << prog_name << " [hostname] [port]" << std::endl;
- exit(0);
-}
-
-void check_args(int argc, char **argv)
-{
- int current;
-
- if (argc != 3)
- {
- std::cerr << "Error client : Error parameters" << std::endl;
- help(argv[0]);
- }
- for (current = 0; argv[2][current] != '\0'; current++)
- if (argv[2][current] < '0' || argv[2][current] > '9')
- {
- std::cerr << "Error client : Error parameters" << std::endl;
- help(argv[0]);
- }
-}
-
-int main(int argc, char **argv)
-{
- check_args(argc, argv);
- Client client(argv[1], atoi(argv[2]));
-// Data<Data_exemple> data;
-// data.add_data(Data_exemple(10, 11, 13));
-// data.add_data(Data_exemple(1, 4, 81));
- client.wait_signal();
-// client.send_signal();
-// client.send_data(data);
-
-// Data<Data_string> data_string;
-// client.received_data(data_string);
-
- // On devrait implementer un numero a chaque classe associe
- // Je fais ca pour l'instant comme si on connait deja le type de classe
- // c'est juste pour tester
- Data<Data_string> data_string;
- client.received_data(data_string);
-
- while (0 == client.do_select());
- return (0);
-}
diff --git a/tags/START/glagen/algo_distribue/network/main_server.cc b/tags/START/glagen/algo_distribue/network/main_server.cc
deleted file mode 100644
index 4fafd09..0000000
--- a/tags/START/glagen/algo_distribue/network/main_server.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Main du reseau server
-
-#include <assert.h>
-#include "Server.hh"
-#include "data/Data_exemple.hh"
-#include "data/Data_string.hh"
-
-char gl_handle;
-
-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[])
-{
-// int fd_client;
-// socklen_t len;
-// struct sockaddr_in sock_client;
-
-// len = sizeof (struct sockaddr_in);
- check_args(argc, argv[0], argv[1]);
- Server server(atoi(argv[1]), 3);
- server.get_list_fd();
-// server.start_signal();
-// while (gl_handle != -1)
-// {
-// fd_client = 0;
-// if ((fd_client = accept(server.get_fd(),
-// (struct sockaddr *)&(sock_client), &len)) > 0)
-// gl_handle = gl_handle | 2;
-// std::list<int> list_fd;
-// if (2 == (gl_handle & 2))
-// {
-// server.accept_client(fd_client);
-// server.send_signal(fd_client);
-// }
-// Data<Data_exemple> data;
-// server.wait_signal(list_fd);
-// server.received_data(data, list_fd);
-
-// Data<Data_string> data_string;
-// Data_string ack("Aknowledge");
-// data_string.add_data(ack);
-// server.send_data(data_string, list_fd);
-
-// gl_handle = 0;
-// }
-// return (0);
-}
diff --git a/tags/START/glagen/algo_distribue/tools/matrix.cc b/tags/START/glagen/algo_distribue/tools/matrix.cc
deleted file mode 100644
index 7991769..0000000
--- a/tags/START/glagen/algo_distribue/tools/matrix.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-#include "matrix.hh"
diff --git a/tags/START/glagen/algo_distribue/tools/matrix.hh b/tags/START/glagen/algo_distribue/tools/matrix.hh
deleted file mode 100644
index 4894360..0000000
--- a/tags/START/glagen/algo_distribue/tools/matrix.hh
+++ /dev/null
@@ -1,324 +0,0 @@
-// matrix.hh
-
-#include <iostream>
-
-#ifndef MATRIX_HH_
-# define MATRIX_HH_
-
-// la class TYPE ne peut etre que de type nombre (ex: double, int, long,...)
-
-template <class TYPE> class Matrix
-{
-public:
- // Constructor
- Matrix(const unsigned int i, const unsigned int j)
- {
- this->_i = i;
- this->_j = j;
- this->_lines = new _line[i]; // Create lines...
- for (unsigned int k = 0; k < i; ++k)
- this->_lines[k] = new TYPE[j]; // ...and create column
- for (unsigned int k = 0; k < i; ++k)
- for (unsigned int l = 0; l < j; ++l)
- this->_lines[k][l] = 0;
- }
-
- // Constructor by copy
- Matrix(const Matrix& mat)
- {
- this->_i = mat._i;
- this->_j = mat._j;
- this->_lines = new _line[this->_i];
- for (unsigned int k = 0; k < this->_i; ++k)
- {
- this->_lines[k] = new TYPE[this->_j];
- for (unsigned int l = 0; l < this->_j; ++l)
- this->_lines[k][l] = mat._lines[k][l];
- }
- }
-
- // Destructor
- ~Matrix()
- {
- if (this->_i != 0 || this->_j != 0)
- {
- for (unsigned int i = 0; i < this->_i; i++)
- delete [] this->_lines[i];
- delete [] this->_lines;
- }
- }
-
- // Affected operator
- Matrix& operator=(const Matrix& mat)
- {
- if (&mat != this)
- {
- if (mat._i != this->_i || mat._j != this->_j) // Test dim
- {
- this->~Matrix(); // Destroy...
- this->_i = mat._i;
- this->_j = mat._j;
- this->_lines = new _line[this->_i]; // ...and realloc
- for (unsigned int i = 0; i < this->_i; ++i)
- this->_lines[i] = new TYPE[this->_j];
- }
- for (unsigned int i = 0; i < this->_i; ++i) // Copy
- for (unsigned int j = 0; j < this->_j; ++j)
- this->_lines[i][j] = mat._lines[i][j];
- }
- return (*this);
- }
-
- // Add elements to matrix
- Matrix& add_elems(const int& nb)
- {
- Matrix mat(this->_i + nb, this->_j + nb);
- for (unsigned int i = 0; i < this->_i; i++)
- for (unsigned int j = 0; j < this->_j; j++)
- mat(i, j) = this->_lines[i][j];
- *this = mat;
- return (*this);
- }
-
- // Add matrix to matrix
- Matrix& add_mat(const Matrix& mat)
- {
- unsigned int i = this->_i;
- unsigned int j = this->_j;
- this->add_elems(mat._i);
- for (unsigned int k = i; k < this->_i; k++)
- for (unsigned int l = j; l < this->_j; l++)
- this->_lines[k][l] = mat(k - i, l - j);
- return (*this);
- }
-
- // Add of matrix
- Matrix operator+(const Matrix& mat)
- {
- Matrix mat_tmp(this->_i, mat._j);
- if (this->_i != mat._i || this->_j != mat._j)
- {
- std::cerr << "Error of addiction of 2 matrix (dimensions)"\
- << std::endl;
- return (mat_tmp);
- }
- for (unsigned int i = 0; i < this->_i; ++i)
- for (unsigned int j = 0; j < this->_j; ++j)
- mat_tmp._lines[i][j] = this->_lines[i][j] + mat._lines[i][j];
- return (mat_tmp);
- }
-
- Matrix operator+(const Matrix& mat) const
- {
- Matrix mat_tmp(this->_i, mat._j);
- if (this->_i != mat._i || this->_j != mat._j)
- {
- std::cerr << "Error of addiction of 2 matrix (dimensions)"\
- << std::endl;
- return (mat_tmp);
- }
- for (unsigned int i = 0; i < this->_i; ++i)
- for (unsigned int j = 0; j < this->_j; ++j)
- mat_tmp._lines[i][j] = this->_lines[i][j] + mat._lines[i][j];
- return (mat_tmp);
- }
-
- // Sub matrix
- Matrix operator-(const Matrix& mat)
- {
- Matrix mat_tmp(this->_i, mat._j);
- if (this->_i != mat._i || this->_j != mat._j)
- {
- std::cerr << "Error of substraction of 2 matrix (dimensions)"\
- << std::endl;
- return (mat_tmp);
- }
- for (unsigned int i = 0; i < this->_i; ++i)
- for (unsigned int j = 0; j < this->_j; ++j)
- mat_tmp._lines[i][j] = this->_lines[i][j] - mat._lines[i][j];
- return (mat_tmp);
- }
-
- Matrix operator-(const Matrix& mat) const
- {
- Matrix mat_tmp(this->_i, mat._j);
- if (this->_i != this->_j || this->_i != mat._i || mat._i != mat._j)
- {
- std::cerr << "Error of substraction of 2 matrix (dimensions)"\
- << std::endl;
- return (mat_tmp);
- }
- for (unsigned int i = 0; i < this->_i; ++i)
- for (unsigned int j = 0; j < this->_j; ++j)
- mat_tmp._lines[i][j] = this->_lines[i][j] - mat._lines[i][j];
- return (mat_tmp);
- }
-
- // Multiplication of matrix
- Matrix operator*(const Matrix& mat)
- {
- Matrix mat_tmp(this->_i, mat._j);
- if (this->_j != mat._i) // Check dimension
- {
- std::cerr << "Error of produce of 2 matrix (dimensions)"\
- << std::endl;
- return (mat_tmp);
- }
- for (unsigned int i = 0; i < this->_i; ++i)
- {
- for (unsigned int j = 0; j < mat._j; ++j)
- {
- TYPE res = 0;
- // Produce lines and column of matrix
- for (unsigned int k = 0; k < this->_j; ++k)
- res += this->_lines[i][k] * mat._lines[k][j];
- mat_tmp._lines[i][j] = res;
- }
- }
- return (mat_tmp);
- }
-
- // Multiplication with real
- Matrix& operator*(const TYPE& nbr)
- {
- for (unsigned int i = 0; i < this->_i; i++)
- for (unsigned int j = 0; j < this->_j; j++)
- {
- this->_lines[i][j] *= nbr;
- }
- return (*this);
- }
-
- // Divide with real
- Matrix& operator/(const TYPE& nbr)
- {
- for (unsigned int i = 0; i < this->_i; i++)
- for (unsigned int j = 0; j < this->_j; j++)
- {
- this->_lines[i][j] /= nbr;
- }
- return (*this);
- }
-
- //Get dimension of matrix
- const int get_dim() const
- {
- if (this->_i != this->_j)
- {
- std::cerr << "Matrix isn't nxn, cannot give dimension" << std::endl;
- return (0);
- }
- return (this->_i);
- }
-
- // Operator to change mat(i, j)
- // to can write mat(i, j) = ...
- TYPE& operator()(unsigned int i, unsigned int j)
- {
- return (this->_lines[i][j]);
- }
-
- // Operator to access mat(i, j)
- // to can write int x = mat(i, j)
- TYPE operator()(unsigned int i, unsigned int j) const
- {
- return (this->_lines[i][j]);
- }
-
- // Test matrix nul
- const bool test_nul() const
- {
- for (unsigned int i = 0; i < this->_i; i++)
- for (unsigned int j = 0; j < this->_j; j++)
- if (this->_lines[i][j] != 0)
- return (0);
- return (1);
- }
-
- // Test diagonal matrix nul
- const int test_diag() const
- {
- for (unsigned int i = 0; i < this->_i; i++)
- if (this->_lines[i][i] != 0)
- return (i);
- return (-1);
- }
-
- // Test diagonal matrix nul with element
- const int test_diag(const unsigned int& j) const
- {
- for (unsigned int i = 0; i < this->_i; i++)
- if (this->_lines[i][i] != 0 && i == j)
- return (i);
- return (-1);
- }
-
- // Calculate trace
- const TYPE trace() const
- {
- TYPE res = 0;
- if (this->_i != this->_j)
- {
- std::cerr << "Matrix isn't nxn, cannot give trace" << std::endl;
- return (0);
- }
- for (unsigned int i = 0; i < this->_i; i++)
- res += this->_lines[i][i];
- return (res);
- }
-
- // Transpose
- Matrix& transpose()
- {
- if (this->_i != this->_j)
- {
- std::cerr << "Matrix isn't nxn, cannot transpose" << std::endl;
- return (*this);
- }
- TYPE tmp = 0;
- for (unsigned int i = 0; i < this->_i; i++)
- for (unsigned int j = 0; j < i; j++)
- {
- tmp = this->_lines[i][j];
- this->_lines[i][j] = this->_lines[j][i];
- this->_lines[j][i] = tmp;
- }
- return (*this);
- }
-
- Matrix transpose() const
- {
- Matrix mat(this->_j, this->_i);
- for (unsigned int i = 0; i < this->_i; i++)
- for (unsigned int j = 0; j < this->_j; j++)
- mat._lines[i][j] = this->_lines[j][i];
- return (mat);
- }
-
- // Display matrix
- void print(std::ostream &os) const
- {
- for (unsigned int i = 0; i < this->_i; ++i)
- {
- for (unsigned int j = 0; j < this->_j; ++j)
- os << this->_lines[i][j] << " ";
- os << std::endl;
- }
- }
-
-protected:
- typedef TYPE* _line;
- _line* _lines;
- unsigned int _i; // Number of lines
- unsigned int _j; // Number of column
-};
-
-template <class TYPE>
-inline std::ostream& operator<<(std::ostream& ostr, const Matrix<TYPE>& stream)
-{
- stream.print(ostr);
- return (ostr);
-}
-
-
-#endif // MATRIX_HH
diff --git a/tags/START/glagen/algo_distribue/tree/Makefile b/tags/START/glagen/algo_distribue/tree/Makefile
deleted file mode 100644
index 895117b..0000000
--- a/tags/START/glagen/algo_distribue/tree/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-##
-## Makefile for in
-##
-## Made by meng-tih lam
-## Login <lam_m@epita.fr>
-##
-## Started on Thu Feb 7 19:08:57 2002 meng-tih lam
-
-##
-
-NAME = glagen_tree
-SRCS = node.cc tree.cc main.cc
-
-OBJS = $(SRCS:.cc=.o)
-
-ARCHI_i586 = -g2 -Wall -W -Werror -O3
-ARCHI_NetBSD = -g2 -Wall -W -Werror -O3 -I/usr/X11R6/include
-ARCHI_sun4 = -g2 -Wall -W -Werror -O3
-ARCHI_alpha = -g2 -Wall -W -Werror -O3
-
-LIB_i586 =
-LIB_NetBSD = -L/usr/pkg/lib -L/usr/X11R6/lib -lGL -lGLU -lglut
-LIB_alpha =
-LIB_sun4 =
-
-CPPFLAGS = -I.
-CC = g++
-RM = rm -f
-
-.PHONY: all clean deps
-
-all: $(OBJS)
- $(CC) -o $(NAME) $(CFLAGS) $(OBJS)\
- $(LIB_${HOSTTYPE}) $(ARCHI_${HOSTTYPE})
-
-.cc.o:
- $(CC) $(ARCHI_${HOSTTYPE}) $(CPPFLAGS) -c $<
-
-clean:
- $(RM) $(OBJS) $(NAME) *~ \#*\#
-
-deps:
- makedepend $(SRC) 2>/dev/null
-
-re: clean all
diff --git a/tags/START/glagen/algo_distribue/tree/main.cc b/tags/START/glagen/algo_distribue/tree/main.cc
deleted file mode 100644
index 3b6f02d..0000000
--- a/tags/START/glagen/algo_distribue/tree/main.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// main.cc for in
-//
-// Made by meng-tih lam
-// Login <lam_m@epita.fr>
-//
-// Started on Fri Aug 16 02:41:45 2002 meng-tih lam
-//
-
-#include <iostream>
-#include <list>
-#include <string>
-
-#include "node.hh"
-#include "tree.hh"
-
-// Pour construire un arbre, il faut d'abord faire les fils
-// et les raccoller avec le pere avec la methode add_tree
-
-int test_tree()
-{
- // ** Exemple avec la classe <string> **
- // ** On peut mettre n'importe classe **
-
- // * Support du sous-arbre *
- string root = "Connection...";
- string a = "Est-ce que ca fonctionne ?";
- string b = "1212123";
- string c = "OK recu 5/5";
- Tree<string> tree(root);
- tree.add_node(a);
- tree.add_node(b);
- tree.add_node(c);
-
- // Affichage root de l'arbre
- std::cout << "root: " << tree.get_node_root().get_data() << std::endl;
-
- // Affichage de ses fils
- unsigned int nb_childs = tree.get_nb_childs();
- for (unsigned int i = 0; i < nb_childs; ++i)
- std::cout << tree.get_child(i).get_data() << std::endl;
- std::cout << std::endl << std::endl;
-
-
-
- // * Support Arbre principale *
- Tree<string> main_tree("Execution...");
-
- // Voici la methode pour lier un arbre et un sous-arbre
- main_tree.add_tree(tree);
-
- std::cout << "root main: " << main_tree.get_node_root().get_data()
- << std::endl;
- unsigned int nb_childs2 = main_tree.get_nb_childs();
-
- // Ici arbre sur 2 niveaux (Bien sur qu'on peut faire en recursivite ^_^)
- for (unsigned int i = 0; i < nb_childs2; ++i)
- {
- nb_childs = main_tree.get_child(i).get_nb_childs();
- std::cout << main_tree.get_child(i).get_data() << std::endl;
- for (unsigned int j = 0; j < nb_childs; ++j)
- std::cout << main_tree.get_child(i).get_child(j).get_data()
- << std::endl;
- }
- std::cout << std::endl << std::endl;
-
-
-
-
- // * Allez on rajoute pour compliquer les choses *
- Tree<string> tree2("Une tentative de suicide");
- tree2.add_node("Ou ca?");
- tree2.add_node("A Epita");
- tree2.add_node("Ping pong ping");
- main_tree.add_tree(tree2);
-
- std::cout << "root main: " << main_tree.get_node_root().get_data()
- << std::endl;
- nb_childs2 = main_tree.get_nb_childs();
-
- // Ici arbre sur 2 niveaux (Bien sur qu'on peut faire en recursivite ^_^)
- for (unsigned int i = 0; i < nb_childs2; ++i)
- {
- nb_childs = main_tree.get_child(i).get_nb_childs();
- std::cout << main_tree.get_child(i).get_data() << std::endl;
- for (unsigned int j = 0; j < nb_childs; ++j)
- std::cout << main_tree.get_child(i).get_child(j).get_data()
- << std::endl;
- }
-
- return (0);
-}
-
-
-int main()
-{
- test_tree();
- return (0);
-}
diff --git a/tags/START/glagen/algo_distribue/tree/node.cc b/tags/START/glagen/algo_distribue/tree/node.cc
deleted file mode 100644
index a3ae387..0000000
--- a/tags/START/glagen/algo_distribue/tree/node.cc
+++ /dev/null
@@ -1,11 +0,0 @@
-//
-// node.cc for in
-//
-// Made by meng-tih lam
-// Login <lam_m@epita.fr>
-//
-// Started on Fri Aug 16 02:40:40 2002 meng-tih lam
-// Last update Fri Aug 16 02:41:05 2002 meng-tih lam
-//
-
-#include "node.hh"
diff --git a/tags/START/glagen/algo_distribue/tree/node.hh b/tags/START/glagen/algo_distribue/tree/node.hh
deleted file mode 100644
index b80a699..0000000
--- a/tags/START/glagen/algo_distribue/tree/node.hh
+++ /dev/null
@@ -1,78 +0,0 @@
-
-#ifndef NODE_HH_
-# define NODE_HH_
-
-#include <list>
-// Rajouter l'include correspondant a la template de TYPENODE
-// + implemente le std::cout abtrait pour les tests
-
-template<class TYPENODE> class Tree; // Declaration prealable
-
-template<class TYPENODE> class Node
-{
- friend class Tree<TYPENODE>;
-
-public:
- Node(const TYPENODE &d) : _link(new std::list<Node>), _data(d) {}
-
- void add_child(const TYPENODE& value) { _link->push_back(Node(value)); }
-
- void add_tree_node(const Node& value) { _link->push_back(value); }
-
- TYPENODE get_data() const { return (_data); }
-
- const unsigned int get_nb_childs() const { return (_link->size()); }
-
- std::list<Node>* get_childs() const { return (_link); }
-
- unsigned int get_number_node() const
- {
- unsigned int number_childs = _link->size();
- std::list<Node>::const_iterator child = _link->begin();
- unsigned int number_node = 1;
- for (unsigned int tmp = 0; tmp != number_childs; ++tmp)
- {
- number_node += child->get_number_node();
- ++child;
- }
- return (number_node);
- }
-
- // Renvoie le noeud fils suivant le numero a partir de 0
- Node get_child(const unsigned int& i) const
- {
- assert(i < _link->size());
- std::list<Node>::const_iterator child = _link->begin();
- for (unsigned int tmp = 0; tmp != i; ++tmp)
- ++child;
- return (*child);
- }
-
- // Numerotation de l'arbre suivant un parcours en largeur de 0 a n
- Node get_node_course_width(const int& ptr) const
- {
- int rptr = ptr;
- std::list<Node> ptr_node = *new std::list<Node>;
- ptr_node.push_back(*this);
- while (ptr_node.size())
- {
- std::list<Node>::iterator childs = ptr_node.begin();
- std::list<Node>::iterator child = childs->get_childs()->begin();
- for (; child != childs->get_childs()->end(); ++child)
- {
- ptr_node.push_back(*child);
- if (--rptr == 0)
- return (*child);
- }
- ptr_node.pop_front();
- }
- return (*this);
- }
-
-private:
-
- std::list<Node> *_link; // Pointeur vers le sous-arbre
- TYPENODE _data;
-};
-
-#endif // NODE_HH_
diff --git a/tags/START/glagen/algo_distribue/tree/tree.cc b/tags/START/glagen/algo_distribue/tree/tree.cc
deleted file mode 100644
index 047ca89..0000000
--- a/tags/START/glagen/algo_distribue/tree/tree.cc
+++ /dev/null
@@ -1,11 +0,0 @@
-//
-// tree.cc for in
-//
-// Made by meng-tih lam
-// Login <lam_m@epita.fr>
-//
-// Started on Fri Aug 16 02:45:56 2002 meng-tih lam
-// Last update Fri Aug 16 17:11:24 2002 meng-tih lam
-//
-
-#include "tree.hh"
diff --git a/tags/START/glagen/algo_distribue/tree/tree.hh b/tags/START/glagen/algo_distribue/tree/tree.hh
deleted file mode 100644
index 86ce136..0000000
--- a/tags/START/glagen/algo_distribue/tree/tree.hh
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-#ifndef TREE_HH_
-# define TREE_HH_
-
-#include <list>
-#include <assert.h>
-#include "node.hh"
-// Rajouter l'include correspondant a la template de TYPENODE
-// + implemente le std::cout abstrait pour les tests
-
-template<class TYPENODE> class Tree
-{
-public:
- // Construit la racine de l'arbre avec l'info dans son contenu
- Tree(const TYPENODE& value) : _root(new Node<TYPENODE>(value)) {}
-
- Tree(const Tree<TYPENODE>& value) : _root(value._root) {}
-
- // Ajoute un noeud fils (avec info) a l'arbre
- void add_node(const TYPENODE& value) { _root->add_child(value); }
-
- // Renvoie la racine de l'arbre de type Node
- Node<TYPENODE>& get_node_root() const { return (*_root); }
-
- // Ajoute un autre arbre a la racine de l'arbre courant
- void add_tree(const Tree &value)
- {
- _root->add_tree_node(value.get_node_root());
- }
-
- // Renvoie la liste de Node de ses fils
- std::list< Node<TYPENODE> >& get_childs() { return _root->get_childs(); }
-
- // Information du nombre de fils
- const unsigned int get_nb_childs() const
- {
- return (_root->get_nb_childs());
- }
-
- // Renvoie le noeud fils suivant le numero a partir de 0
- Node<TYPENODE> get_child(const unsigned int& i) const
- {
- return (_root->get_child(i));
- }
-
-private:
- Node<TYPENODE> *_root;
-};
-
-#endif // TREE_HH_