X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fhashtable%2Fhashtable.h;h=e150190417b7a594db359fada7237c2871039390;hb=6dca8ba7dec3b31acb7b43f5e4431676acf4e664;hp=217f05d4759eb758f91614b1731507d58bb18a75;hpb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;p=lttng-tools.git diff --git a/src/common/hashtable/hashtable.h b/src/common/hashtable/hashtable.h index 217f05d47..e15019041 100644 --- a/src/common/hashtable/hashtable.h +++ b/src/common/hashtable/hashtable.h @@ -12,11 +12,16 @@ #include #include +#include #include -extern unsigned long lttng_ht_seed; +#ifdef __cplusplus +extern "C" { +#endif -typedef unsigned long (*hash_fct)(const void *_key, unsigned long seed); +LTTNG_EXPORT extern unsigned long lttng_ht_seed; + +typedef unsigned long (*hash_fct_type)(const void *_key, unsigned long seed); typedef cds_lfht_match_fct hash_match_fct; enum lttng_ht_type { @@ -29,7 +34,7 @@ enum lttng_ht_type { struct lttng_ht { struct cds_lfht *ht; cds_lfht_match_fct match_fct; - hash_fct hash_fct; + hash_fct_type hash_fct; }; struct lttng_ht_iter { @@ -66,88 +71,64 @@ struct lttng_ht_node_two_u64 { }; /* Hashtable new and destroy */ -LTTNG_HIDDEN -struct lttng_ht *lttng_ht_new(unsigned long size, int type); -LTTNG_HIDDEN +struct lttng_ht *lttng_ht_new(unsigned long size, enum lttng_ht_type type); void lttng_ht_destroy(struct lttng_ht *ht); /* Specialized node init and free functions */ -LTTNG_HIDDEN void lttng_ht_node_init_str(struct lttng_ht_node_str *node, char *key); -LTTNG_HIDDEN void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node, unsigned long key); -LTTNG_HIDDEN void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node, uint64_t key); -LTTNG_HIDDEN void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node, uint64_t key1, uint64_t key2); -LTTNG_HIDDEN void lttng_ht_node_free_str(struct lttng_ht_node_str *node); -LTTNG_HIDDEN void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node); -LTTNG_HIDDEN void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node); -LTTNG_HIDDEN void lttng_ht_node_free_two_u64(struct lttng_ht_node_two_u64 *node); -LTTNG_HIDDEN void lttng_ht_lookup(struct lttng_ht *ht, const void *key, struct lttng_ht_iter *iter); /* Specialized add unique functions */ -LTTNG_HIDDEN void lttng_ht_add_unique_str(struct lttng_ht *ht, struct lttng_ht_node_str *node); -LTTNG_HIDDEN void lttng_ht_add_unique_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); -LTTNG_HIDDEN void lttng_ht_add_unique_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node); -LTTNG_HIDDEN void lttng_ht_add_unique_two_u64(struct lttng_ht *ht, struct lttng_ht_node_two_u64 *node); -LTTNG_HIDDEN struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong( struct lttng_ht *ht, struct lttng_ht_node_ulong *node); -LTTNG_HIDDEN struct lttng_ht_node_u64 *lttng_ht_add_replace_u64( struct lttng_ht *ht, struct lttng_ht_node_u64 *node); -LTTNG_HIDDEN void lttng_ht_add_str(struct lttng_ht *ht, struct lttng_ht_node_str *node); -LTTNG_HIDDEN void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); -LTTNG_HIDDEN void lttng_ht_add_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node); -LTTNG_HIDDEN int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter); -LTTNG_HIDDEN void lttng_ht_get_first(struct lttng_ht *ht, struct lttng_ht_iter *iter); -LTTNG_HIDDEN void lttng_ht_get_next(struct lttng_ht *ht, struct lttng_ht_iter *iter); -LTTNG_HIDDEN unsigned long lttng_ht_get_count(struct lttng_ht *ht); -LTTNG_HIDDEN struct lttng_ht_node_str *lttng_ht_iter_get_node_str( struct lttng_ht_iter *iter); -LTTNG_HIDDEN struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong( struct lttng_ht_iter *iter); -LTTNG_HIDDEN struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64( struct lttng_ht_iter *iter); -LTTNG_HIDDEN struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64( struct lttng_ht_iter *iter); +#ifdef __cplusplus +} +#endif + #endif /* _LTT_HT_H */