Blender V4.3
BLI_heap_simple.h File Reference

A min-heap / priority queue ADT. More...

Go to the source code of this file.

Typedefs

typedef struct HeapSimple HeapSimple
 
typedef void(* HeapSimpleFreeFP) (void *ptr)
 

Functions

HeapSimpleBLI_heapsimple_new_ex (unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT
 
HeapSimpleBLI_heapsimple_new (void) ATTR_WARN_UNUSED_RESULT
 
void BLI_heapsimple_clear (HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1)
 
void BLI_heapsimple_free (HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1)
 
void BLI_heapsimple_insert (HeapSimple *heap, float value, void *ptr) ATTR_NONNULL(1)
 
bool BLI_heapsimple_is_empty (const HeapSimple *heap) ATTR_NONNULL(1)
 
uint BLI_heapsimple_len (const HeapSimple *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
float BLI_heapsimple_top_value (const HeapSimple *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
void * BLI_heapsimple_pop_min (HeapSimple *heap) ATTR_NONNULL(1)
 

Detailed Description

A min-heap / priority queue ADT.

Definition in file BLI_heap_simple.h.

Typedef Documentation

◆ HeapSimple

typedef struct HeapSimple HeapSimple

Definition at line 17 of file BLI_heap_simple.h.

◆ HeapSimpleFreeFP

typedef void(* HeapSimpleFreeFP) (void *ptr)

Definition at line 19 of file BLI_heap_simple.h.

Function Documentation

◆ BLI_heapsimple_clear()

void BLI_heapsimple_clear ( HeapSimple * heap,
HeapSimpleFreeFP ptrfreefp )

Definition at line 166 of file BLI_heap_simple.c.

References HeapSimpleNode::ptr, HeapSimple::size, and HeapSimple::tree.

Referenced by bmo_connect_vert_pair_exec().

◆ BLI_heapsimple_free()

◆ BLI_heapsimple_insert()

◆ BLI_heapsimple_is_empty()

◆ BLI_heapsimple_len()

uint BLI_heapsimple_len ( const HeapSimple * heap)

Definition at line 192 of file BLI_heap_simple.c.

References HeapSimple::size.

Referenced by bmo_connect_vert_pair_exec(), TEST(), and TEST().

◆ BLI_heapsimple_new()

◆ BLI_heapsimple_new_ex()

HeapSimple * BLI_heapsimple_new_ex ( unsigned int reserve_num)

Creates a new simple heap, which only supports insertion and removal from top.

Note
Use when the size of the heap is known in advance.

Definition at line 139 of file BLI_heap_simple.c.

References HeapSimple::bufsize, MAX2, MEM_mallocN, HeapSimple::size, and HeapSimple::tree.

Referenced by BLI_heapsimple_new(), and heap_find_nearest_begin().

◆ BLI_heapsimple_pop_min()

◆ BLI_heapsimple_top_value()

float BLI_heapsimple_top_value ( const HeapSimple * heap)

Return the lowest value of the heap.

Definition at line 197 of file BLI_heap_simple.c.

References BLI_assert, HeapSimple::size, HeapSimple::tree, and HeapSimpleNode::value.

Referenced by edbm_average_normals_exec(), and heap_find_nearest_begin().