Blender V4.3
BLI_heap.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12#include "BLI_compiler_attrs.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18struct Heap;
19struct HeapNode;
20typedef struct Heap Heap;
21typedef struct HeapNode HeapNode;
22
23typedef void (*HeapFreeFP)(void *ptr);
24
30Heap *BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT;
32void BLI_heap_clear(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
33void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
38HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1);
42void BLI_heap_insert_or_update(Heap *heap, HeapNode **node_p, float value, void *ptr)
43 ATTR_NONNULL(1, 2);
44void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1, 2);
45bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1);
46unsigned int BLI_heap_len(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
60void *BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1);
66void BLI_heap_node_value_update(Heap *heap, HeapNode *node, float value) ATTR_NONNULL(1, 2);
67void BLI_heap_node_value_update_ptr(Heap *heap, HeapNode *node, float value, void *ptr)
68 ATTR_NONNULL(1, 2);
69
78bool BLI_heap_is_valid(const Heap *heap);
79
80#ifdef __cplusplus
81}
82#endif
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_NONNULL(...)
bool BLI_heap_is_valid(const Heap *heap)
Definition BLI_heap.c:378
HeapNode * BLI_heap_top(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.c:279
void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Definition BLI_heap.c:192
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:347
Heap * BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT
Definition BLI_heap.c:172
void void bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1)
Definition BLI_heap.c:269
unsigned int BLI_heap_len(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.c:274
float BLI_heap_top_value(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.c:284
void(* HeapFreeFP)(void *ptr)
Definition BLI_heap.h:23
void BLI_heap_clear(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Definition BLI_heap.c:214
void BLI_heap_node_value_update(Heap *heap, HeapNode *node, float value) ATTR_NONNULL(1
void * BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1)
Definition BLI_heap.c:291
void * BLI_heap_node_ptr(const HeapNode *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.c:352
HeapNode * BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1)
Definition BLI_heap.c:235
void void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1
Heap * BLI_heap_new(void) ATTR_WARN_UNUSED_RESULT
Definition BLI_heap.c:187
PointerRNA * ptr
Definition wm_files.cc:4126