diff --git a/APP_Framework/Applications/app_test/test_hash/test_hash.h b/APP_Framework/Applications/app_test/test_hash/test_hash.h new file mode 100644 index 000000000..a5caa0359 --- /dev/null +++ b/APP_Framework/Applications/app_test/test_hash/test_hash.h @@ -0,0 +1,37 @@ +#ifndef __HASHMAP_H__ +#define __HASHMAP_H__ + +#include +#include +#include + + +typedef struct entry { + void* key; + void* value; + struct entry* next; +} * Entry; + +typedef struct hashMap { + int size; + int listSize; + int (*hashCode)(void*); + int (*equal)(void*, void*); + Entry list; + void (*put)(struct hashMap*, void*, void*); + void* (*get)(struct hashMap*, void*); + void (*remove)(struct hashMap*, void*); + void (*clear)(struct hashMap*); + int (*exists)(struct hashMap*, void*); + int autoAssign; +} * HashMap; + +HashMap createHashMap(int listSize, int autoAssign); +void defaultPut(HashMap map, void* key, void* value); +void* defaultGet(HashMap map, void* key); +void defaultRemove(HashMap map, void* key); +void defaultClear(HashMap map); +int defaultExists(HashMap map, void* key); +void resetHashMap(HashMap map, int listSize); + +#endif // !__HASHMAP_H__ \ No newline at end of file