src/misc/hash_table.h

Go to the documentation of this file.
00001 
00007 #ifndef _TXC_HASH_H
00008 #define _TXC_HASH_H
00009 
00010 #include <misc/result.h>
00011 #include <misc/generic_types.h>
00012 
00013 #define HASH_FACTOR 4
00014 
00015 /* Opaque structure used to represent hash table. */
00016 typedef struct txc_hash_table_s txc_hash_table_t;
00017 
00018 /* Opaque structure used to represent hash table iterator. */
00019 typedef struct txc_hash_table_iter_s txc_hash_table_iter_t;
00020 
00021 typedef unsigned int txc_hash_table_key_t;
00022 typedef void *txc_hash_table_value_t;
00023 typedef struct txc_hash_table_bucket_s txc_hash_table_bucket_t;
00024 
00025 struct txc_hash_table_iter_s {
00026         txc_hash_table_t        *hash_table;
00027         unsigned int            index;
00028         txc_hash_table_bucket_t *bucket;
00029 };
00030 
00031 
00032 txc_result_t txc_hash_table_create(txc_hash_table_t**, unsigned int, txc_bool_t);
00033 txc_result_t txc_hash_table_destroy(txc_hash_table_t**);
00034 txc_result_t txc_hash_table_add(txc_hash_table_t*, txc_hash_table_key_t, txc_hash_table_value_t);
00035 txc_result_t txc_hash_table_lookup(txc_hash_table_t*, txc_hash_table_key_t, txc_hash_table_value_t *);
00036 txc_result_t txc_hash_table_remove(txc_hash_table_t*, txc_hash_table_key_t, txc_hash_table_value_t *);
00037 void txc_hash_table_iter_init(txc_hash_table_t *hash_table, txc_hash_table_iter_t *iter);
00038 txc_result_t txc_hash_table_iter_next(txc_hash_table_iter_t *iter, txc_hash_table_key_t *key, txc_hash_table_value_t *value);
00039 void txc_hash_table_print(txc_hash_table_t *);
00040 #endif

Generated on Wed Dec 9 20:32:39 2009 for xCalls by  doxygen 1.4.7