RNAlib-2.6.0b
 
Loading...
Searching...
No Matches
hash_tables.h
Go to the documentation of this file.
1#ifndef VIENNA_RNA_PACKAGE_HASH_UTIL_H
2#define VIENNA_RNA_PACKAGE_HASH_UTIL_H
3
4/* Taken from the barriers tool and modified by GE. */
5
6#ifdef VRNA_WARN_DEPRECATED
7# if defined(DEPRECATED)
8# undef DEPRECATED
9# endif
10# if defined(__clang__)
11# define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg)))
12# elif defined(__GNUC__)
13# define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
14# else
15# define DEPRECATED(func, msg) func
16# endif
17#else
18# define DEPRECATED(func, msg) func
19#endif
20
50typedef struct vrna_hash_table_s *vrna_hash_table_t;
51
52
60typedef int (*vrna_ht_cmp_f)(void *x,
61 void *y);
62
63DEPRECATED(typedef int (vrna_callback_ht_compare_entries)(void *x,
64 void *y),
65 "Use vrna_ht_cmp_f instead!");
66
67
68
76typedef unsigned int (*vrna_ht_hashfunc_f)(void *x,
77 unsigned long hashtable_size);
78
79DEPRECATED(typedef unsigned int (vrna_callback_ht_hash_function)(void *x,
80 unsigned long hashtable_size),
81 "Use vrna_ht_hashfunc_f instead!");
82
83
90typedef int (*vrna_ht_free_f)(void *x);
91
92DEPRECATED(typedef int (vrna_callback_ht_free_entry)(void *x),
93 "Use vrna_ht_free_f instead!");
94
95
122vrna_ht_init(unsigned int b,
123 vrna_ht_cmp_f compare_function,
124 vrna_ht_hashfunc_f hash_function,
125 vrna_ht_free_f free_hash_entry);
126
127
134unsigned long
136
137
144unsigned long
145vrna_ht_collisions(struct vrna_hash_table_s *ht);
146
147
162void *
164 void *x);
165
166
182int
184 void *x);
185
186
198void
200 void *x);
201
202
214void
216
217
228void
230
231
232/* End of abstract interface */
244typedef struct {
245 char *structure;
246 float energy;
248
249
263int
265 void *y);
266
267
282unsigned int
284 unsigned long hashtable_size);
285
286
298int vrna_ht_db_free_entry(void *hash_entry);
299
300
301/* End of dot-bracket interface */
308#endif
char * structure
Definition: hash_tables.h:245
float energy
Definition: hash_tables.h:246
void vrna_ht_remove(vrna_hash_table_t ht, void *x)
Remove an object from the hash table.
unsigned long vrna_ht_size(vrna_hash_table_t ht)
Get the size of the hash table.
int(* vrna_ht_free_f)(void *x)
Callback function to free a hash table entry.
Definition: hash_tables.h:90
void vrna_ht_free(vrna_hash_table_t ht)
Free all memory occupied by the hash table.
int vrna_ht_insert(vrna_hash_table_t ht, void *x)
Insert an object into a hash table.
int(* vrna_ht_cmp_f)(void *x, void *y)
Callback function to compare two hash table entries.
Definition: hash_tables.h:60
unsigned long vrna_ht_collisions(struct vrna_hash_table_s *ht)
Get the number of collisions in the hash table.
vrna_hash_table_t vrna_ht_init(unsigned int b, vrna_ht_cmp_f compare_function, vrna_ht_hashfunc_f hash_function, vrna_ht_free_f free_hash_entry)
Get an initialized hash table.
void * vrna_ht_get(vrna_hash_table_t ht, void *x)
Get an element from the hash table.
void vrna_ht_clear(vrna_hash_table_t ht)
Clear the hash table.
struct vrna_hash_table_s * vrna_hash_table_t
A hash table object.
Definition: hash_tables.h:50
int vrna_ht_db_free_entry(void *hash_entry)
Default function to free memory occupied by a hash entry.
int vrna_ht_db_comp(void *x, void *y)
Default hash table entry comparison.
unsigned int vrna_ht_db_hash_func(void *x, unsigned long hashtable_size)
Default hash function.
unsigned int(* vrna_ht_hashfunc_f)(void *x, unsigned long hashtable_size)
Callback function to generate a hash key, i.e. hash function.
Definition: hash_tables.h:76
Default hash table entry.
Definition: hash_tables.h:244