#ifndef __CPM__DATASTRUCTURES__QUADEDGEITERATORS__H__ #define __CPM__DATASTRUCTURES__QUADEDGEITERATORS__H__ #include // ------------------------------------------------------------------------- #define cpmDataStructuresQEIteratorsMacro( op, it, cit ) \ inline it Begin##op( ) \ { return( it( this, it::Op##op, true ) ); } \ inline it End##op( ) \ { return( it( this, it::Op##op, false ) ); } \ inline cit Begin##op( ) const \ { return( cit( this, cit::Op##op, true ) ); } \ inline cit End##op( ) const \ { return( cit( this, cit::Op##op, false ) ); } // ------------------------------------------------------------------------- #define cpmDataStructuresQEPointIteratorsMacro( op, it, cit ) \ inline Point##it BeginPoint##op( ) \ { return( Point##it( this, it::Op##op, true ) ); } \ inline Point##it EndPoint##op( ) \ { return( Point##it( this, it::Op##op, false ) ); } \ inline Point##cit BeginPoint##op( ) const \ { return( Point##cit( this, cit::Op##op, true ) ); } \ inline Point##cit EndPoint ##op( ) const \ { return( Point##cit( this, cit::Op##op, false ) ); } // ------------------------------------------------------------------------- #define cpmDataStructuresQEAllIteratorsMacro( op ) \ cpmDataStructuresQEIteratorsMacro( op, Iterator, ConstIterator ); \ cpmDataStructuresQEPointIteratorsMacro( op, Iterator, ConstIterator ); namespace cpm { namespace DataStructures { /** */ template< class E > class QuadEdgeBaseIterator { public: typedef QuadEdgeBaseIterator Self; typedef E TQuadEdge; // Different types of logical iterators enum { OpOnext = 0, OpLnext = 1, OpRnext = 2, OpDnext = 3, OpOprev = 4, OpLprev = 5, OpRprev = 6, OpDprev = 7 }; public: QuadEdgeBaseIterator( E* e, int op = OpOnext, bool start = true ); virtual ~QuadEdgeBaseIterator( ); Self& operator=( const Self& r ); E* GetStartEdge( ) const; E* GetIterator( ) const; int GetOpType( ) const; bool GetStart( ) const; bool operator==( Self& r ); bool operator==( const Self& r ) const; bool operator!=( Self& r ); bool operator!=( const Self& r ) const; Self& operator++( ); Self& operator++( int ); protected: /// Method that should do all the iteration work virtual void _GoToNext( ); protected: E* m_StartEdge; /**< Start edge */ E* m_Iterator; /**< Current iteration position */ int m_OpType; /**< Operation type */ bool m_Start; /**< Indicates iteration has just started */ }; /** */ template< class E > class QuadEdgeIterator : public QuadEdgeBaseIterator< E > { public: typedef QuadEdgeIterator Self; typedef QuadEdgeBaseIterator< E > Superclass; typedef E TQuadEdge; public: QuadEdgeIterator( E* e = NULL, int op = Superclass::OpOnext, bool start = true ); virtual ~QuadEdgeIterator( ); E* operator*( ); }; /** */ template< class E > class QuadEdgeConstIterator : public QuadEdgeBaseIterator< const E > { public: typedef QuadEdgeConstIterator Self; typedef QuadEdgeBaseIterator< const E > Superclass; typedef E TQuadEdge; public: QuadEdgeConstIterator( const E* e = NULL, int op = Superclass::OpOnext, bool start = true ); virtual ~QuadEdgeConstIterator( ); const E* operator*( ) const; }; /** */ template< class E > class QuadEdgePointIterator : public QuadEdgeBaseIterator< const E > { public: typedef QuadEdgePointIterator Self; typedef QuadEdgeBaseIterator< const E > Superclass; typedef E TQuadEdge; public: QuadEdgePointIterator( const E* e = NULL, int op = Superclass::OpOnext, bool start = true ); virtual ~QuadEdgePointIterator( ); typename E::TPrimalGeometry& operator*( ); }; /** */ template< class E > class QuadEdgePointConstIterator : public QuadEdgeBaseIterator< const E > { public: typedef QuadEdgePointConstIterator Self; typedef QuadEdgeBaseIterator< const E > Superclass; typedef E TQuadEdge; public: QuadEdgePointConstIterator( const E* e = NULL, int op = Superclass::OpOnext, bool start = true ); virtual ~QuadEdgePointConstIterator( ); const typename E::TPrimalGeometry& operator*( ) const; }; } // ecapseman } // ecapseman #include #endif // __CPM__DATASTRUCTURES__QUADEDGEITERATORS__H__ // eof - $RCSfile$