summaryrefslogtreecommitdiff
path: root/girepository/cmph/bdz.h
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-11-11 15:01:07 -0500
committerColin Walters <walters@verbum.org>2010-12-03 16:03:31 -0500
commit3a94a5e36287072486831eb68bfe43a0e1c8ea78 (patch)
tree59eb83ba02a9acfd7032c2199d6e523e89efe418 /girepository/cmph/bdz.h
parentf6e5defff5a8d8ba83e0b414496d28b5e2361f39 (diff)
downloadgobject-introspection-3a94a5e36287072486831eb68bfe43a0e1c8ea78.tar.gz
Import CMPH 1.0
This will be used for typelib indexing. See README-CMPH-IMPORT.txt for more information.
Diffstat (limited to 'girepository/cmph/bdz.h')
-rwxr-xr-xgirepository/cmph/bdz.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/girepository/cmph/bdz.h b/girepository/cmph/bdz.h
new file mode 100755
index 00000000..f2b7b89c
--- /dev/null
+++ b/girepository/cmph/bdz.h
@@ -0,0 +1,43 @@
+#ifndef __CMPH_BDZ_H__
+#define __CMPH_BDZ_H__
+
+#include "cmph.h"
+
+typedef struct __bdz_data_t bdz_data_t;
+typedef struct __bdz_config_data_t bdz_config_data_t;
+
+bdz_config_data_t *bdz_config_new();
+void bdz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
+void bdz_config_destroy(cmph_config_t *mph);
+void bdz_config_set_b(cmph_config_t *mph, cmph_uint32 b);
+cmph_t *bdz_new(cmph_config_t *mph, double c);
+
+void bdz_load(FILE *f, cmph_t *mphf);
+int bdz_dump(cmph_t *mphf, FILE *f);
+void bdz_destroy(cmph_t *mphf);
+cmph_uint32 bdz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
+
+/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
+ * \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
+ * \param mphf pointer to the resulting mphf
+ * \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()
+ */
+void bdz_pack(cmph_t *mphf, void *packed_mphf);
+
+/** \fn cmph_uint32 bdz_packed_size(cmph_t *mphf);
+ * \brief Return the amount of space needed to pack mphf.
+ * \param mphf pointer to a mphf
+ * \return the size of the packed function or zero for failures
+ */
+cmph_uint32 bdz_packed_size(cmph_t *mphf);
+
+/** cmph_uint32 bdz_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
+ * \brief Use the packed mphf to do a search.
+ * \param packed_mphf pointer to the packed mphf
+ * \param key key to be hashed
+ * \param keylen key legth in bytes
+ * \return The mphf value
+ */
+cmph_uint32 bdz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
+
+#endif