Blender V5.3
BLI_heap_simple.cc File Reference
#include <algorithm>
#include <cstdlib>
#include "MEM_guardedalloc.h"
#include "BLI_heap_simple.hh"
#include "BLI_utildefines.hh"
#include "BLI_strict_flags.hh"

Go to the source code of this file.

Classes

struct  blender::HeapSimpleNode
struct  blender::HeapSimple

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define HEAP_PARENT(i)
#define OFFSET(i)
#define NODE(offset)
#define HEAP_LEFT_OFFSET(i)

Functions

HeapSimple Internal Functions
static void blender::heapsimple_down (HeapSimple *heap, uint start_i, const HeapSimpleNode *init)
static void blender::heapsimple_up (HeapSimple *heap, uint i, float active_val, void *active_ptr)
Public HeapSimple API
HeapSimple * blender::BLI_heapsimple_new_ex (unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT
HeapSimple * blender::BLI_heapsimple_new () ATTR_WARN_UNUSED_RESULT
void blender::BLI_heapsimple_free (HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1)
void blender::BLI_heapsimple_clear (HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1)
void blender::BLI_heapsimple_insert (HeapSimple *heap, float value, void *ptr) ATTR_NONNULL(1)
bool blender::BLI_heapsimple_is_empty (const HeapSimple *heap) ATTR_NONNULL(1)
uint blender::BLI_heapsimple_len (const HeapSimple *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
float blender::BLI_heapsimple_top_value (const HeapSimple *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * blender::BLI_heapsimple_pop_min (HeapSimple *heap) ATTR_NONNULL(1)

Detailed Description

A min-heap / priority queue ADT.

Simplified version of the heap that only supports insertion and removal from top.

See BLI_heap.c for a more full featured heap implementation.

Definition in file BLI_heap_simple.cc.

Macro Definition Documentation

◆ HEAP_LEFT_OFFSET

#define HEAP_LEFT_OFFSET ( i)
Value:
(((i) << 1) + OFFSET(1))
#define OFFSET(i)

Referenced by blender::heapsimple_down().

◆ HEAP_PARENT

#define HEAP_PARENT ( i)
Value:
(((i) - 1) >> 1)

Definition at line 27 of file BLI_heap_simple.cc.

◆ NODE

#define NODE ( offset)

◆ OFFSET

#define OFFSET ( i)
Value:
(i * uint(sizeof(HeapSimpleNode)))

Referenced by blender::bmo_offset_edgeloops_exec(), and blender::heapsimple_down().