RPA Toolkit
85d59cd5ea9eed890557a9e4f6c3ecd6a9eae0ae
[rpatk.git] / rlib / rmap.c
1 #include "rmap.h"
2 #include "rstring.h"
3 #include "rmem.h"
4
5
6 typedef struct rmap_node_s {
7         rstr_t key;
8         rpointer value;
9         rlink_t active;
10         rlink_t hash;
11 } rmap_node_t;
12
13
14 robject_t *r_map_copy(const robject_t *obj)
15 {
16         return (robject_t*)NULL;
17 }
18
19
20 void r_map_cleanup(robject_t *obj)
21 {
22         rmap_t *map = (rmap_t*)obj;
23         r_carray_destroy(map->members);
24         r_hash_destroy(map->hash);
25         r_object_cleanup(&map->obj);
26 }
27
28
29 robject_t *r_map_init(robject_t *obj, ruint32 type, r_object_cleanupfun cleanup, r_object_copyfun copy, ruint elt_size)
30 {
31         rmap_t *map = (rmap_t*)obj;
32         r_object_init(obj, type, cleanup, copy);
33         map->hash = r_hash_create(5, r_hash_rstrequal, r_hash_rstrhash);
34         map->members = r_carray_create(elt_size);
35         r_list_init(&map->active);
36         r_list_init(&map->inactive);
37         return obj;
38 }
39
40 rmap_t *r_map_create(ruint elt_size)
41 {
42         return NULL;
43 }
44
45
46 void r_map_destroy(rmap_t *map)
47 {
48         r_object_destroy((robject_t*)map);
49 }
50