Blender V5.0
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
11
12#include <stdbool.h>
13#include <stddef.h>
14
15#include "BLI_compiler_attrs.h"
16
17struct Heap;
18struct HeapNode;
19typedef struct Heap Heap;
20typedef struct HeapNode HeapNode;
21
22typedef void (*HeapFreeFP)(void *ptr);
23
29Heap *BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT;
31void BLI_heap_clear(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
32void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1);
37HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1);
41void BLI_heap_insert_or_update(Heap *heap, HeapNode **node_p, float value, void *ptr)
42 ATTR_NONNULL(1, 2);
43void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1, 2);
44bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1);
45unsigned int BLI_heap_len(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
59void *BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1);
66void BLI_heap_node_value_update_ptr(Heap *heap, HeapNode *node, float value, void *ptr)
67 ATTR_NONNULL(1, 2);
68
77bool BLI_heap_is_valid(const Heap *heap);
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_NONNULL(...)
bool BLI_heap_is_valid(const Heap *heap)
Definition BLI_heap.cc:378
HeapNode * BLI_heap_top(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.cc:279
void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Definition BLI_heap.cc:191
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.cc:347
Heap * BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT
Definition BLI_heap.cc:171
void void bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1)
Definition BLI_heap.cc:269
unsigned int BLI_heap_len(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.cc:274
float BLI_heap_top_value(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.cc:284
void(* HeapFreeFP)(void *ptr)
Definition BLI_heap.h:22
void BLI_heap_clear(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Definition BLI_heap.cc:213
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.cc:291
void * BLI_heap_node_ptr(const HeapNode *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_heap.cc:352
HeapNode * BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1)
Definition BLI_heap.cc:234
void void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1
Heap * BLI_heap_new(void) ATTR_WARN_UNUSED_RESULT
Definition BLI_heap.cc:186
float value
Definition BLI_heap.cc:24
PointerRNA * ptr
Definition wm_files.cc:4238