forked from cp-profiler/cp-profiler-deprecated-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodecursor_base.hh
51 lines (46 loc) · 1.33 KB
/
nodecursor_base.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef NODECURSOR_BASE_HH
#define NODECURSOR_BASE_HH
class NodeAllocator;
/// \brief A cursor that can be run over a tree
template<class Node>
class NodeCursor {
private:
/// The node where the iteration starts
Node* _startNode;
/// The current node
Node* _node;
/// The current alternative
unsigned int _alternative;
protected:
/// The node allocator
const NodeAllocator& na;
/// Set current node to \a n
void node(Node* n);
/// Return start node
Node* startNode(void);
public:
/// Construct cursor, initially set to \a theNode
NodeCursor(Node* theNode, const NodeAllocator& na);
/// Return current node
Node* node(void);
/// Return current alternative
unsigned int alternative(void);
/// Set current alternative
void alternative(unsigned int a);
/// \name Cursor interface
//@{
/// Test if the cursor may move to the parent node
bool mayMoveUpwards(void);
/// Move cursor to the parent node
void moveUpwards(void);
/// Test if cursor may move to the first child node
bool mayMoveDownwards(void);
/// Move cursor to the first child node
void moveDownwards(void);
/// Test if cursor may move to the first sibling
bool mayMoveSidewards(void);
/// Move cursor to the first sibling
void moveSidewards(void);
//@}
};
#endif