23 #include <lal/LALStdlib.h>
static int cmp(REAL4Sequence *a, REAL4Sequence *b)
const void ** XLALHeapElements(const LALHeap *h)
Allocate and return an array containing all elements in the heap.
void(* LALHeapDtorFcn)(void *x)
Function which free memory associated with heap element x
const void * XLALHeapRoot(const LALHeap *h)
Return the root element of a heap.
int XLALHeapResize(LALHeap *h, int max_size)
Change the maximum size of a heap; if the heap is contracted, excess elements are destroyed.
int(* LALHeapCmpFcn)(const void *x, const void *y)
Function which compares heap elements x and y
int XLALHeapVisit(const LALHeap *h, LALHeapVisitFcn visit, void *visit_param)
Visit each element in the heap in the order given by the comparison function.
int XLALHeapAdd(LALHeap *h, void **x)
Add a new element to a heap; if the heap is of fixed size and full, the root element is removed.
int(* LALHeapVisitFcn)(void *param, const void *x)
Function to call when visiting heap element x, with a parameter param.
void * XLALHeapExtractRoot(LALHeap *h)
Remove the root element of a heap.
int(* LALHeapCmpParamFcn)(void *param, const void *x, const void *y)
Function which compares heap elements x and y, with a parameter param.
int XLALHeapModify(LALHeap *h, LALHeapModifyFcn modify, void *modify_param)
Visit (and possibly modify) each element in the heap in the order given by the comparison function.
int XLALHeapSize(const LALHeap *h)
Return the size of a heap.
int XLALHeapExchangeRoot(LALHeap *h, void **x)
Exchange the root element of a non-empty heap with the new element in *x
int XLALHeapRemoveRoot(LALHeap *h)
Remove and destroy the root element of a heap.
int(* LALHeapModifyFcn)(void *param, void *x)
Function to call when visiting (and possibly modify) heap element x, with a parameter param.
int XLALHeapIsFull(const LALHeap *h)
Return >0 if a limited-size heap is full, 0 otherwise (or if heap has unlimited size),...
LALHeap * XLALHeapCreate2(LALHeapDtorFcn dtor, int max_size, int min_or_max_heap, LALHeapCmpParamFcn cmp, void *cmp_param)
Create a heap with a parameterised comparison function.
int XLALHeapClear(LALHeap *h)
Clear a heap.
LALHeap * XLALHeapCreate(LALHeapDtorFcn dtor, int max_size, int min_or_max_heap, LALHeapCmpFcn cmp)
Create a heap.
void XLALHeapDestroy(LALHeap *h)
Destroy a heap and its elements.
int XLALHeapMaxSize(const LALHeap *h)
Return the maximum size of a heap.
Generic heap with elements of type void *