/*********************************************************************
 * This file is part of the cpplibs suite.
 *
 * Copyright (C) 2001 Topi Mäenpää
 * All rights reserved.
 *
 * This program is free software. You can redistribute and/or modify
 * it under the terms of the free software licence found in the
 * accompanying file "COPYING". The licence terms must always be
 * redistributed with this source file. The above copyright notice
 * must be reproduced in all modified and unmodified copies of this
 * source file.
 *
 * $Revision: 1.3 $
 *********************************************************************/

#ifndef _ITERATOR_H
#define _ITERATOR_H

#include "Object.h"

namespace util
{
	/**
	 * Iterator is an interface for all iterable object collections. An
	 * iterable collection may be represented as a list, hash table or
	 * whatever. The methods in this interface provide sequential acces
	 * to the data a collection contains.
	 **/
	template <class T> class Iterator : virtual public Object
	{
	public:
		/**
		 * Reset the iterator. Next call to next() returns the first
		 * object in a collection.
		 **/
		virtual void reset(void) = 0;
		/**
		 * Get the next object in a collection. The collection should
		 * maintain an internal counter for sequential access.
		 * @return the next item in a collection or NULL if there is no
		 *         more data
		 **/
		virtual T* next(void) = 0;
		/**
		 * Check whether the collection has more data to fetch. A call to
		 * next() should return new data until this method returns false.
		 **/
		virtual bool hasNext(void) const = 0;
	};
}

#endif
