summaryrefslogtreecommitdiff
path: root/NetWare/nwhashcls.h
blob: 55ff2002203674ba50e560bf19fc4eb8a134fc0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

/*
 * Copyright © 2001 Novell, Inc. All Rights Reserved.
 *
 * You may distribute under the terms of either the GNU General Public
 * License or the Artistic License, as specified in the README file.
 *
 */

/*
 * FILENAME     :  nwhashcls.h
 * DESCRIPTION  :  Equivalent of Hash class
 *                 
 * Author       :  Srivathsa M
 * Date	Created :  July 26 2001
 */
#include <stdio.h>
#include <conio.h>
#include <process.h>

#define BUCKET_SIZE 37

struct HASHNODE
{
	void *data;
	struct HASHNODE	*next;
};

typedef void (*HASHFORALLFUN)(void *, void *);

class NWPerlHashList
{
private:
	HASHNODE*	MemListHash[BUCKET_SIZE];
    void removeAll() const;

public:
	~NWPerlHashList();
	NWPerlHashList();
	int insert(void *lData);
	int remove(void *lData);
    void forAll( void (*)(void *, void*), void * ) const;
};

struct KEYHASHNODE
{
	void *key;
	void *data;
	KEYHASHNODE	*next;
};

/**
typedef void (*KEYHASHFORALLFUN)(void *, void *);

class NWPerlKeyHashList
{
private:
	KEYHASHNODE*	MemListHash[BUCKET_SIZE];
    void removeAll() const;

public:
	~NWPerlKeyHashList();
	NWPerlKeyHashList();
	int insert(void *key, void *lData);
	int remove(void *key);
    void forAll( void (*)(void *, void*), void * ) const;
	int find(void *key, void **pData);
};
**/

//#define DEBUG_HASH 1

#ifdef DEBUG_HASH
#define DEBUGPRINT	ConsolePrintf
#else
#define DEBUGPRINT
#endif