// $RCSfile: hash.h,v $
// $State: Exp $ 
// $Revision: 1.2 $
// $Author: roman $
// $Date: 90/07/20 03:24:57 $
#ifndef _hash_h 
#define _hash_h

//
//  hash.h
//
#define nil 0
#define Nelm 101                        // Hash table size (default)

typedef void* HashKey;
typedef void* HashData;

struct HashEntry {
	HashKey id;
	HashData dataptr;
    };

class HashTable {

    int nelement;                 // hash table size
    int cur_nelm;                 // keeps current element number
    int itr;
    
    HashEntry* HashTbl;

    int Hash(HashKey, int);
      
public:

    HashTable();                     // Constructor
    HashTable(int);                  // Constructor with table size
   ~HashTable();                     // Destructor
    void Enter(HashKey, HashData);
    void Enter(HashEntry*);
    HashData Find(HashKey);
    HashData Delete(HashKey);
    int CurElmNum();
    void Expand(int);
    HashEntry* GetTable(int&);
    void reset(){itr = 0;}
    HashEntry* next();
    HashData   dnext();

};
#endif
























