1 #ifndef ROWSET_HEAP_H_
2 #define ROWSET_HEAP_H_
3 
4 /*  Data type for buckets used in the priority queue stuff (w/ tests) */
5 /* We'll arrange our slices in a priority heap, so that we'll always
6  * easily access the lightest one.
7  *
8  * The number of rows in a bucket does not really matter, except that we
9  * absolutely want to make sure that it never exceeds the bucket size.
10  * Hence if a bucket becomes full, then it's always considered heavier
11  * than anything.
12  */
13 
14 struct bucket {
15     unsigned long s;    /* total weight */
16     unsigned long room; /* nb of rows that can still be stored */
17     int i;              /* bucket index */
18 };
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 extern int heap_index_compare(const struct bucket * a, const struct bucket * b);
25 extern int heap_compare(const struct bucket * a, const struct bucket * b);
26 extern void push_heap(struct bucket * __first, struct bucket * __last);
27 extern void pop_heap(struct bucket * __first, struct bucket * __last);
28 extern void make_heap(struct bucket * __first, struct bucket * __last);
29 
30 #ifdef __cplusplus
31 }
32 #endif
33 
34 #endif	/* ROWSET_HEAP_H_ */
35