/****************************************************************************
** GMAF - The Geometry Modeling Algorithms Framework
**
** Created : 04022000
**
** Copyright (C) 2000 by Le-Jeng Shiue.  All rights reserved.
**
****************************************************************************/
#ifndef gmafQuadIterator_H
#define gmafQuadIterator_H

#include "gmafQuadMap.h"
#include "gmafQuad.h"

/**
   It traverse the quad list of the quadmap.
*/
class gmafQuadIterator {
// ENUMS
public:

// VARIABLES
/**@name Class Variables */
//@{
protected:
  gmafQuadMap* mpQuadMap;
  vector<gmafQuad*>& mQuadList;
  vector<gmafQuad*>::iterator mCurItr;
private:

//@}

// METHODS
/**@name Class Methods */
//@{
public:
  /**
     Constructor of gmafQuadIterator
  */    
  gmafQuadIterator(gmafQuadMap* qm);
  /**
     Destructor of gmafQuadIterator
  */    
  virtual ~gmafQuadIterator();
  
  inline virtual int size() const;
  inline virtual void restart();
  inline virtual bool valid() const;
  inline virtual void next();
  inline virtual gmafQuad& current() const;
  
protected:
  
private:
};

//---------------------------------------------------------
inline gmafQuadIterator::gmafQuadIterator(gmafQuadMap* qm) 
  : mpQuadMap(qm), mQuadList(mpQuadMap->getQuadList()) {
  mCurItr = mQuadList.begin();
}

inline gmafQuadIterator::~gmafQuadIterator() {
}

inline int gmafQuadIterator::size() const {
  return mQuadList.size();
}

inline void gmafQuadIterator::restart() {
  mCurItr = mQuadList.begin();
}

inline bool gmafQuadIterator::valid() const {
  return (mCurItr != mQuadList.end());
}

inline void gmafQuadIterator::next() {
  mCurItr++;
}

inline gmafQuad& gmafQuadIterator::current() const {
  return *(*mCurItr);
}

#endif gmafQuadIterator_H

