liba2ri  0.2
 All Data Structures
hashtable.h
1 /*************************************/
2 /* Auteur : Rémi Synave */
3 /* Date de création : 01/03/07 */
4 /* Date de modification : 08/01/10 */
5 /* Version : 0.2 */
6 /*************************************/
7 
8 /***************************************************************************/
9 /* This file is part of a2ri. */
10 /* */
11 /* a2ri is free software: you can redistribute it and/or modify it */
12 /* under the terms of the GNU Lesser General Public License as published */
13 /* by the Free Software Foundation, either version 3 of the License, or */
14 /* (at your option) any later version. */
15 /* */
16 /* a2ri is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public */
22 /* License along with a2ri. */
23 /* If not, see <http://www.gnu.org/licenses/>. */
24 /***************************************************************************/
25 
26 
27 
28 #ifndef HASHTABLE__H
29 #define HASHTABLE__H
30 
31 
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <math.h>
35 #include <string.h>
36 
37 
38 #include "edge.h"
39 #include "util.h"
40 
41 
43 {
44  struct mycontainer *next;
45  vf_edge *data;
46 };
47 
48 typedef struct mycontainer container;
49 
50 
51 typedef struct
52 {
53  int size_array;
54  int count;
55  container **list;
56 } hashtable;
57 
58 typedef void (
59  *ptf_foreach) (
60  int,
61  vf_edge *,
62  void *);
63 
64 
70 hashtable *hashtable_new (
71  int size);
72 
73 
79 void hashtable_free (
80  hashtable * table);
81 
82 
89 void hashtable_add (
90  hashtable * table,
91  vf_edge * e);
92 
93 
100 vf_edge *hashtable_look_for (
101  hashtable * table,
102  int ve1,
103  int ve2);
104 
105 
111 void hashtable_display (
112  hashtable * table);
113 
114 
120 int hashtable_size (
121  hashtable * table);
122 
123 
124 
132 void hashtable_foreach (
133  hashtable * table,
134  ptf_foreach func,
135  void *user_data);
136 
137 #endif