1 #ifndef __CMPH_BDZ_H__
2 #define __CMPH_BDZ_H__
3
4 #include "cmph.h"
5
6 typedef struct __bdz_data_t bdz_data_t;
7 typedef struct __bdz_config_data_t bdz_config_data_t;
8
9 bdz_config_data_t *bdz_config_new(void);
10 void bdz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
11 void bdz_config_destroy(cmph_config_t *mph);
12 void bdz_config_set_b(cmph_config_t *mph, cmph_uint32 b);
13 cmph_t *bdz_new(cmph_config_t *mph, double c);
14
15 void bdz_load(FILE *f, cmph_t *mphf);
16 int bdz_dump(cmph_t *mphf, FILE *f);
17 void bdz_destroy(cmph_t *mphf);
18 cmph_uint32 bdz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
19
20 /** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
21 * \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
22 * \param mphf pointer to the resulting mphf
23 * \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
24 */
25 void bdz_pack(cmph_t *mphf, void *packed_mphf);
26
27 /** \fn cmph_uint32 bdz_packed_size(cmph_t *mphf);
28 * \brief Return the amount of space needed to pack mphf.
29 * \param mphf pointer to a mphf
30 * \return the size of the packed function or zero for failures
31 */
32 cmph_uint32 bdz_packed_size(cmph_t *mphf);
33
34 /** cmph_uint32 bdz_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
35 * \brief Use the packed mphf to do a search.
36 * \param packed_mphf pointer to the packed mphf
37 * \param key key to be hashed
38 * \param keylen key legth in bytes
39 * \return The mphf value
40 */
41 cmph_uint32 bdz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
42
43 #endif