From 695965a636bddfbafa0e8b8c66bfd3e7efa5d440 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@0f7e0d06-a6f9-0310-a55f-d5f984f55e4c> Date: Thu, 10 Feb 2005 23:10:52 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'START'. git-svn-id: file:///usr/local/opt/svn/repos/glagen@6 0f7e0d06-a6f9-0310-a55f-d5f984f55e4c --- tags/START/glagen/algo_distribue/tree/tree.hh | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tags/START/glagen/algo_distribue/tree/tree.hh (limited to 'tags/START/glagen/algo_distribue/tree/tree.hh') diff --git a/tags/START/glagen/algo_distribue/tree/tree.hh b/tags/START/glagen/algo_distribue/tree/tree.hh new file mode 100644 index 0000000..86ce136 --- /dev/null +++ b/tags/START/glagen/algo_distribue/tree/tree.hh @@ -0,0 +1,51 @@ + + +#ifndef TREE_HH_ +# define TREE_HH_ + +#include +#include +#include "node.hh" +// Rajouter l'include correspondant a la template de TYPENODE +// + implemente le std::cout abstrait pour les tests + +template class Tree +{ +public: + // Construit la racine de l'arbre avec l'info dans son contenu + Tree(const TYPENODE& value) : _root(new Node(value)) {} + + Tree(const Tree& 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& 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 >& 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 get_child(const unsigned int& i) const + { + return (_root->get_child(i)); + } + +private: + Node *_root; +}; + +#endif // TREE_HH_ -- cgit v1.2.3