|
Revision 5, 430 bytes
(checked in by nick, 3 years ago)
|
|
|
| Line | |
|---|
| 1 | #ifndef _OHTBL_H_ |
|---|
| 2 | #define _OHTBL_H_ |
|---|
| 3 | |
|---|
| 4 | class OAHash |
|---|
| 5 | { |
|---|
| 6 | public: |
|---|
| 7 | int create(int p_positions); |
|---|
| 8 | |
|---|
| 9 | void destroy(void); |
|---|
| 10 | void *insert(char *key, void *data); |
|---|
| 11 | int remove(char *key); |
|---|
| 12 | void *lookup(char *key); |
|---|
| 13 | |
|---|
| 14 | unsigned int size; |
|---|
| 15 | |
|---|
| 16 | private: |
|---|
| 17 | int getNextPrime(int size); |
|---|
| 18 | int cmp(const void *a, const void *b); |
|---|
| 19 | |
|---|
| 20 | typedef struct |
|---|
| 21 | { |
|---|
| 22 | char *key; |
|---|
| 23 | void *data; |
|---|
| 24 | } ohEntry; |
|---|
| 25 | |
|---|
| 26 | unsigned int positions; |
|---|
| 27 | ohEntry *table; |
|---|
| 28 | char vacated; |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | #endif |
|---|