pruner  0.0-99
treeiterator_bones.hpp
1 #ifndef H_PRUNER
2 #include "typedefs.hpp"
3 #endif
4 
5 #ifndef H_PRUNER_TREEITERATOR_BONES
6 #define H_PRUNER_TREEITERATOR_BONES
7 
8 template <typename Data_Type>
9 class Tree;
10 
11 template <typename Data_Type = bool>
12 class TreeIterator {
13 
14 private:
15 
16  uint current_node;
17  uint pos_in_pruning_sequence;
18 
19  friend class Tree<Data_Type>;
20 public:
21 
22  Tree<Data_Type>* tree;
23 
24  ~TreeIterator() {};
25  TreeIterator() {};
27 
29  v_uint::const_iterator begin_off() const;
31  v_uint::const_iterator end_off() const;
32 
34  v_uint::const_iterator begin_par() const;
35 
37  v_uint::const_iterator end_par() const;
38 
40  int up();
41 
43  int down();
44 
45  int operator++();
46  int operator--();
47 
48  void top();
49  void bottom();
50 
52  uint id() const {return current_node;};
53 
55  int n_offspring() const;
56 
58  int n_parents() const;
59 
60  uint operator*() const {return current_node;};
61 
63  bool is_root() const;
64 
66  bool is_tip() const;
67 
68  uint front() const;
69  uint back() const;
70 
71 };
72 
73 
74 #endif
v_uint::const_iterator end_par() const
End of parents const_iterator on the current node.
Definition: treeiterator_meat.hpp:39
int down()
Sets the current_node to the previous value as specified in Tree::POSTORDER.
Definition: treeiterator_meat.hpp:62
v_uint::const_iterator begin_off() const
Begin of offpring const_iterator on the current node.
Definition: treeiterator_meat.hpp:18
bool is_root() const
Check whether the current node is root.
Definition: treeiterator_meat.hpp:104
int n_offspring() const
Return the number of offsprings the current node has.
Definition: treeiterator_meat.hpp:94
Tree class.
Definition: tree_bones.hpp:36
bool is_tip() const
Checks whether the current node is a tip (leaf) or not.
Definition: treeiterator_meat.hpp:109
int up()
Sets the current_node to the next value as specified in Tree::POSTORDER.
Definition: treeiterator_meat.hpp:49
Definition: treeiterator_bones.hpp:12
int n_parents() const
Return the number of parents the current node has.
Definition: treeiterator_meat.hpp:99
uint id() const
Returns the id (index) of the current node.
Definition: treeiterator_bones.hpp:52
v_uint::const_iterator end_off() const
End of offpring const_iterator on the current node.
Definition: treeiterator_meat.hpp:25
v_uint::const_iterator begin_par() const
Begin of parents const_iterator on the current node.
Definition: treeiterator_meat.hpp:32