#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Core/Container/SArray/SArr3Iter.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_SARR3ITER_HEADER #define RAVL_SARR3ITER_HEADER 1 //////////////////////////////////////////////////////////// //! docentry="Ravl.Core.Arrays.3D" //! rcsid="$Id: SArr3Iter.hh,v 1.4 2002/05/21 14:46:11 craftit Exp $ //! file="Ravl/Core/Container/SArray/SArr3Iter.hh" //! lib=RavlCore //! author="Charles Galambos" //! date="10/09/1998" //! userlevel=Advanced #include "Ravl/SArray3d.hh" #include "Ravl/BfAcc3Iter.hh" #include "Ravl/Index3d.hh" namespace RavlN { //! userlevel=Advanced //: SArray3dC iterator. // Simple 3d array iterator. template class SArray3dIterC : public BufferAccess3dIterC { public: SArray3dIterC() {} //: Default constructor. SArray3dIterC(const SArray3dC &narr) : arr(narr) { First(); } //: Constructor. const SArray3dIterC &operator=(SArray3dC &narr) { arr = narr; First(); return *this; } //: Assignment to an array. inline void First() { BufferAccess3dIterC::First(arr,arr.Size2(),arr.Size3()); } //: Goto first element in array. Index3dC Index() const { RavlAssert(arr.IsValid()); Index2dC i2 = sit.Index(rit->ReferenceElm()); return Index3dC((IndexC) (&(*rit) - arr.ReferenceElm()), (IndexC) i2.Row(), (IndexC) i2.Col()); } //: Get index of current location. // Has to be calculate, and so is slightly slow. protected: SArray3dC arr; }; } #endif