]> git.donarmstrong.com Git - fastq-tools.git/blob - src/hash.h
Buffer size option.
[fastq-tools.git] / src / hash.h
1 /*
2  * This file is part of fastq-tools.
3  *
4  * Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu>
5  *
6  * hash :
7  * A quick and simple all-purpose hash table.
8  *
9  */
10
11
12 #ifndef FASTQ_TOOLS_HASH_H
13 #define FASTQ_TOOLS_HASH_H
14
15 #include <stdlib.h>
16 #include <stdint.h>
17
18
19 typedef struct hashed_value_
20 {
21     char*    value;
22     size_t   len;
23     uint32_t count;
24     struct hashed_value_* next;
25 } hashed_value;
26
27
28 typedef struct
29 {
30     hashed_value** A; /* table proper */
31     size_t n;         /* table size */
32     size_t m;         /* hashed items */
33     size_t max_m;     /* max hashed items before rehash */
34 } hash_table;
35
36
37 hash_table* create_hash_table();
38
39 void destroy_hash_table(hash_table*);
40
41 void inc_hash_table(hash_table*, const char* value, size_t len);
42
43 hashed_value** dump_hash_table(hash_table*);
44
45
46 #endif
47