RNAlib-2.4.14
heap.h
Go to the documentation of this file.
1 #ifndef VIENNA_RNA_PACKAGE_HEAP_H
2 #define VIENNA_RNA_PACKAGE_HEAP_H
3 
25 typedef struct vrna_heap_s *vrna_heap_t;
26 
27 
44 typedef int (vrna_callback_heap_cmp)(const void *a,
45  const void *b,
46  void *data);
47 
48 
56 typedef size_t (vrna_callback_heap_get_pos)(const void *a,
57  void *data);
58 
59 
67 typedef void (vrna_callback_heap_set_pos)(const void *a,
68  size_t pos,
69  void *data);
70 
71 
106 vrna_heap_init(size_t n,
108  vrna_callback_heap_get_pos *get_entry_pos,
109  vrna_callback_heap_set_pos *set_entry_pos,
110  void *data);
111 
112 
120 void
122 
123 
130 size_t
131 vrna_heap_size(struct vrna_heap_s *h);
132 
133 
143 void
145  void *v);
146 
147 
159 void *
161 
162 
172 const void *
174 
175 
189 void *
191  const void *v);
192 
193 
210 void *
212  void *v);
213 
214 
219 #endif
size_t( vrna_callback_heap_get_pos)(const void *a, void *data)
Retrieve the position of a particular heap entry within the heap.
Definition: heap.h:56
int( vrna_callback_heap_cmp)(const void *a, const void *b, void *data)
Heap compare function prototype.
Definition: heap.h:44
void * vrna_heap_pop(vrna_heap_t h)
Pop (remove and return) the object at the root of the heap.
void( vrna_callback_heap_set_pos)(const void *a, size_t pos, void *data)
Store the position of a particular heap entry within the heap.
Definition: heap.h:67
void * vrna_heap_update(vrna_heap_t h, void *v)
Update an arbitrary element within the heap.
const void * vrna_heap_top(vrna_heap_t h)
Get the object at the root of the heap.
void vrna_heap_insert(vrna_heap_t h, void *v)
Insert an element into the heap.
void vrna_heap_free(vrna_heap_t h)
Free memory occupied by a heap data structure.
void * vrna_heap_remove(vrna_heap_t h, const void *v)
Remove an arbitrary element within the heap.
size_t vrna_heap_size(struct vrna_heap_s *h)
Get the size of a heap data structure, i.e. the number of stored elements.
struct vrna_heap_s * vrna_heap_t
An abstract heap data structure.
Definition: heap.h:25
vrna_heap_t vrna_heap_init(size_t n, vrna_callback_heap_cmp *cmp, vrna_callback_heap_get_pos *get_entry_pos, vrna_callback_heap_set_pos *set_entry_pos, void *data)
Initialize a heap data structure.