Blender  V3.3
BLI_heap.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include "BLI_math.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 struct Heap;
17 struct HeapNode;
18 typedef struct Heap Heap;
19 typedef struct HeapNode HeapNode;
20 
21 typedef void (*HeapFreeFP)(void *ptr);
22 
28 Heap *BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT;
30 void BLI_heap_clear(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
31 void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
36 HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1);
40 void BLI_heap_insert_or_update(Heap *heap, HeapNode **node_p, float value, void *ptr)
41  ATTR_NONNULL(1, 2);
43 bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1);
44 unsigned int BLI_heap_len(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
58 void *BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1);
66  ATTR_NONNULL(1, 2);
67 
76 bool BLI_heap_is_valid(const Heap *heap);
77 
78 #ifdef __cplusplus
79 }
80 #endif
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_NONNULL(...)
bool BLI_heap_is_valid(const Heap *heap)
Definition: BLI_heap.c:388
void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Definition: BLI_heap.c:202
void BLI_heap_insert_or_update(Heap *heap, HeapNode **node_p, float value, void *ptr) ATTR_NONNULL(1
void void BLI_heap_node_value_update_ptr(Heap *heap, HeapNode *node, float value, void *ptr) ATTR_NONNULL(1
void void float BLI_heap_node_value(const HeapNode *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_heap.c:357
void void bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1)
Definition: BLI_heap.c:279
void * BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1)
Definition: BLI_heap.c:301
unsigned int BLI_heap_len(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_heap.c:284
float BLI_heap_top_value(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_heap.c:294
void(* HeapFreeFP)(void *ptr)
Definition: BLI_heap.h:21
Heap * BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT
Definition: BLI_heap.c:182
void BLI_heap_clear(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Definition: BLI_heap.c:224
void BLI_heap_node_value_update(Heap *heap, HeapNode *node, float value) ATTR_NONNULL(1
HeapNode * BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1)
Definition: BLI_heap.c:245
void * BLI_heap_node_ptr(const HeapNode *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_heap.c:362
HeapNode * BLI_heap_top(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_heap.c:289
Heap * BLI_heap_new(void) ATTR_WARN_UNUSED_RESULT
Definition: BLI_heap.c:197
void void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1
OperationNode * node
SyclQueue void void size_t num_bytes void
float value
Definition: BLI_heap.c:21
Definition: BLI_heap.c:43
PointerRNA * ptr
Definition: wm_files.c:3480