From c50bc6329ff6e336de47efa7b2275c77e85a75a1 Mon Sep 17 00:00:00 2001 From: hugues Date: Thu, 10 Feb 2005 23:10:51 +0000 Subject: Initial revision git-svn-id: file:///usr/local/opt/svn/repos/glagen@3 0f7e0d06-a6f9-0310-a55f-d5f984f55e4c --- trunk/glagen/algo_distribue/tree/tree.hh | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 trunk/glagen/algo_distribue/tree/tree.hh (limited to 'trunk/glagen/algo_distribue/tree/tree.hh') diff --git a/trunk/glagen/algo_distribue/tree/tree.hh b/trunk/glagen/algo_distribue/tree/tree.hh new file mode 100644 index 0000000..86ce136 --- /dev/null +++ b/trunk/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