Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

HashIterator Class Template Reference

The following class can be used to step through a hash table -- same interface as ListIterator. Example code: HashIterator<Key, T> iter(table); for (; !iter->IsDone(); iter->Next()) { Operation on iter->Item() }. More...

#include <hash.h>

List of all members.

Public Methods

 HashIterator (HashTable< Key, T > *table)
 initialize an iterator. More...

 ~HashIterator ()
bool IsDone ()
Item ()
void Next ()
 update iterator to point to next. More...


Private Attributes

HashTable<Key,T>* table
 the hash table we're stepping through. More...

int bucket
 current bucket we are in. More...

ListIterator<T>* bucketIter
 where we are in the bucket. More...


Detailed Description

template<class Key, class T> class HashIterator

The following class can be used to step through a hash table -- same interface as ListIterator. Example code: HashIterator<Key, T> iter(table); for (; !iter->IsDone(); iter->Next()) { Operation on iter->Item() }.

Definition at line 100 of file hash.h.


Constructor & Destructor Documentation

template<class Key, class T>
HashIterator<Key, T>::HashIterator<Key, T> ( HashTable< Key, T > * table )
 

initialize an iterator.

HashIterator<Key,T>::HashIterator Initialize a data structure to allow us to step through every entry in a has table.

Definition at line 332 of file hash.cc.

template<class Key, class T>
HashIterator<Key, T>::~HashIterator<Key, T> ( ) [inline]
 

Definition at line 103 of file hash.h.


Member Function Documentation

template<class Key, class T>
bool HashIterator<Key, T>::IsDone ( ) [inline]
 

Definition at line 106 of file hash.h.

Referenced by Item(), and HashTable::SelfTest().

template<class Key, class T>
T HashIterator<Key, T>::Item ( ) [inline]
 

Definition at line 108 of file hash.h.

template<class Key, class T>
void HashIterator<Key, T>::Next ( )
 

update iterator to point to next.

HashIterator<Key,T>::Next Update iterator to point to the next item in the table.

Definition at line 349 of file hash.cc.

Referenced by HashTable::SelfTest().


Member Data Documentation

template<class Key, class T>
int HashIterator<Key, T>::bucket [private]
 

current bucket we are in.

Definition at line 114 of file hash.h.

template<class Key, class T>
ListIterator< T > * HashIterator<Key, T>::bucketIter<T> [private]
 

where we are in the bucket.

Definition at line 115 of file hash.h.

template<class Key, class T>
HashTable< Key, T > * HashIterator<Key, T>::table<Key,T> [private]
 

the hash table we're stepping through.

Definition at line 113 of file hash.h.


The documentation for this class was generated from the following files:
Generated at Wed Jul 4 11:32:23 2001 for Nachos by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001