summaryrefslogtreecommitdiff
path: root/algo_distribue/tree/tree.hh
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 /algo_distribue/tree/tree.hh
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 'algo_distribue/tree/tree.hh')
-rw-r--r--algo_distribue/tree/tree.hh51
1 files changed, 51 insertions, 0 deletions
diff --git a/algo_distribue/tree/tree.hh b/algo_distribue/tree/tree.hh
new file mode 100644
index 0000000..86ce136
--- /dev/null
+++ b/algo_distribue/tree/tree.hh
@@ -0,0 +1,51 @@
+
+
+#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_