#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Core/Container/Array/Array2dIter.hh" // This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here #ifndef RAVL_ARRAY2DITER_HEADER #define RAVL_ARRAY2DITER_HEADER 1 /////////////////////////////////////////////////////////////////////// //! file="Ravl/Core/Container/Array/Array2dIter.hh" //! lib=RavlCore //! userlevel=Basic //! author="Charles Galambos" //! docentry="Ravl.Core.Arrays.2D" //! rcsid="$Id: Array2dIter.hh,v 1.6 2002/05/21 14:46:10 craftit Exp $" //! example=exArray2.cc //! date="24/08/1999" #include "Ravl/BfAccIter.hh" #include "Ravl/Array2d.hh" #include "Ravl/Assert.hh" namespace RavlN { template class Array2dC; //! userlevel=Normal //: Array1dC iterator. template class Array2dIterC : public BufferAccess2dIterC { public: Array2dIterC() {} //: Default constructor. Array2dIterC(const Array2dC &arr,const IndexRange2dC &rng) : dat(arr,rng) { First(); } //: Constructor. Array2dIterC(const Array2dC &arr) : dat(arr) { First(); } //: Constructor. inline bool First() { return BufferAccess2dIterC::First(dat,dat.Range2()); } //: Goto first element in the array. // Return TRUE if there actually is one. const Array2dIterC &operator=(const Array2dC &arr) { dat = arr; First(); return *this; } //: Assign to another array. Index2dC Index() const { RavlAssert(dat.IsValid()); return BufferAccess2dIterC::Index(dat.ReferenceElm()); } //: Get index of current location. // Has to be calculate, and so is slightly slow. protected: Array2dC dat; }; } #endif