#ifndef _HEAP_H_
#define _HEAP_H_
#ifndef _ENTRY_H_
#error "Need to include entry.h before heap.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
union heap_data
{
Entry* entry;
};
typedef struct heap Heap;
typedef union heap_data HeapData;
typedef int (*HeapCmp)(HeapData, HeapData);
extern Heap* heap_new_entry(int size, HeapCmp entry_cmp) returns_NONNULL;
extern void heap_free(Heap* heap) expects_NONNULL;
extern bool heap_is_valid(Heap const* heap) is_PURE;
extern void heap_push_entry(Heap* heap, Entry* entry) expects_NONNULL;
extern Entry* heap_pop_entry(Heap* heap) expects_NONNULL returns_NONNULL;
extern Entry const* heap_top_entry(Heap const* heap) expects_NONNULL returns_NONNULL;
extern bool heap_is_full(Heap const* heap) expects_NONNULL is_PURE;
extern bool heap_is_empty(Heap const* heap) expects_NONNULL is_PURE;
#ifdef __cplusplus
}
#endif
#endif