#ifndef __HASH_H #define __HASH_H #define STR_LEN 100 #include #include "arrays.h" #include "tll.h" //#define DBG class HashItem { public: HashItem(void) {strcpy(str, ""); value = 0;} HashItem(char *s, int v); void Set(char *s, int v); int operator == (const HashItem &h_item) {return !strcmp(str, h_item.str);} friend ostream &operator<<(ostream &s, HashItem &h_item) { s< > data; unsigned HashFunc(char *str); }; // these store ints, not strings class HashItemInt { public: HashItemInt(void) {key = 0; value = 0;} HashItemInt(int k, int v) {key = k; value = v;} // the copy constructor HashItemInt(const HashItemInt &h_item) {key = h_item.key; value = h_item.value;} void Set(int k, int v) {key = k; value = v;} int operator == (const HashItemInt &h_item) {return ((key == h_item.key) ? 1 : 0);} HashItemInt &operator = (const HashItemInt &h_item); friend ostream &operator<<(ostream &s, HashItemInt &h_item) { s< &h_array, int &num_items); // puts it into a linear array int ExtToInt(int key, int next_value); private: Array > data; unsigned HashFunc(int key); }; #endif