For use with CMSC-341, Spring 99, Project 2 Here is the definition of the Iterator class. Copy it to your Iterator.H file. Remember: -- implement the inline method(s) -- guard the file -- complete the documentation ------------------------------------------------ /* Generic iterator over collections. The base class for all iterators. Author: Thomas Anastasio Version: 6 February 1999 */ template class Iterator { private: // Traversal order. See IteratorConstants class int _direction; protected: // Mutator for direction (traversal order) // Each subclass defines a default if dir is not // one of the constants in IteratorConstants class inline void SetDirection(int dir); public: // Test for exhaustion of the iterator. // Return: true if there are more elements available virtual bool HasNext() = 0; // Accessor for the next element // Return: the next available element and advance // the iteration. // Precondition: It is an error to call this method when there // is no next element (i.e. when HasNext() is false) virtual T Next() = 0; // Accessor for the traversal order // Return: the traversal order. Will be one of the // constants from IteratorConstants class inline int GetDirection(); }; // Output operator for iterators. // Writes, to os, the elements of the underlying collection // of iter as a comma separated list. // Param: os the output stream to which to write // Param: iter is a pointer to the Iterator to be output // Returns: os template ostream& operator<< (ostream & os, Iterator * iter);