#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Core/Container/Array/Array3dIter.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_ARRAY3DITER_HEADER #define RAVL_ARRAY3DITER_HEADER 1 /////////////////////////////////////////////////////////////////////// //! file="Ravl/Core/Container/Array/Array3dIter.hh" //! lib=RavlCore //! userlevel=Basic //! author="Charles Galambos" //! docentry="Ravl.Core.Arrays.3D" //! rcsid="$Id: Array3dIter.hh,v 1.3 2002/04/29 18:13:06 craftit Exp $" //! example=exArray2.cc //! date="24/08/1999" #include "Ravl/BfAcc3Iter.hh" #include "Ravl/Array3d.hh" namespace RavlN { template class Array3dC; //! userlevel=Normal //: Array1dC iterator. template class Array3dIterC : public BufferAccess3dIterC { public: Array3dIterC() {} //: Default constructor. Array3dIterC(const Array3dC &arr,const IndexRange3dC &rng) : dat(arr,rng) { First(); } //: Constructor. Array3dIterC(const Array3dC &arr) : dat(arr) { First(); } //: Constructor. inline bool First() { return BufferAccess3dIterC::First(dat,dat.Range2(),dat.Range3()); } //: Goto first element in the array. // Return TRUE if there actually is one. const Array3dIterC &operator=(const Array3dC &arr) { dat = arr; First(); return *this; } //: Assign to another array. Index3dC Index() const { RavlAssert(dat.IsValid()); Index2dC i2 = sit.Index(rit->ReferenceElm()); return Index3dC((IndexC) (&(*rit) - dat.ReferenceElm()), (IndexC) i2.Row(), (IndexC) i2.Col()); } //: Get index of current location. // Has to be calculate, and so is slightly slow. protected: Array3dC dat; }; } #endif