(root)/
glib-2.79.0/
girepository/
cmph/
fch.h
       1  #ifndef __CMPH_FCH_H__
       2  #define __CMPH_FCH_H__
       3  
       4  #include "cmph.h"
       5  
       6  typedef struct __fch_data_t fch_data_t;
       7  typedef struct __fch_config_data_t fch_config_data_t;
       8  
       9  /* Parameters calculation */
      10  cmph_uint32 fch_calc_b(double c, cmph_uint32 m);
      11  double fch_calc_p1(cmph_uint32 m);
      12  double fch_calc_p2(cmph_uint32 b);
      13  cmph_uint32 mixh10h11h12(cmph_uint32 b, double p1, double p2, cmph_uint32 initial_index);
      14  
      15  fch_config_data_t *fch_config_new(void);
      16  void fch_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
      17  void fch_config_destroy(cmph_config_t *mph);
      18  cmph_t *fch_new(cmph_config_t *mph, double c);
      19  
      20  void fch_load(FILE *f, cmph_t *mphf);
      21  int fch_dump(cmph_t *mphf, FILE *f);
      22  void fch_destroy(cmph_t *mphf);
      23  cmph_uint32 fch_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
      24  
      25  /** \fn void fch_pack(cmph_t *mphf, void *packed_mphf);
      26   *  \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
      27   *  \param mphf pointer to the resulting mphf
      28   *  \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() 
      29   */
      30  void fch_pack(cmph_t *mphf, void *packed_mphf);
      31  
      32  /** \fn cmph_uint32 fch_packed_size(cmph_t *mphf);
      33   *  \brief Return the amount of space needed to pack mphf.
      34   *  \param mphf pointer to a mphf
      35   *  \return the size of the packed function or zero for failures
      36   */ 
      37  cmph_uint32 fch_packed_size(cmph_t *mphf);
      38  
      39  /** cmph_uint32 fch_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
      40   *  \brief Use the packed mphf to do a search. 
      41   *  \param  packed_mphf pointer to the packed mphf
      42   *  \param key key to be hashed
      43   *  \param keylen key legth in bytes
      44   *  \return The mphf value
      45   */
      46  cmph_uint32 fch_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
      47  
      48  #endif