1 /** 2 * \file 3 * GC-aware hashtable, based on Eglib's Hashtable 4 * 5 * Authors: 6 * Paolo Molaro (lupus@xamarin.com) 7 * 8 * Copyright 2013 Xamarin Inc (http://www.xamarin.com) 9 * Licensed under the MIT license. See LICENSE file in the project root for full license information. 10 */ 11 12 #ifndef __MONO_G_HASH_H__ 13 #define __MONO_G_HASH_H__ 14 15 #include <mono/metadata/mono-gc.h> 16 17 MONO_BEGIN_DECLS 18 /* do not change the values of this enum */ 19 typedef enum { 20 MONO_HASH_KEY_GC = 1, 21 MONO_HASH_VALUE_GC = 2, 22 MONO_HASH_KEY_VALUE_GC = MONO_HASH_KEY_GC | MONO_HASH_VALUE_GC, 23 } MonoGHashGCType; 24 25 extern gint32 mono_g_hash_table_max_chain_length; 26 27 typedef struct _MonoGHashTable MonoGHashTable; 28 29 MONO_API MonoGHashTable *mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, const char *msg); 30 MONO_API guint mono_g_hash_table_size (MonoGHashTable *hash); 31 MONO_API gpointer mono_g_hash_table_lookup (MonoGHashTable *hash, gconstpointer key); 32 MONO_API gboolean mono_g_hash_table_lookup_extended (MonoGHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value); 33 MONO_API void mono_g_hash_table_foreach (MonoGHashTable *hash, GHFunc func, gpointer user_data); 34 MONO_API gpointer mono_g_hash_table_find (MonoGHashTable *hash, GHRFunc predicate, gpointer user_data); 35 MONO_API gboolean mono_g_hash_table_remove (MonoGHashTable *hash, gconstpointer key); 36 MONO_API guint mono_g_hash_table_foreach_remove (MonoGHashTable *hash, GHRFunc func, gpointer user_data); 37 MONO_API void mono_g_hash_table_destroy (MonoGHashTable *hash); 38 MONO_API void mono_g_hash_table_insert (MonoGHashTable *h, gpointer k, gpointer v); 39 MONO_API void mono_g_hash_table_replace (MonoGHashTable *h, gpointer k, gpointer v); 40 MONO_API void mono_g_hash_table_print_stats (MonoGHashTable *table); 41 42 MONO_END_DECLS 43 #endif /* __MONO_G_HASH_H__ */ 44