1 #ifndef __CMPH_BRZ_H__ 2 #define __CMPH_BRZ_H__ 3 4 #include "cmph.h" 5 6 typedef struct __brz_data_t brz_data_t; 7 typedef struct __brz_config_data_t brz_config_data_t; 8 9 brz_config_data_t *brz_config_new(void); 10 void brz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); 11 void brz_config_set_tmp_dir(cmph_config_t *mph, cmph_uint8 *tmp_dir); 12 void brz_config_set_mphf_fd(cmph_config_t *mph, FILE *mphf_fd); 13 void brz_config_set_b(cmph_config_t *mph, cmph_uint32 b); 14 void brz_config_set_algo(cmph_config_t *mph, CMPH_ALGO algo); 15 void brz_config_set_memory_availability(cmph_config_t *mph, cmph_uint32 memory_availability); 16 void brz_config_destroy(cmph_config_t *mph); 17 cmph_t *brz_new(cmph_config_t *mph, double c); 18 19 void brz_load(FILE *f, cmph_t *mphf); 20 int brz_dump(cmph_t *mphf, FILE *f); 21 void brz_destroy(cmph_t *mphf); 22 cmph_uint32 brz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen); 23 24 /** \fn void brz_pack(cmph_t *mphf, void *packed_mphf); 25 * \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf. 26 * \param mphf pointer to the resulting mphf 27 * \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() 28 */ 29 void brz_pack(cmph_t *mphf, void *packed_mphf); 30 31 /** \fn cmph_uint32 brz_packed_size(cmph_t *mphf); 32 * \brief Return the amount of space needed to pack mphf. 33 * \param mphf pointer to a mphf 34 * \return the size of the packed function or zero for failures 35 */ 36 cmph_uint32 brz_packed_size(cmph_t *mphf); 37 38 /** cmph_uint32 brz_search(void *packed_mphf, const char *key, cmph_uint32 keylen); 39 * \brief Use the packed mphf to do a search. 40 * \param packed_mphf pointer to the packed mphf 41 * \param key key to be hashed 42 * \param keylen key legth in bytes 43 * \return The mphf value 44 */ 45 cmph_uint32 brz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen); 46 47 #endif 48