src/sn_hashtable.[ch]: Implement sn_hashtable_check_collision().
[sort-networks.git] / src / sn_hashtable.h
1 /**
2  * \file sn_hashtable.h
3  * \brief A hash table for counting the number of sort networks.
4  *
5  * This is more details about what this file does.
6  *
7  * \verbatim
8  * libsortnetwork - src/sn_hashtable.h
9  * Copyright (C) 2011  Florian octo Forster
10  *
11  * This library is free software; you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 2.1 of the License, or (at
14  * your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful, but WITHOUT
17  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
19  * for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this library; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24  *
25  * Authors:
26  *   Florian octo Forster <ff at octo.it>
27  * \endverbatim
28  **/
29
30 #ifndef SN_HASHTABLE_H
31 #define SN_HASHTABLE_H 1
32
33 #include <stdint.h>
34 #include <inttypes.h>
35
36 #include "sn_network.h"
37
38 struct sn_hashtable_s;
39 typedef struct sn_hashtable_s sn_hashtable_t;
40
41 sn_hashtable_t *sn_hashtable_create (void);
42 void sn_hashtable_destroy (sn_hashtable_t *ht);
43
44 int sn_hashtable_account (sn_hashtable_t *ht, const sn_network_t *n);
45 _Bool sn_hashtable_check_collision (sn_hashtable_t *ht, const sn_network_t *n);
46
47 uint64_t sn_hashtable_get_collisions (sn_hashtable_t *ht);
48 double   sn_hashtable_get_collisions_pct (sn_hashtable_t *ht);
49 uint64_t sn_hashtable_get_networks (sn_hashtable_t *ht);
50 double   sn_hashtable_get_networks_pct (sn_hashtable_t *ht);
51 uint64_t sn_hashtable_get_total (sn_hashtable_t *ht);
52
53 #endif /* SN_HASHTABLE_H */
54 /* vim: set sw=2 sts=2 et fdm=marker : */