summaryrefslogtreecommitdiff
path: root/tags/START/glagen/algo_distribue/tree
diff options
context:
space:
mode:
Diffstat (limited to 'tags/START/glagen/algo_distribue/tree')
-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
6 files changed, 0 insertions, 295 deletions
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_