2004-12-23 15:16:30 +02:00
|
|
|
#ifndef __CMPH_H__
|
|
|
|
#define __CMPH_H__
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "cmph_types.h"
|
|
|
|
|
2005-01-21 22:42:33 +02:00
|
|
|
typedef struct __config_t cmph_config_t;
|
|
|
|
typedef struct __cmph_t cmph_t;
|
2004-12-23 15:16:30 +02:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void *data;
|
2005-01-18 23:06:08 +02:00
|
|
|
cmph_uint32 nkeys;
|
|
|
|
int (*read)(void *, char **, cmph_uint32 *);
|
|
|
|
void (*dispose)(void *, char *, cmph_uint32);
|
2004-12-23 15:16:30 +02:00
|
|
|
void (*rewind)(void *);
|
2005-01-18 23:06:08 +02:00
|
|
|
} cmph_key_source_t;
|
2004-12-23 15:16:30 +02:00
|
|
|
|
|
|
|
/** Hash generation API **/
|
2005-01-21 22:42:33 +02:00
|
|
|
cmph_config_t *cmph_config_new(cmph_key_source_t *key_source);
|
|
|
|
void cmph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
|
|
|
|
void cmph_config_set_verbosity(cmph_config_t *mph, cmph_uint32 verbosity);
|
|
|
|
void cmph_config_set_graphsize(cmph_config_t *mph, float c);
|
|
|
|
void cmph_config_set_algo(cmph_config_t *mph, CMPH_ALGO algo);
|
|
|
|
void cmph_config_destroy(cmph_config_t *mph);
|
|
|
|
cmph_t *cmph_new(cmph_config_t *mph);
|
2004-12-23 15:16:30 +02:00
|
|
|
|
|
|
|
/** Hash querying API **/
|
2005-01-21 22:42:33 +02:00
|
|
|
cmph_t *cmph_load(FILE *f);
|
|
|
|
int cmph_dump(cmph_t *mphf, FILE *f);
|
|
|
|
cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
|
|
|
cmph_uint32 cmph_size(cmph_t *mphf);
|
|
|
|
void cmph_destroy(cmph_t *mphf);
|
2004-12-23 15:16:30 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|