TacOS  0.2
 Tout Structures de données Fichiers Fonctions Variables Définitions de type Énumérations Macros
hashmap.h
Aller à la documentation de ce fichier.
1 
29 #ifndef _HASHMAP_H
30 #define _HASHMAP_H
31 
32 // Types incomplets, juste pour y voir plus clair.
33 struct hashmap_key_t;
34 struct hashmap_value_t;
35 
41  struct hashmap_key_t *key;
42  struct hashmap_value_t *value;
43  struct hashmap_cell_t *next;
44 };
45 
49 typedef struct __hashmap_t {
50  int size;
51  struct hashmap_cell_t** table;
52  int (*equal)(struct hashmap_key_t*, struct hashmap_key_t*);
53  int (*hash)(struct hashmap_key_t*);
54 } hashmap_t;
55 
66 hashmap_t* hashmap_create(int size, int (*equal)(struct hashmap_key_t*, struct hashmap_key_t*), int (*hash)(struct hashmap_key_t*));
67 
75 void hashmap_set(hashmap_t* this, struct hashmap_key_t* key, struct hashmap_value_t* value);
76 
85 struct hashmap_value_t* hashmap_remove(hashmap_t* this, struct hashmap_key_t *key);
86 
95 struct hashmap_value_t* hashmap_get(hashmap_t* this, struct hashmap_key_t *key);
96 
97 #endif
struct hashmap_cell_t ** table
Definition: hashmap.h:51
Definition: hashmap.h:49
struct hashmap_value_t * hashmap_get(hashmap_t *this, struct hashmap_key_t *key)
Definition: hashmap.c:84
struct hashmap_value_t * hashmap_remove(hashmap_t *this, struct hashmap_key_t *key)
Definition: hashmap.c:62
int size
Definition: hashmap.h:50
struct __hashmap_t hashmap_t
int(* equal)(struct hashmap_key_t *, struct hashmap_key_t *)
Definition: hashmap.h:52
hashmap_t * hashmap_create(int size, int(*equal)(struct hashmap_key_t *, struct hashmap_key_t *), int(*hash)(struct hashmap_key_t *))
Definition: hashmap.c:32
struct hashmap_key_t * key
Definition: hashmap.h:41
int(* hash)(struct hashmap_key_t *)
Definition: hashmap.h:53
void hashmap_set(hashmap_t *this, struct hashmap_key_t *key, struct hashmap_value_t *value)
Definition: hashmap.c:45
Definition: hashmap.h:40
struct hashmap_value_t * value
Definition: hashmap.h:42
struct hashmap_cell_t * next
Definition: hashmap.h:43