| 1 |
#ifndef __CMPH_BMZ8_H__ |
| 2 |
#define __CMPH_BMZ8_H__ |
| 3 |
|
| 4 |
#include "cmph.h" |
| 5 |
|
| 6 |
typedef struct __bmz8_data_t bmz8_data_t; |
| 7 |
typedef struct __bmz8_config_data_t bmz8_config_data_t; |
| 8 |
|
| 9 |
bmz8_config_data_t *bmz8_config_new(void); |
| 10 |
void bmz8_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); |
| 11 |
void bmz8_config_destroy(cmph_config_t *mph); |
| 12 |
cmph_t *bmz8_new(cmph_config_t *mph, double c); |
| 13 |
|
| 14 |
void bmz8_load(FILE *f, cmph_t *mphf); |
| 15 |
int bmz8_dump(cmph_t *mphf, FILE *f); |
| 16 |
void bmz8_destroy(cmph_t *mphf); |
| 17 |
cmph_uint8 bmz8_search(cmph_t *mphf, const char *key, cmph_uint32 keylen); |
| 18 |
|
| 19 |
/** \fn void bmz8_pack(cmph_t *mphf, void *packed_mphf); |
| 20 |
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf. |
| 21 |
* \param mphf pointer to the resulting mphf |
| 22 |
* \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() |
| 23 |
*/ |
| 24 |
void bmz8_pack(cmph_t *mphf, void *packed_mphf); |
| 25 |
|
| 26 |
/** \fn cmph_uint32 bmz8_packed_size(cmph_t *mphf); |
| 27 |
* \brief Return the amount of space needed to pack mphf. |
| 28 |
* \param mphf pointer to a mphf |
| 29 |
* \return the size of the packed function or zero for failures |
| 30 |
*/ |
| 31 |
cmph_uint32 bmz8_packed_size(cmph_t *mphf); |
| 32 |
|
| 33 |
/** cmph_uint8 bmz8_search(void *packed_mphf, const char *key, cmph_uint32 keylen); |
| 34 |
* \brief Use the packed mphf to do a search. |
| 35 |
* \param packed_mphf pointer to the packed mphf |
| 36 |
* \param key key to be hashed |
| 37 |
* \param keylen key legth in bytes |
| 38 |
* \return The mphf value |
| 39 |
*/ |
| 40 |
cmph_uint8 bmz8_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen); |
| 41 |
|
| 42 |
#endif |