00001 #ifndef QT_HASH_H
00002 #define QT_HASH_H
00003
00004 #ifdef HAVE_CONFIG_H
00005 # include "config.h"
00006 #endif
00007 #ifdef HAVE_CPROPS
00008 # include <cprops/hashlist.h>
00009 #endif
00010
00011 #include <stddef.h>
00012 #include <stdint.h>
00013
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017
00018 typedef const void *qt_key_t;
00019 #ifndef HAVE_CPROPS
00020 typedef struct qt_hash_s *qt_hash;
00021 typedef void (*qt_hash_callback_fn)(const qt_key_t, void *, void *);
00022 #else
00023 typedef cp_hashlist *qt_hash;
00024 typedef int (*qt_hash_callback_fn)(void *, void *, void *);
00025 #endif
00026 typedef void (*qt_hash_deallocator_fn)(void*);
00027
00028 qt_hash qt_hash_create(int needSync);
00029 void qt_hash_destroy(qt_hash h);
00030 void qt_hash_destroy_deallocate(qt_hash h, qt_hash_deallocator_fn f);
00031 void *qt_hash_put(qt_hash h, const qt_key_t key, void *value);
00032 void *qt_hash_put_locked(qt_hash h, const qt_key_t key, void *value);
00033 void *qt_hash_remove(qt_hash h, const qt_key_t key);
00034 void *qt_hash_remove_locked(qt_hash h, const qt_key_t key);
00035 void *qt_hash_get(qt_hash h, const qt_key_t key);
00036 void *qt_hash_get_locked(qt_hash h, const qt_key_t key);
00037 size_t qt_hash_count(qt_hash h);
00038 void qt_hash_callback(qt_hash h, qt_hash_callback_fn f, void *arg);
00039
00040 void qt_hash_lock(qt_hash h);
00041 void qt_hash_unlock(qt_hash h);
00042
00043 #ifdef __cplusplus
00044 }
00045 #endif
00046
00047 #endif