Go to Overview over all GrAL packages.
Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Gral/Grids/Complex2D/internal/vertex2d-it.h

Go to the documentation of this file.
00001 #ifndef NMWR_GB_VERTEX2D_ITERATOR_H
00002 #define NMWR_GB_VERTEX2D_ITERATOR_H
00003 
00004 
00005 
00006 // $LICENSE
00007 
00008 
00009 #include "Gral/Grids/Complex2D/complex2d.h"
00010 
00011 
00012 class Vertex2D_Iterator : public complex2d_types {
00013   friend class Complex2D;
00014   typedef Vertex2D_Iterator self;
00015 private:
00016   //----  DATA  ------
00017   vertex_handle    _pos;
00018   vertex_handle    _endpos;
00019   Complex2D const* _cc;
00020 
00021 public:
00022 
00023   //------  constructors ---------------
00024 
00025   Vertex2D_Iterator() : _pos(-1), _endpos(-1),  _cc(0)  {}
00026   explicit Vertex2D_Iterator(Complex2D const& CC)
00027     : _pos(0), _cc(&CC) { _endpos = CC.NumOfVertices(); }
00028   Vertex2D_Iterator(Complex const& CC, const vertex_handle& v)
00029     : _pos(v) , _cc(&CC) {  _endpos = CC.NumOfVertices(); }
00030 
00031   ~Vertex2D_Iterator() {}
00032 
00033   //------ iterator operations -----------------
00034 
00035   self& operator++()  {++_pos; return (*this);} 
00036   Vertex operator*() const { return Vertex2D(*_cc,_pos);}
00037   bool IsDone() const {return (_pos == _endpos);}
00038   operator bool() const { return !IsDone();}
00039 
00040   vertex_handle handle() const { return _pos;}
00041 
00042   //------------ comparision  -------------------
00043 
00044   friend bool operator==(const self& v, const self& w) {
00045     REQUIRE((v._cc == w._cc), "Grids don't match!\n",1);
00046     return (v._pos == w._pos);
00047   }
00048   friend bool operator!=(const self& lhs, const self& rhs)
00049     { return !(lhs == rhs);}
00050 
00051   friend bool operator<(const self& v, const self& w){
00052     REQUIRE((v._cc == w._cc), "Grids don't match!\n",1);
00053     return (v._pos < w._pos);
00054   }
00055 
00056   //-------------  anchor ------------------------
00057 
00058   const Complex2D& TheGrid() const { return (*_cc);}
00059 };
00060 
00061  
00062 #endif
00063 

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 16:06:45 2002 for GrAL Complex2D by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000