1 #ifndef __CPEXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__H__
2 #define __CPEXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__H__
6 // -------------------------------------------------------------------------
7 #define cpPluginsQEIteratorsMacro( op, it, cit ) \
8 inline it Begin##op( ) \
9 { return( it( this, it::Op##op, true ) ); } \
10 inline it End##op( ) \
11 { return( it( this, it::Op##op, false ) ); } \
12 inline cit Begin##op( ) const \
13 { return( cit( this, cit::Op##op, true ) ); } \
14 inline cit End##op( ) const \
15 { return( cit( this, cit::Op##op, false ) ); }
17 // -------------------------------------------------------------------------
18 #define cpPluginsExtensionsQEPointIteratorsMacro( op, it, cit ) \
19 inline Point##it BeginPoint##op( ) \
20 { return( Point##it( this, it::Op##op, true ) ); } \
21 inline Point##it EndPoint##op( ) \
22 { return( Point##it( this, it::Op##op, false ) ); } \
23 inline Point##cit BeginPoint##op( ) const \
24 { return( Point##cit( this, cit::Op##op, true ) ); } \
25 inline Point##cit EndPoint ##op( ) const \
26 { return( Point##cit( this, cit::Op##op, false ) ); }
28 // -------------------------------------------------------------------------
29 #define cpPluginsExtensionsQEAllIteratorsMacro( op ) \
30 cpPluginsQEIteratorsMacro( op, Iterator, ConstIterator ); \
31 cpPluginsExtensionsQEPointIteratorsMacro( op, Iterator, ConstIterator );
33 namespace cpExtensions
35 namespace DataStructures
40 class QuadEdgeBaseIterator
43 typedef QuadEdgeBaseIterator Self;
46 // Different types of logical iterators
60 QuadEdgeBaseIterator( E* e, int op = OpOnext, bool start = true );
61 virtual ~QuadEdgeBaseIterator( );
62 Self& operator=( const Self& r );
64 E* GetStartEdge( ) const;
65 E* GetIterator( ) const;
66 int GetOpType( ) const;
67 bool GetStart( ) const;
69 bool operator==( Self& r );
70 bool operator==( const Self& r ) const;
71 bool operator!=( Self& r );
72 bool operator!=( const Self& r ) const;
74 Self& operator++( int );
77 /// Method that should do all the iteration work
78 virtual void _GoToNext( );
81 E* m_StartEdge; /**< Start edge */
82 E* m_Iterator; /**< Current iteration position */
83 int m_OpType; /**< Operation type */
84 bool m_Start; /**< Indicates iteration has just started */
90 class QuadEdgeIterator
91 : public QuadEdgeBaseIterator< E >
94 typedef QuadEdgeIterator Self;
95 typedef QuadEdgeBaseIterator< E > Superclass;
100 E* e = NULL, int op = Superclass::OpOnext, bool start = true
102 virtual ~QuadEdgeIterator( );
109 class QuadEdgeConstIterator
110 : public QuadEdgeBaseIterator< const E >
113 typedef QuadEdgeConstIterator Self;
114 typedef QuadEdgeBaseIterator< const E > Superclass;
118 QuadEdgeConstIterator(
119 const E* e = NULL, int op = Superclass::OpOnext, bool start = true
121 virtual ~QuadEdgeConstIterator( );
122 const E* operator*( ) const;
128 class QuadEdgePointIterator
129 : public QuadEdgeBaseIterator< const E >
132 typedef QuadEdgePointIterator Self;
133 typedef QuadEdgeBaseIterator< const E > Superclass;
137 QuadEdgePointIterator(
138 const E* e = NULL, int op = Superclass::OpOnext, bool start = true
140 virtual ~QuadEdgePointIterator( );
141 typename E::TPrimalGeometry& operator*( );
147 class QuadEdgePointConstIterator
148 : public QuadEdgeBaseIterator< const E >
151 typedef QuadEdgePointConstIterator Self;
152 typedef QuadEdgeBaseIterator< const E > Superclass;
156 QuadEdgePointConstIterator(
157 const E* e = NULL, int op = Superclass::OpOnext, bool start = true
159 virtual ~QuadEdgePointConstIterator( );
160 const typename E::TPrimalGeometry& operator*( ) const;
167 #ifndef ITK_MANUAL_INSTANTIATION
168 #include <cpExtensions/DataStructures/QuadEdgeIterators.hxx>
169 #endif // ITK_MANUAL_INSTANTIATION
171 #endif // __CPEXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__H__