#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Core/System/DArray1dIter3.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_DARRAY1DITER3_HEADER #define RAVL_DARRAY1DITER3_HEADER 1 //! docentry="Ravl.Core.Misc" //! lib=RavlCore //! author="Charles Galambos" //! rcsid="$Id: DArray1dIter3.hh,v 1.4 2002/05/07 16:48:20 craftit Exp $" //! file="Ravl/Core/System/DArray1dIter3.hh" #include "Ravl/DArray1dIter2.hh" namespace RavlN { //! userlevel=Normal //: Dynamic array iterator. // This iterator does not use the position index's of the arrays, // it will go though each array in order the elements appear. template class DArray1dIter3C : public DArray1dIter2C { public: DArray1dIter3C() {} //: Default constructor. DArray1dIter3C(const DArray1dC &narr1,const DArray1dC &narr2,const DArray1dC &narr3) : DArray1dIter2C(narr1,narr2), it3(narr3) { First(); } //: Constructor. bool First() { if(!it1.First()) return false; if(it2.First() && it3.First()) return true; it1.Invalidate(); return false; } //: Goto first element in the array. // Returns true if iterator is at a valid element after operation. Data3T &Data3() { return it3.Data(); } //: Access data. const Data3T &Data3() const { return it3.Data(); } //: Access data. inline bool Next(); //: Goto next element. // Returns true if iterator is at a valid element after operation. void operator++(int) { Next(); } //: Goto next element. IndexC Index() { return it1.Index(); } //: Get index of current element. protected: DArray1dIterC it3; }; template inline bool DArray1dIter3C::Next() { if(!it1.Next()) return false; if(it2.Next() && it3.Next()) return true; it1.Invalidate(); return false; } } #endif