LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
iterator.hxx
Go to the documentation of this file.
1
6
#ifndef TREE_ITERATOR_HXX
7
# define TREE_ITERATOR_HXX
8
9
# include <
tree/iterator.hh
>
10
# include <
misc/contract.hh
>
11
12
namespace
tree
13
{
14
15
inline
16
Iterator::Iterator
(
const
rTree& entry)
17
: entry_(entry)
18
{}
19
20
inline
void
21
Iterator::first
()
22
{
23
list_
.clear();
24
list_
.push_front(
entry_
);
25
}
26
27
inline
bool
28
Iterator::is_ok
()
const
29
{
30
return
!
list_
.empty();
31
}
32
33
inline
rTree
34
Iterator::tree_get
()
const
35
{
36
precondition
(
is_ok
());
37
return
list_
.front();
38
}
39
40
inline
void
41
Iterator::next
()
42
{
43
precondition
(
is_ok
());
44
45
rTree cur_tree =
list_
.front();
46
const
tree_list_type
& children = cur_tree->children_get();
47
list_
.pop_front();
48
49
// Push all the children of this tree onto the stack, leaving
50
// the leftmost child on the top.
51
for
(tree_list_type::const_reverse_iterator ichild = children.rbegin();
52
ichild != children.rend();
53
++ichild)
54
list_
.push_front(*ichild);
55
}
56
57
}
58
59
60
#endif // !TREE_ITERATOR_HXX
tree
iterator.hxx
Generated on Wed Mar 5 2014 15:47:37 for LRDE Tiger Compiler by
1.8.1.2