RNAlib-2.4.14
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 
35 typedef struct vrna_hash_table_s *vrna_hash_table_t;
36 
37 
45 typedef int (vrna_callback_ht_compare_entries)(void *x,
46  void *y);
47 
48 
56 typedef unsigned int (vrna_callback_ht_hash_function)(void *x,
57  unsigned long hashtable_size);
58 
59 
66 typedef int (vrna_callback_ht_free_entry)(void *x);
67 
68 
95 vrna_ht_init(unsigned int b,
96  vrna_callback_ht_compare_entries *compare_function,
97  vrna_callback_ht_hash_function *hash_function,
98  vrna_callback_ht_free_entry *free_hash_entry);
99 
100 
107 unsigned long
109 
110 
117 unsigned long
118 vrna_ht_collisions(struct vrna_hash_table_s *ht);
119 
120 
135 void *
137  void *x);
138 
139 
155 int
157  void *x);
158 
159 
171 void
173  void *x);
174 
175 
187 void
189 
190 
201 void
203 
204 
205 /* End of abstract interface */
217 typedef struct {
218  char *structure;
219  float energy;
221 
222 
236 int
237 vrna_ht_db_comp(void *x,
238  void *y);
239 
240 
255 unsigned int
256 vrna_ht_db_hash_func(void *x,
257  unsigned long hashtable_size);
258 
259 
271 int vrna_ht_db_free_entry(void *hash_entry);
272 
273 
274 /* End of dot-bracket interface */
281 #endif
float energy
Definition: hash_tables.h:219
int( vrna_callback_ht_free_entry)(void *x)
Callback function to free a hash table entry.
Definition: hash_tables.h:66
unsigned long vrna_ht_size(vrna_hash_table_t ht)
Get the size of the hash table.
unsigned int vrna_ht_db_hash_func(void *x, unsigned long hashtable_size)
Default hash function.
int( vrna_callback_ht_compare_entries)(void *x, void *y)
Callback function to compare two hash table entries.
Definition: hash_tables.h:45
void * vrna_ht_get(vrna_hash_table_t ht, void *x)
Get an element from the hash table.
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.
unsigned long vrna_ht_collisions(struct vrna_hash_table_s *ht)
Get the number of collisions in the hash table.
Default hash table entry.
Definition: hash_tables.h:217
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_callback_ht_hash_function)(void *x, unsigned long hashtable_size)
Callback function to generate a hash key, i.e. hash function.
Definition: hash_tables.h:56
void vrna_ht_clear(vrna_hash_table_t ht)
Clear the hash table.
void vrna_ht_remove(vrna_hash_table_t ht, void *x)
Remove an object from the hash table.
struct vrna_hash_table_s * vrna_hash_table_t
A hash table object.
Definition: hash_tables.h:35
char * structure
Definition: hash_tables.h:218
vrna_hash_table_t vrna_ht_init(unsigned int b, vrna_callback_ht_compare_entries *compare_function, vrna_callback_ht_hash_function *hash_function, vrna_callback_ht_free_entry *free_hash_entry)
Get an initialized hash table.