1 /***************************************************************************
3 * Copyright (C) Lakshya Solutions Ltd. All rights reserved. *
5 ***************************************************************************/
10 #include <ErrorType.h>
11 #define PAGEINFOSIZE 4
12 #define BLOCKINFOSIZE 4
14 class VarHeapAllocator
22 int newAllocateCounter
;
23 int reAllocateCounter
;
25 int deallocateCounter
;
28 void initializeInfo(void *ptr
);
29 void initSize(int size
);
42 void init(int size
, int pMode
=0);
43 void * allocate(int size
);
44 void deallocate(void *);
49 class FixedHeapAllocator
56 int newAllocateCounter
;
57 int reAllocateCounter
;
59 int deallocateCounter
;
63 void initializeInfo(void *ptr
);
75 void init(int pSize
,int allocSize
);
77 void deAllocate(void *ptr
);
85 HashMapNode() { elem
= NULL
; next
= NULL
; }
86 void print() { printf("elem:%x next %x\n", elem
, next
); }
95 HashMap(){ keySize
= 0; bucketSize
= 1009;
96 bucket
= (void**) ::malloc(bucketSize
* sizeof(void*));
97 memset(bucket
, 0, bucketSize
* sizeof(void*));
98 optGrpIntNoNull
= false;
100 ~HashMap() { ::free(bucket
); }
101 void setKeySize(int size
) { keySize
= size
; }
102 void setGrpIntNoNull(){ optGrpIntNoNull
= true; }
103 DbRetVal
insert(void *elem
);
104 void* find(void *elem
);
105 bool remove(void *elem
);