Blender V4.3
BLI_dlrbTree.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/* ********************************************** */
22/* Data Types and Type Defines */
23
24/* -------------------------------------------------------------------- */
29typedef struct DLRBT_Node {
30 /* ListBase capabilities */
31 struct DLRBT_Node *next, *prev;
32
33 /* Tree Associativity settings */
36
38 /* ... for nice alignment, next item should usually be a char too... */
40
46
47/* -------- */
48
50typedef struct DLRBT_Tree {
51 /* ListBase capabilities */
52 void *first, *last; /* these should be based on DLRBT_Node-s */
53
54 /* Root Node */
55 void *root; /* this should be based on DLRBT_Node-s */
57
60/* -------------------------------------------------------------------- */
71typedef short (*DLRBT_Comparator_FP)(void *node, void *data);
72
77typedef DLRBT_Node *(*DLRBT_NAlloc_FP)(void *data);
78
85typedef void (*DLRBT_NUpdate_FP)(void *node, void *data);
86
91typedef void (*DLRBT_NFree_FP)(void *node);
92
93/* ********************************************** */
94/* Public API */
95
98/* -------------------------------------------------------------------- */
106
112
117
122
125/* -------------------------------------------------------------------- */
133 DLRBT_Comparator_FP cmp_cb,
134 void *search_data);
135
140 DLRBT_Comparator_FP cmp_cb,
141 void *search_data);
142
147 DLRBT_Comparator_FP cmp_cb,
148 void *search_data);
149
154 DLRBT_Comparator_FP cmp_cb,
155 void *search_data);
156
160short BLI_dlrbTree_contains(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data);
161
164/* -------------------------------------------------------------------- */
179 DLRBT_Comparator_FP cmp_cb,
180 DLRBT_NAlloc_FP new_cb,
181 DLRBT_NUpdate_FP update_cb,
182 void *data);
183
184/* FIXME: this is not implemented yet. */
188// void BLI_dlrbTree_remove(DLRBT_Tree *tree, DLRBT_Node *node);
189
192/* -------------------------------------------------------------------- */
206
209#ifdef __cplusplus
210}
211#endif
DLRBT_Node * BLI_dlrbTree_search(const DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data)
Definition DLRB_tree.c:121
struct DLRBT_Node DLRBT_Node
void BLI_dlrbTree_init(DLRBT_Tree *tree)
Definition DLRB_tree.c:23
DLRBT_Node * BLI_dlrbTree_search_next(const DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data)
Definition DLRB_tree.c:245
void(* DLRBT_NFree_FP)(void *node)
void(* DLRBT_NUpdate_FP)(void *node, void *data)
DLRBT_Node * BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, DLRBT_NAlloc_FP new_cb, DLRBT_NUpdate_FP update_cb, void *data)
Definition DLRB_tree.c:527
DLRBT_Node *(* DLRBT_NAlloc_FP)(void *data)
void BLI_dlrbTree_linkedlist_sync(DLRBT_Tree *tree)
Definition DLRB_tree.c:104
short(* DLRBT_Comparator_FP)(void *node, void *data)
short BLI_dlrbTree_contains(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data)
Definition DLRB_tree.c:275
void BLI_dlrbTree_free(DLRBT_Tree *tree, DLRBT_NFree_FP free_cb)
Definition DLRB_tree.c:50
eDLRBT_Colors
@ DLRBT_BLACK
@ DLRBT_RED
void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node)
Definition DLRB_tree.c:511
DLRBT_Tree * BLI_dlrbTree_new(void)
Definition DLRB_tree.c:17
struct DLRBT_Tree DLRBT_Tree
DLRBT_Node * BLI_dlrbTree_search_exact(const DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data)
Definition DLRB_tree.c:168
DLRBT_Node * BLI_dlrbTree_search_prev(const DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, void *search_data)
Definition DLRB_tree.c:215
OperationNode * node
KDTree_3d * tree
struct DLRBT_Node * parent
struct DLRBT_Node * next
struct DLRBT_Node * left
struct DLRBT_Node * right
struct DLRBT_Node * prev
void * last
void * root
void * first