![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
TableH.hGo to the documentation of this file.00001 00018 #include "TableException.h" 00019 #include "ChainNode.h" 00020 00021 typedef KeyedItem TableItemType; 00022 00028 class HashTable 00029 { 00030 public: 00031 // constructors and destructor: 00032 HashTable(); 00033 HashTable(const HashTable& table); 00034 virtual ~HashTable(); 00035 00036 // table operations: 00037 virtual bool tableIsEmpty() const; 00038 virtual int tableGetLength() const; 00039 virtual void tableInsert(const TableItemType& newItem) 00040 throw(TableException); 00041 virtual void tableDelete(KeyType searchKey) 00042 throw(TableException); 00043 virtual void tableRetrieve(KeyType searchKey, 00044 TableItemType& tableItem) const 00045 throw(TableException); 00046 00047 protected: 00049 int hashIndex(KeyType searchKey) const; 00050 00051 private: 00053 static const int HASH_TABLE_SIZE = 101; 00054 typedef ChainNode * HashTableType[HASH_TABLE_SIZE]; 00055 00057 HashTableType table; 00059 int size; 00060 }; // end HashTable 00061 // End of header file. |