blob: c5bd0a465c50a6650e6ac31c909b6b3d73452ac7 (
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
|
Generic C Hash Map for Embedded Systems
====================================
This library is an implementation of a hash map in C that maps integers to void
pointers. The map is initialized with a fixed size and load factor, and memory
is allocated on the heap all at once. There are no dependencies besides the BSD
queue.h, which is included in most systems by default.
## Compiling
$ make
## Test Suite
**Dependencies**
* check
This library has a test suite built with the `check` C library. Run the tests
like so:
$ make test
## Examples
#include "emhashmap.h"
#define MAX_CAPACITY 64
HashMap map = emhashmap_create(64);
int key = 42;
char* value = "foo";
emhashmap_put(&map, key, (void*)value);
bool contains = emhashmap_contains(list, key);
// contains == true
int size = emhashmap_size(&map);
// size == 1
emhashmap_remove(&map, key);
emhashmap_is_empty(&map);
// == true
emhashmap_destroy(&map);
## License
This library is licensed under the BSD license and is Copyright 2014,
Ford Motor Company
## Contributors
* Chris Peplin, cpeplin@ford.com
|