1
Fork 0
turbonss/src/cmph.h

46 lines
1.1 KiB
C
Raw Normal View History

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-18 23:06:08 +02:00
typedef struct cmph__mph_t cmph_mph_t;
typedef struct cmph__mphf_t cmph_mphf_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-18 23:06:08 +02:00
cmph_mph_t *cmph_mph_new(CMPH_ALGO algo, cmph_key_source_t *key_source);
void cmph_mph_set_hashfuncs(cmph_mph_t *mph, CMPH_HASH *hashfuncs);
void cmph_mph_set_verbosity(cmph_mph_t *mph, cmph_uint32 verbosity);
void cmph_mph_set_graphsize(cmph_mph_t *mph, float c);
void cmph_mph_destroy(cmph_mph_t *mph);
cmph_mphf_t *cmph_mph_create(cmph_mph_t *mph);
2004-12-23 15:16:30 +02:00
/** Hash querying API **/
2005-01-18 23:06:08 +02:00
cmph_mphf_t *cmph_mphf_load(FILE *f);
int cmph_mphf_dump(cmph_mphf_t *mphf, FILE *f);
cmph_uint32 cmph_mphf_search(cmph_mphf_t *mphf, const char *key, cmph_uint32 keylen);
cmph_uint32 cmph_mphf_size(cmph_mphf_t *mphf);
void cmph_mphf_destroy(cmph_mphf_t *mphf);
2004-12-23 15:16:30 +02:00
#ifdef __cplusplus
}
#endif
#endif