home *** CD-ROM | disk | FTP | other *** search
- #ifndef __HASH_H
- #define __HASH_H
- // ╔════════════════════════════════════════════════╗
- // ║ hash.h, hash.cpp ║
- // ╟────────────────────────────────────────────────╢
- // ║ Hash tables ║
- // ╟────────────────────────────────────────────────╢
- // ║ Written by Gus Smedstad ║
- // ╟────────────────────────────────────────────────╢
- // ║ Copyright 1990-91 NoGate Consulting ║
- // ╚════════════════════════════════════════════════╝
-
- #ifndef __DOUBLE_H
- #include "double.h"
- #endif
-
- class hash_table : public container {
- friend class hash_index;
- unsigned table_size;
- double_list **table;
- public:
- hash_table(int t_size);
- virtual ~hash_table();
- void empty(char kill = 0);
-
- void put(hashable *arg);
- hashable *remove(hashable *arg);
- int has(hashable *arg, int exact = 1);
- };
-
- class hash_index : public double_index {
- hash_table *table;
- unsigned hash_number;
- public:
- hash_index(hash_table & base);
- void attach(hash_table &base);
- void rewind();
- void to_end();
- int has(hashable *arg, int exact = 1);
- void destroy();
- hashable *remove();
- hashable *value() const { return (hashable *) item(); };
- void operator ++ ( int );
- void operator -- ( int );
- };
-
- #endif