## dzl-heap

dzl-heap

## Functions

#define | dzl_heap_insert_val()
#define | dzl_heap_index()
#define | dzl_heap_peek()
DzlHeap * | dzl_heap_new ()
DzlHeap * | dzl_heap_ref ()
void | dzl_heap_unref ()
void | dzl_heap_insert_vals ()
gboolean | dzl_heap_extract ()
gboolean | dzl_heap_extract_index ()

## Object Hierarchy

        GBoxed
        ╰── DzlHeap

## Description

## Functions

### dzl_heap_insert_val()

    #define dzl_heap_insert_val(h,v) dzl_heap_insert_vals(h,&(v),1)

### dzl_heap_index()

    #define dzl_heap_index(h,t,i)    (((t*)(void*)(h)->data)[i])

### dzl_heap_peek()

    #define dzl_heap_peek(h,t)       dzl_heap_index(h,t,0)

### dzl_heap_new ()

    DzlHeap *
    dzl_heap_new (guint element_size,
                  GCompareFunc compare_func);

Creates a new DzlHeap. A heap is a tree-like structure stored in an array that is not fully sorted, but head is guaranteed to be either the max, or min value based on `compare_func` . This is also known as a priority queue.

#### Parameters

element_size | the size of each element in the heap |
compare_func | a function to compare to elements. | [scope async]

#### Returns

A newly allocated DzlHeap.

[transfer full]

### dzl_heap_ref ()

    DzlHeap *
    dzl_heap_ref (DzlHeap *heap);

Increments the reference count of `heap` by one.

#### Parameters

heap | An DzlHeap |

#### Returns

`heap` .

[transfer full]

### dzl_heap_unref ()

    void
    dzl_heap_unref (DzlHeap *heap);

Decrements the reference count of `heap` by one, freeing the structure when the reference count reaches zero.

#### Parameters

heap | An DzlHeap. | [transfer full]

### dzl_heap_insert_vals ()

    void
    dzl_heap_insert_vals (DzlHeap *heap,
                          gconstpointer data,
                          guint len);

### dzl_heap_extract ()

    gboolean
    dzl_heap_extract (DzlHeap *heap,
                      gpointer result);

### dzl_heap_extract_index ()

    gboolean
    dzl_heap_extract_index (DzlHeap *heap,
                            gsize index_,
                            gpointer result);