1 /*
2  *  PHash.h
3  *  CuckooHashTable
4  *
5  *  Created by Steve Dekorte on 2009 04 28.
6  *  Copyright 2009 __MyCompanyName__. All rights reserved.
7  *
8  */
9 
10 #ifndef PHASH_DEFINED
11 #define PHASH_DEFINED 1
12 
13 #include "Common.h"
14 #include <stddef.h>
15 #include "IoVMApi.h"
16 #include "PortableStdint.h"
17 
18 /*
19 #define BASEKIT_API
20 #define io_calloc calloc
21 #define io_free free
22 #define io_malloc malloc
23 #define IOINLINE
24 */
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define PHASH_MAXLOOP 10
31 
32 #include "PHash_struct.h"
33 
34 PHash *PHash_new(void);
35 void PHash_copy_(PHash *self, const PHash *other);
36 PHash *PHash_clone(PHash *self);
37 void PHash_free(PHash *self);
38 
39 //void PHash_at_put_(PHash *self, void *k, void *v);
40 void PHash_removeKey_(PHash *self, void *k);
41 IOVM_API size_t PHash_size(PHash *self); // actually the keyCount
42 
43 size_t PHash_memorySize(PHash *self);
44 void PHash_compact(PHash *self);
45 
46 // --- private methods ----------------------------------------
47 
48 IOVM_API void PHash_setSize_(PHash *self, size_t size);
49 IOVM_API void PHash_insert_(PHash *self, PHashRecord *x);
50 IOVM_API void PHash_grow(PHash *self);
51 //void PHash_shrinkIfNeeded(PHash *self);
52 IOVM_API void PHash_shrink(PHash *self);
53 IOVM_API void PHash_show(PHash *self);
54 IOVM_API void PHash_updateMask(PHash *self);
55 
56 #include "PHash_inline.h"
57 
58 #define PHash_cleanSlots(self)
59 #define PHash_hasDirtyKey_(self, k) 0
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 #endif
65