ALBA
albaVMEIterator.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaVMEIterator
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16#ifndef __albaVMEIterator_h
17#define __albaVMEIterator_h
18//----------------------------------------------------------------------------
19// includes :
20//----------------------------------------------------------------------------
21#include "albaObject.h"
22#include "albaVME.h"
23#include "albaVector.h"
25
26template class ALBA_EXPORT albaVector<albaID>;
27
39class ALBA_EXPORT albaVMEIterator : public albaObject
40{
41public:
43
45 albaVME * GetCurrentNode() {return m_CurrentNode;}
46
48 albaVME * GetFirstNode() {this->GoToFirstNode(); return (m_TraversalDone)?NULL:this->GetCurrentNode();}
50 albaVME * GetLastNode() {this->GoToLastNode(); return (m_TraversalDone)?NULL:this->GetCurrentNode();}
52 albaVME * GetNextNode() {this->GoToNextNode(); return (m_TraversalDone)?NULL:this->GetCurrentNode();}
54 albaVME * GetPreviousNode() {this->GoToPreviousNode(); return (m_TraversalDone)?NULL:this->GetCurrentNode();}
55
59 virtual bool IsVisible(albaVME *node) { return node->IsVisible();}
60
62 virtual void IgnoreVisibleToTraverse(bool ignore) {m_IgnoreVisibleToTraverse = ignore;};
63
67 void SetRootNode(albaVME *root);
68
73
77 int IsDoneWithTraversal() {return m_TraversalDone;}
78
80 virtual int GoToNextNode();
81
83 virtual int GoToPreviousNode();
84
86 virtual int GoToFirstNode();
87
89 virtual int GoToLastNode();
90
95 void SetTraversalMode(int mode);
96 int GetTraversalMode() { return m_TraversalMode;}
97
101 void SetTraversalModeToPreOrder() {this->SetTraversalMode(PreOrder);}
105 void SetTraversalModeToPostOrder() {this->SetTraversalMode(PostOrder);}
106
112 //void SetTraversalModeToInOrder() {this->SetTraversalMode(InOrder);}
113
114 enum traversalMode {PreOrder=0,PostOrder};
115
116protected:
117
120
123
126
132
134
135private:
136 albaVMEIterator(const albaVMEIterator&) {} // Not implemented
137 void operator=(const albaVMEIterator&) {} // Not implemented
138};
139
140#endif
Abstract superclass for all ALBA classes implementing RTTI APIs.
Definition: albaObject.h:38
albaVMEIterator - an m-way tree data structure iterator albaVMEIterator is a class to traverse a tree...
void SetTraversalModeToPostOrder()
Set the traverse modality to PostOrder: first the the subtrees left to right, then the root.
albaVME * m_CurrentNode
int IsDoneWithTraversal()
Check if the iterator is at the end of the container.
void SetTraversalMode(int mode)
Set/Get the traverse modality.
albaTypeMacro(albaVMEIterator, albaObject)
albaVector< albaID > m_CurrentIdx
virtual void IgnoreVisibleToTraverse(bool ignore)
Allow to ignore m_VisibleToTraverse flag for the iterator.
albaVME * GetNextNode()
Shortcut to traverse the tree.
void SetTraversalModeToPreOrder()
Set the traverse modality to PreOrder: first the root then the subtrees left to right.
virtual int GoToNextNode()
Increment the iterator to the next location.
virtual int GoToPreviousNode()
Decrement the iterator to the next location.
albaVME * FindLeftMostLeaf(albaVME *node)
Find the left most leaf of the tree.
albaVME * GetPreviousNode()
Shortcut to traverse the tree.
albaVME * m_RootNode
void SetRootNode(albaVME *root)
Set the root node of the (sub)tree to be traversed.
virtual int GoToLastNode()
Go to the last item of the list.
albaVME * FindRightMostLeaf(albaVME *node)
Find the right most leaf of the tree.
virtual bool IsVisible(albaVME *node)
Return true if the VME is visible.
bool m_IgnoreVisibleToTraverse
virtual ~albaVMEIterator()
albaVME * GetFirstNode()
Shortcut to traverse the tree.
traversalMode
Set the traverse modality to InOrder: first the the left subtrees (left to right),...
virtual int GoToFirstNode()
Go to the first item of the list.
albaVME * GetLastNode()
Shortcut to traverse the tree.
albaVME * GetCurrentNode()
Retrieve the current node pointer data from the iterator.
albaVMEIterator(albaVME *root=NULL)
void InitTraversal()
Initialize the traversal of the container.
albaVME -
Definition: albaVME.h:150
bool IsVisible()
Return true if visible to tree traversal.
Definition: albaVME.h:338
albaVector - vector container wrapping STL vectors.
Definition: albaVector.h:33