1*0Sstevel@tonic-gate // Copyright (c) 1994 James Clark 2*0Sstevel@tonic-gate // See the file COPYING for copying permission. 3*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gate #ifndef ISetIter_INCLUDED 6*0Sstevel@tonic-gate #define ISetIter_INCLUDED 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gate #include <stddef.h> 9*0Sstevel@tonic-gate #include "ISet.h" 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate #ifdef SP_NAMESPACE 12*0Sstevel@tonic-gate namespace SP_NAMESPACE { 13*0Sstevel@tonic-gate #endif 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate template<class T> 16*0Sstevel@tonic-gate class ISetIter { 17*0Sstevel@tonic-gate public: ISetIter(const ISet<T> & s)18*0Sstevel@tonic-gate ISetIter(const ISet<T> &s) : p_(&s), i_(0) { } 19*0Sstevel@tonic-gate // min and max are not changed if 0 is returned. next(T & min,T & max)20*0Sstevel@tonic-gate int next(T &min, T &max) 21*0Sstevel@tonic-gate { 22*0Sstevel@tonic-gate if (i_ < p_->r_.size()) { 23*0Sstevel@tonic-gate min = p_->r_[i_].min; 24*0Sstevel@tonic-gate max = p_->r_[i_].max; 25*0Sstevel@tonic-gate i_++; 26*0Sstevel@tonic-gate return 1; 27*0Sstevel@tonic-gate } 28*0Sstevel@tonic-gate else 29*0Sstevel@tonic-gate return 0; 30*0Sstevel@tonic-gate } 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate private: 33*0Sstevel@tonic-gate const ISet<T> *p_; 34*0Sstevel@tonic-gate size_t i_; 35*0Sstevel@tonic-gate }; 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #ifdef SP_NAMESPACE 38*0Sstevel@tonic-gate } 39*0Sstevel@tonic-gate #endif 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #endif /* ISetIter_INCLUDED */ 42