1 | /** @file
|
---|
2 | * innotek Portable Runtime - AVL Trees.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 1999-2003 knut st. osmundsen <bird-src-spam@anduin.net>
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef ___iprt_avl_h
|
---|
18 | #define ___iprt_avl_h
|
---|
19 |
|
---|
20 | #include <iprt/cdefs.h>
|
---|
21 | #include <iprt/types.h>
|
---|
22 |
|
---|
23 | __BEGIN_DECLS
|
---|
24 |
|
---|
25 | /** @defgroup grp_rt_avl RTAvl - AVL Trees
|
---|
26 | * @ingroup grp_rt
|
---|
27 | * @{
|
---|
28 | */
|
---|
29 |
|
---|
30 |
|
---|
31 | /** AVL tree of void pointers.
|
---|
32 | * @{
|
---|
33 | */
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * AVL key type
|
---|
37 | */
|
---|
38 | typedef void * AVLPVKEY;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * AVL Core node.
|
---|
42 | */
|
---|
43 | typedef struct _AVLPVNodeCore
|
---|
44 | {
|
---|
45 | AVLPVKEY Key; /** Key value. */
|
---|
46 | struct _AVLPVNodeCore *pLeft; /** Pointer to left leaf node. */
|
---|
47 | struct _AVLPVNodeCore *pRight; /** Pointer to right leaf node. */
|
---|
48 | unsigned char uchHeight; /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
49 | } AVLPVNODECORE, *PAVLPVNODECORE, **PPAVLPVNODECORE;
|
---|
50 |
|
---|
51 | /** A tree with void pointer keys. */
|
---|
52 | typedef PAVLPVNODECORE AVLPVTREE;
|
---|
53 | /** Pointer to a tree with void pointer keys. */
|
---|
54 | typedef PPAVLPVNODECORE PAVLPVTREE;
|
---|
55 |
|
---|
56 | /** Callback function for AVLPVDoWithAll(). */
|
---|
57 | typedef DECLCALLBACK(int) AVLPVCALLBACK(PAVLPVNODECORE, void *);
|
---|
58 | /** Pointer to callback function for AVLPVDoWithAll(). */
|
---|
59 | typedef AVLPVCALLBACK *PAVLPVCALLBACK;
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Functions.
|
---|
63 | */
|
---|
64 | RTDECL(bool) RTAvlPVInsert(PAVLPVTREE ppTree, PAVLPVNODECORE pNode);
|
---|
65 | RTDECL(PAVLPVNODECORE) RTAvlPVRemove(PAVLPVTREE ppTree, AVLPVKEY Key);
|
---|
66 | RTDECL(PAVLPVNODECORE) RTAvlPVGet(PAVLPVTREE ppTree, AVLPVKEY Key);
|
---|
67 | RTDECL(PAVLPVNODECORE) RTAvlPVGetBestFit(PAVLPVTREE ppTree, AVLPVKEY Key, bool fAbove);
|
---|
68 | RTDECL(PAVLPVNODECORE) RTAvlPVRemoveBestFit(PAVLPVTREE ppTree, AVLPVKEY Key, bool fAbove);
|
---|
69 | RTDECL(int) RTAvlPVDoWithAll(PAVLPVTREE ppTree, int fFromLeft, PAVLPVCALLBACK pfnCallBack, void *pvParam);
|
---|
70 | RTDECL(int) RTAvlPVDestroy(PAVLPVTREE ppTree, PAVLPVCALLBACK pfnCallBack, void *pvParam);
|
---|
71 |
|
---|
72 | /** @} */
|
---|
73 |
|
---|
74 |
|
---|
75 | /** AVL tree of unsigned long.
|
---|
76 | * @{
|
---|
77 | */
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * AVL key type
|
---|
81 | */
|
---|
82 | typedef unsigned long AVLULKEY;
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * AVL Core node.
|
---|
86 | */
|
---|
87 | typedef struct _AVLULNodeCore
|
---|
88 | {
|
---|
89 | AVLULKEY Key; /** Key value. */
|
---|
90 | struct _AVLULNodeCore *pLeft; /** Pointer to left leaf node. */
|
---|
91 | struct _AVLULNodeCore *pRight; /** Pointer to right leaf node. */
|
---|
92 | unsigned char uchHeight; /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
93 | } AVLULNODECORE, *PAVLULNODECORE, **PPAVLULNODECORE;
|
---|
94 |
|
---|
95 |
|
---|
96 | /** Callback function for AVLULDoWithAll(). */
|
---|
97 | typedef DECLCALLBACK(int) AVLULCALLBACK(PAVLULNODECORE, void*);
|
---|
98 | /** Pointer to callback function for AVLULDoWithAll(). */
|
---|
99 | typedef AVLULCALLBACK *PAVLULCALLBACK;
|
---|
100 |
|
---|
101 |
|
---|
102 | /*
|
---|
103 | * Functions.
|
---|
104 | */
|
---|
105 | RTDECL(bool) RTAvlULInsert(PPAVLULNODECORE ppTree, PAVLULNODECORE pNode);
|
---|
106 | RTDECL(PAVLULNODECORE) RTAvlULRemove(PPAVLULNODECORE ppTree, AVLULKEY Key);
|
---|
107 | RTDECL(PAVLULNODECORE) RTAvlULGet(PPAVLULNODECORE ppTree, AVLULKEY Key);
|
---|
108 | RTDECL(PAVLULNODECORE) RTAvlULGetBestFit(PPAVLULNODECORE ppTree, AVLULKEY Key, bool fAbove);
|
---|
109 | RTDECL(PAVLULNODECORE) RTAvlULRemoveBestFit(PPAVLULNODECORE ppTree, AVLULKEY Key, bool fAbove);
|
---|
110 | RTDECL(int) RTAvlULDoWithAll(PPAVLULNODECORE ppTree, int fFromLeft, PAVLULCALLBACK pfnCallBack, void *pvParam);
|
---|
111 |
|
---|
112 | /** @} */
|
---|
113 |
|
---|
114 |
|
---|
115 |
|
---|
116 | /** AVL tree of uint32_t
|
---|
117 | * @{
|
---|
118 | */
|
---|
119 |
|
---|
120 | /** AVL key type. */
|
---|
121 | typedef uint32_t AVLU32KEY;
|
---|
122 |
|
---|
123 | /** AVL Core node. */
|
---|
124 | typedef struct _AVLU32NodeCore
|
---|
125 | {
|
---|
126 | AVLU32KEY Key; /**< Key value. */
|
---|
127 | struct _AVLU32NodeCore *pLeft; /**< Pointer to left leaf node. */
|
---|
128 | struct _AVLU32NodeCore *pRight; /**< Pointer to right leaf node. */
|
---|
129 | unsigned char uchHeight; /**< Height of this tree: max(height(left), height(right)) + 1 */
|
---|
130 | } AVLU32NODECORE, *PAVLU32NODECORE, **PPAVLU32NODECORE;
|
---|
131 |
|
---|
132 | /** Callback function for AVLU32DoWithAll() & AVLU32Destroy(). */
|
---|
133 | typedef DECLCALLBACK(int) AVLU32CALLBACK(PAVLU32NODECORE, void*);
|
---|
134 | /** Pointer to callback function for AVLU32DoWithAll() & AVLU32Destroy(). */
|
---|
135 | typedef AVLU32CALLBACK *PAVLU32CALLBACK;
|
---|
136 |
|
---|
137 |
|
---|
138 | /*
|
---|
139 | * Functions.
|
---|
140 | */
|
---|
141 | RTDECL(bool) RTAvlU32Insert(PPAVLU32NODECORE ppTree, PAVLU32NODECORE pNode);
|
---|
142 | RTDECL(PAVLU32NODECORE) RTAvlU32Remove(PPAVLU32NODECORE ppTree, AVLU32KEY Key);
|
---|
143 | RTDECL(PAVLU32NODECORE) RTAvlU32Get(PPAVLU32NODECORE ppTree, AVLU32KEY Key);
|
---|
144 | RTDECL(PAVLU32NODECORE) RTAvlU32GetBestFit(PPAVLU32NODECORE ppTree, AVLU32KEY Key, bool fAbove);
|
---|
145 | RTDECL(PAVLU32NODECORE) RTAvlU32RemoveBestFit(PPAVLU32NODECORE ppTree, AVLU32KEY Key, bool fAbove);
|
---|
146 | RTDECL(int) RTAvlU32DoWithAll(PPAVLU32NODECORE ppTree, int fFromLeft, PAVLU32CALLBACK pfnCallBack, void *pvParam);
|
---|
147 | RTDECL(int) RTAvlU32Destroy(PPAVLU32NODECORE pTree, PAVLU32CALLBACK pfnCallBack, void *pvParam);
|
---|
148 |
|
---|
149 | /** @} */
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 | /** AVL tree of RTGCPHYSes - using relative offsets internally.
|
---|
154 | * @{
|
---|
155 | */
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
159 | */
|
---|
160 | typedef int32_t AVLOGCPHYS;
|
---|
161 |
|
---|
162 | /**
|
---|
163 | * AVL Core node.
|
---|
164 | */
|
---|
165 | typedef struct _AVLOGCPhysNodeCore
|
---|
166 | {
|
---|
167 | /** Key value. */
|
---|
168 | RTGCPHYS Key;
|
---|
169 | /** Offset to the left leaf node, relative to this field. */
|
---|
170 | AVLOGCPHYS pLeft;
|
---|
171 | /** Offset to the right leaf node, relative to this field. */
|
---|
172 | AVLOGCPHYS pRight;
|
---|
173 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
174 | unsigned char uchHeight;
|
---|
175 | } AVLOGCPHYSNODECORE, *PAVLOGCPHYSNODECORE;
|
---|
176 |
|
---|
177 | /** A offset base tree with uint32_t keys. */
|
---|
178 | typedef AVLOGCPHYS AVLOGCPHYSTREE;
|
---|
179 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
180 | typedef AVLOGCPHYSTREE *PAVLOGCPHYSTREE;
|
---|
181 |
|
---|
182 | /** Pointer to an internal tree pointer.
|
---|
183 | * In this case it's a pointer to a relative offset. */
|
---|
184 | typedef AVLOGCPHYSTREE *PPAVLOGCPHYSNODECORE;
|
---|
185 |
|
---|
186 | /** Callback function for RTAvloGCPhysDoWithAll() and RTAvloGCPhysDestroy(). */
|
---|
187 | typedef DECLCALLBACK(int) AVLOGCPHYSCALLBACK(PAVLOGCPHYSNODECORE pNode, void *pvUser);
|
---|
188 | /** Pointer to callback function for RTAvloGCPhysDoWithAll() and RTAvloGCPhysDestroy(). */
|
---|
189 | typedef AVLOGCPHYSCALLBACK *PAVLOGCPHYSCALLBACK;
|
---|
190 |
|
---|
191 | RTDECL(bool) RTAvloGCPhysInsert(PAVLOGCPHYSTREE pTree, PAVLOGCPHYSNODECORE pNode);
|
---|
192 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysRemove(PAVLOGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
193 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysGet(PAVLOGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
194 | RTDECL(int) RTAvloGCPhysDoWithAll(PAVLOGCPHYSTREE pTree, int fFromLeft, PAVLOGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
195 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysGetBestFit(PAVLOGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
196 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysRemoveBestFit(PAVLOGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
197 | RTDECL(int) RTAvloGCPhysDestroy(PAVLOGCPHYSTREE pTree, PAVLOGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
198 |
|
---|
199 | /** @} */
|
---|
200 |
|
---|
201 |
|
---|
202 | /** AVL tree of RTGCPHYS ranges - using relative offsets internally.
|
---|
203 | * @{
|
---|
204 | */
|
---|
205 |
|
---|
206 | /**
|
---|
207 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
208 | */
|
---|
209 | typedef int32_t AVLROGCPHYS;
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * AVL Core node.
|
---|
213 | */
|
---|
214 | typedef struct _AVLROGCPhysNodeCore
|
---|
215 | {
|
---|
216 | /** First key value in the range (inclusive). */
|
---|
217 | RTGCPHYS Key;
|
---|
218 | /** Last key value in the range (inclusive). */
|
---|
219 | RTGCPHYS KeyLast;
|
---|
220 | /** Offset to the left leaf node, relative to this field. */
|
---|
221 | AVLROGCPHYS pLeft;
|
---|
222 | /** Offset to the right leaf node, relative to this field. */
|
---|
223 | AVLROGCPHYS pRight;
|
---|
224 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
225 | unsigned char uchHeight;
|
---|
226 | } AVLROGCPHYSNODECORE, *PAVLROGCPHYSNODECORE;
|
---|
227 |
|
---|
228 | /** A offset base tree with uint32_t keys. */
|
---|
229 | typedef AVLROGCPHYS AVLROGCPHYSTREE;
|
---|
230 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
231 | typedef AVLROGCPHYSTREE *PAVLROGCPHYSTREE;
|
---|
232 |
|
---|
233 | /** Pointer to an internal tree pointer.
|
---|
234 | * In this case it's a pointer to a relative offset. */
|
---|
235 | typedef AVLROGCPHYSTREE *PPAVLROGCPHYSNODECORE;
|
---|
236 |
|
---|
237 | /** Callback function for RTAvlroGCPhysDoWithAll() and RTAvlroGCPhysDestroy(). */
|
---|
238 | typedef DECLCALLBACK(int) AVLROGCPHYSCALLBACK(PAVLROGCPHYSNODECORE pNode, void *pvUser);
|
---|
239 | /** Pointer to callback function for RTAvlroGCPhysDoWithAll() and RTAvlroGCPhysDestroy(). */
|
---|
240 | typedef AVLROGCPHYSCALLBACK *PAVLROGCPHYSCALLBACK;
|
---|
241 |
|
---|
242 | RTDECL(bool) RTAvlroGCPhysInsert(PAVLROGCPHYSTREE pTree, PAVLROGCPHYSNODECORE pNode);
|
---|
243 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysRemove(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
244 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGet(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
245 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysRangeGet(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
246 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysRangeRemove(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
247 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetBestFit(PAVLROGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
248 | RTDECL(int) RTAvlroGCPhysDoWithAll(PAVLROGCPHYSTREE pTree, int fFromLeft, PAVLROGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
249 | RTDECL(int) RTAvlroGCPhysDestroy(PAVLROGCPHYSTREE pTree, PAVLROGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
250 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetRoot(PAVLROGCPHYSTREE pTree);
|
---|
251 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetLeft(PAVLROGCPHYSNODECORE pNode);
|
---|
252 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetRight(PAVLROGCPHYSNODECORE pNode);
|
---|
253 |
|
---|
254 | /** @} */
|
---|
255 |
|
---|
256 |
|
---|
257 | /** AVL tree of RTGCPTRs.
|
---|
258 | * @{
|
---|
259 | */
|
---|
260 |
|
---|
261 | /**
|
---|
262 | * AVL Core node.
|
---|
263 | */
|
---|
264 | typedef struct _AVLGCPtrNodeCore
|
---|
265 | {
|
---|
266 | /** Key value. */
|
---|
267 | RTGCPTR Key;
|
---|
268 | /** Pointer to the left node. */
|
---|
269 | struct _AVLGCPtrNodeCore *pLeft;
|
---|
270 | /** Pointer to the right node. */
|
---|
271 | struct _AVLGCPtrNodeCore *pRight;
|
---|
272 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
273 | unsigned char uchHeight;
|
---|
274 | } AVLGCPTRNODECORE, *PAVLGCPTRNODECORE, **PPAVLGCPTRNODECORE;
|
---|
275 |
|
---|
276 | /** A tree of RTGCPTR keys. */
|
---|
277 | typedef PAVLGCPTRNODECORE AVLGCPTRTREE;
|
---|
278 | /** Pointer to a tree of RTGCPTR keys. */
|
---|
279 | typedef PPAVLGCPTRNODECORE PAVLGCPTRTREE;
|
---|
280 |
|
---|
281 | /** Callback function for RTAvlGCPtrDoWithAll(). */
|
---|
282 | typedef DECLCALLBACK(int) AVLGCPTRCALLBACK(PAVLGCPTRNODECORE pNode, void *pvUser);
|
---|
283 | /** Pointer to callback function for RTAvlGCPtrDoWithAll(). */
|
---|
284 | typedef AVLGCPTRCALLBACK *PAVLGCPTRCALLBACK;
|
---|
285 |
|
---|
286 | RTDECL(bool) RTAvlGCPtrInsert(PAVLGCPTRTREE pTree, PAVLGCPTRNODECORE pNode);
|
---|
287 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrRemove(PAVLGCPTRTREE pTree, RTGCPTR Key);
|
---|
288 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrGet(PAVLGCPTRTREE pTree, RTGCPTR Key);
|
---|
289 | RTDECL(int) RTAvlGCPtrDoWithAll(PAVLGCPTRTREE pTree, int fFromLeft, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
290 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrGetBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
291 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrRemoveBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
292 | RTDECL(int) RTAvlGCPtrDestroy(PAVLGCPTRTREE pTree, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
293 |
|
---|
294 | /** @} */
|
---|
295 |
|
---|
296 |
|
---|
297 | /** AVL tree of RTGCPTRs - using relative offsets internally.
|
---|
298 | * @{
|
---|
299 | */
|
---|
300 |
|
---|
301 | /**
|
---|
302 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
303 | */
|
---|
304 | typedef int32_t AVLOGCPTR;
|
---|
305 |
|
---|
306 | /**
|
---|
307 | * AVL Core node.
|
---|
308 | */
|
---|
309 | typedef struct _AVLOGCPtrNodeCore
|
---|
310 | {
|
---|
311 | /** Key value. */
|
---|
312 | RTGCPTR Key;
|
---|
313 | /** Offset to the left leaf node, relative to this field. */
|
---|
314 | AVLOGCPTR pLeft;
|
---|
315 | /** Offset to the right leaf node, relative to this field. */
|
---|
316 | AVLOGCPTR pRight;
|
---|
317 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
318 | unsigned char uchHeight;
|
---|
319 | } AVLOGCPTRNODECORE, *PAVLOGCPTRNODECORE;
|
---|
320 |
|
---|
321 | /** A offset base tree with uint32_t keys. */
|
---|
322 | typedef AVLOGCPTR AVLOGCPTRTREE;
|
---|
323 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
324 | typedef AVLOGCPTRTREE *PAVLOGCPTRTREE;
|
---|
325 |
|
---|
326 | /** Pointer to an internal tree pointer.
|
---|
327 | * In this case it's a pointer to a relative offset. */
|
---|
328 | typedef AVLOGCPTRTREE *PPAVLOGCPTRNODECORE;
|
---|
329 |
|
---|
330 | /** Callback function for RTAvloGCPtrDoWithAll(). */
|
---|
331 | typedef DECLCALLBACK(int) AVLOGCPTRCALLBACK(PAVLOGCPTRNODECORE pNode, void *pvUser);
|
---|
332 | /** Pointer to callback function for RTAvloGCPtrDoWithAll(). */
|
---|
333 | typedef AVLOGCPTRCALLBACK *PAVLOGCPTRCALLBACK;
|
---|
334 |
|
---|
335 | RTDECL(bool) RTAvloGCPtrInsert(PAVLOGCPTRTREE pTree, PAVLOGCPTRNODECORE pNode);
|
---|
336 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrRemove(PAVLOGCPTRTREE pTree, RTGCPTR Key);
|
---|
337 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrGet(PAVLOGCPTRTREE pTree, RTGCPTR Key);
|
---|
338 | RTDECL(int) RTAvloGCPtrDoWithAll(PAVLOGCPTRTREE pTree, int fFromLeft, PAVLOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
339 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrGetBestFit(PAVLOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
340 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrRemoveBestFit(PAVLOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
341 | RTDECL(int) RTAvloGCPtrDestroy(PAVLOGCPTRTREE pTree, PAVLOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
342 |
|
---|
343 | /** @} */
|
---|
344 |
|
---|
345 |
|
---|
346 | /** AVL tree of RTGCPTR ranges.
|
---|
347 | * @{
|
---|
348 | */
|
---|
349 |
|
---|
350 | /**
|
---|
351 | * AVL Core node.
|
---|
352 | */
|
---|
353 | typedef struct _AVLRGCPtrNodeCore
|
---|
354 | {
|
---|
355 | /** First key value in the range (inclusive). */
|
---|
356 | RTGCPTR Key;
|
---|
357 | /** Last key value in the range (inclusive). */
|
---|
358 | RTGCPTR KeyLast;
|
---|
359 | /** Offset to the left leaf node, relative to this field. */
|
---|
360 | struct _AVLRGCPtrNodeCore *pLeft;
|
---|
361 | /** Offset to the right leaf node, relative to this field. */
|
---|
362 | struct _AVLRGCPtrNodeCore *pRight;
|
---|
363 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
364 | unsigned char uchHeight;
|
---|
365 | } AVLRGCPTRNODECORE, *PAVLRGCPTRNODECORE;
|
---|
366 |
|
---|
367 | /** A offset base tree with RTGCPTR keys. */
|
---|
368 | typedef PAVLRGCPTRNODECORE AVLRGCPTRTREE;
|
---|
369 | /** Pointer to a offset base tree with RTGCPTR keys. */
|
---|
370 | typedef AVLRGCPTRTREE *PAVLRGCPTRTREE;
|
---|
371 |
|
---|
372 | /** Pointer to an internal tree pointer.
|
---|
373 | * In this case it's a pointer to a relative offset. */
|
---|
374 | typedef AVLRGCPTRTREE *PPAVLRGCPTRNODECORE;
|
---|
375 |
|
---|
376 | /** Callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
|
---|
377 | typedef DECLCALLBACK(int) AVLRGCPTRCALLBACK(PAVLRGCPTRNODECORE pNode, void *pvUser);
|
---|
378 | /** Pointer to callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
|
---|
379 | typedef AVLRGCPTRCALLBACK *PAVLRGCPTRCALLBACK;
|
---|
380 |
|
---|
381 | RTDECL(bool) RTAvlrGCPtrInsert( PAVLRGCPTRTREE pTree, PAVLRGCPTRNODECORE pNode);
|
---|
382 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrRemove( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
383 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGet( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
384 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetBestFit( PAVLRGCPTRTREE pTree, RTGCPTR Key, bool fAbove);
|
---|
385 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrRangeGet( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
386 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrRangeRemove( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
387 | RTDECL(int) RTAvlrGCPtrDoWithAll( PAVLRGCPTRTREE pTree, int fFromLeft, PAVLRGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
388 | RTDECL(int) RTAvlrGCPtrDestroy( PAVLRGCPTRTREE pTree, PAVLRGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
389 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetRoot( PAVLRGCPTRTREE pTree);
|
---|
390 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetLeft( PAVLRGCPTRNODECORE pNode);
|
---|
391 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetRight( PAVLRGCPTRNODECORE pNode);
|
---|
392 |
|
---|
393 | /** @} */
|
---|
394 |
|
---|
395 |
|
---|
396 | /** AVL tree of RTGCPTR ranges - using relative offsets internally.
|
---|
397 | * @{
|
---|
398 | */
|
---|
399 |
|
---|
400 | /**
|
---|
401 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
402 | */
|
---|
403 | typedef int32_t AVLROGCPTR;
|
---|
404 |
|
---|
405 | /**
|
---|
406 | * AVL Core node.
|
---|
407 | */
|
---|
408 | typedef struct _AVLROGCPtrNodeCore
|
---|
409 | {
|
---|
410 | /** First key value in the range (inclusive). */
|
---|
411 | RTGCPTR Key;
|
---|
412 | /** Last key value in the range (inclusive). */
|
---|
413 | RTGCPTR KeyLast;
|
---|
414 | /** Offset to the left leaf node, relative to this field. */
|
---|
415 | AVLROGCPTR pLeft;
|
---|
416 | /** Offset to the right leaf node, relative to this field. */
|
---|
417 | AVLROGCPTR pRight;
|
---|
418 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
419 | unsigned char uchHeight;
|
---|
420 | } AVLROGCPTRNODECORE, *PAVLROGCPTRNODECORE;
|
---|
421 |
|
---|
422 | /** A offset base tree with uint32_t keys. */
|
---|
423 | typedef AVLROGCPTR AVLROGCPTRTREE;
|
---|
424 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
425 | typedef AVLROGCPTRTREE *PAVLROGCPTRTREE;
|
---|
426 |
|
---|
427 | /** Pointer to an internal tree pointer.
|
---|
428 | * In this case it's a pointer to a relative offset. */
|
---|
429 | typedef AVLROGCPTRTREE *PPAVLROGCPTRNODECORE;
|
---|
430 |
|
---|
431 | /** Callback function for RTAvlroGCPtrDoWithAll() and RTAvlroGCPtrDestroy(). */
|
---|
432 | typedef DECLCALLBACK(int) AVLROGCPTRCALLBACK(PAVLROGCPTRNODECORE pNode, void *pvUser);
|
---|
433 | /** Pointer to callback function for RTAvlroGCPtrDoWithAll() and RTAvlroGCPtrDestroy(). */
|
---|
434 | typedef AVLROGCPTRCALLBACK *PAVLROGCPTRCALLBACK;
|
---|
435 |
|
---|
436 | RTDECL(bool) RTAvlroGCPtrInsert(PAVLROGCPTRTREE pTree, PAVLROGCPTRNODECORE pNode);
|
---|
437 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrRemove(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
438 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGet(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
439 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetBestFit(PAVLROGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
440 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrRangeGet(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
441 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrRangeRemove(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
442 | RTDECL(int) RTAvlroGCPtrDoWithAll(PAVLROGCPTRTREE pTree, int fFromLeft, PAVLROGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
443 | RTDECL(int) RTAvlroGCPtrDestroy(PAVLROGCPTRTREE pTree, PAVLROGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
444 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetRoot(PAVLROGCPTRTREE pTree);
|
---|
445 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetLeft(PAVLROGCPTRNODECORE pNode);
|
---|
446 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetRight(PAVLROGCPTRNODECORE pNode);
|
---|
447 |
|
---|
448 | /** @} */
|
---|
449 |
|
---|
450 |
|
---|
451 | /** AVL tree of RTGCPTR ranges (overlapping supported) - using relative offsets internally.
|
---|
452 | * @{
|
---|
453 | */
|
---|
454 |
|
---|
455 | /**
|
---|
456 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
457 | */
|
---|
458 | typedef int32_t AVLROOGCPTR;
|
---|
459 |
|
---|
460 | /**
|
---|
461 | * AVL Core node.
|
---|
462 | */
|
---|
463 | typedef struct _AVLROOGCPtrNodeCore
|
---|
464 | {
|
---|
465 | /** First key value in the range (inclusive). */
|
---|
466 | RTGCPTR Key;
|
---|
467 | /** Last key value in the range (inclusive). */
|
---|
468 | RTGCPTR KeyLast;
|
---|
469 | /** Offset to the left leaf node, relative to this field. */
|
---|
470 | AVLROOGCPTR pLeft;
|
---|
471 | /** Offset to the right leaf node, relative to this field. */
|
---|
472 | AVLROOGCPTR pRight;
|
---|
473 | /** Pointer to the list of string with the same key. Don't touch. */
|
---|
474 | AVLROOGCPTR pList;
|
---|
475 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
476 | unsigned char uchHeight;
|
---|
477 | } AVLROOGCPTRNODECORE, *PAVLROOGCPTRNODECORE;
|
---|
478 |
|
---|
479 | /** A offset base tree with uint32_t keys. */
|
---|
480 | typedef AVLROOGCPTR AVLROOGCPTRTREE;
|
---|
481 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
482 | typedef AVLROOGCPTRTREE *PAVLROOGCPTRTREE;
|
---|
483 |
|
---|
484 | /** Pointer to an internal tree pointer.
|
---|
485 | * In this case it's a pointer to a relative offset. */
|
---|
486 | typedef AVLROOGCPTRTREE *PPAVLROOGCPTRNODECORE;
|
---|
487 |
|
---|
488 | /** Callback function for RTAvlrooGCPtrDoWithAll() and RTAvlrooGCPtrDestroy(). */
|
---|
489 | typedef DECLCALLBACK(int) AVLROOGCPTRCALLBACK(PAVLROOGCPTRNODECORE pNode, void *pvUser);
|
---|
490 | /** Pointer to callback function for RTAvlrooGCPtrDoWithAll() and RTAvlrooGCPtrDestroy(). */
|
---|
491 | typedef AVLROOGCPTRCALLBACK *PAVLROOGCPTRCALLBACK;
|
---|
492 |
|
---|
493 | RTDECL(bool) RTAvlrooGCPtrInsert(PAVLROOGCPTRTREE pTree, PAVLROOGCPTRNODECORE pNode);
|
---|
494 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrRemove(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
495 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGet(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
496 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetBestFit(PAVLROOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
497 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrRangeGet(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
498 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrRangeRemove(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
499 | RTDECL(int) RTAvlrooGCPtrDoWithAll(PAVLROOGCPTRTREE pTree, int fFromLeft, PAVLROOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
500 | RTDECL(int) RTAvlrooGCPtrDestroy(PAVLROOGCPTRTREE pTree, PAVLROOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
501 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetRoot(PAVLROOGCPTRTREE pTree);
|
---|
502 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetLeft(PAVLROOGCPTRNODECORE pNode);
|
---|
503 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetRight(PAVLROOGCPTRNODECORE pNode);
|
---|
504 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetNextEqual(PAVLROOGCPTRNODECORE pNode);
|
---|
505 |
|
---|
506 | /** @} */
|
---|
507 |
|
---|
508 |
|
---|
509 | /** AVL tree of RTHCPHYSes - using relative offsets internally.
|
---|
510 | * @{
|
---|
511 | */
|
---|
512 |
|
---|
513 | /**
|
---|
514 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
515 | */
|
---|
516 | typedef int32_t AVLOHCPHYS;
|
---|
517 |
|
---|
518 | /**
|
---|
519 | * AVL Core node.
|
---|
520 | */
|
---|
521 | typedef struct _AVLOHCPhysNodeCore
|
---|
522 | {
|
---|
523 | /** Key value. */
|
---|
524 | RTHCPHYS Key;
|
---|
525 | /** Offset to the left leaf node, relative to this field. */
|
---|
526 | AVLOHCPHYS pLeft;
|
---|
527 | /** Offset to the right leaf node, relative to this field. */
|
---|
528 | AVLOHCPHYS pRight;
|
---|
529 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
530 | unsigned char uchHeight;
|
---|
531 | #if HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64
|
---|
532 | unsigned char Padding[7]; /**< Alignment padding. */
|
---|
533 | #endif
|
---|
534 | } AVLOHCPHYSNODECORE, *PAVLOHCPHYSNODECORE;
|
---|
535 |
|
---|
536 | /** A offset base tree with uint32_t keys. */
|
---|
537 | typedef AVLOHCPHYS AVLOHCPHYSTREE;
|
---|
538 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
539 | typedef AVLOHCPHYSTREE *PAVLOHCPHYSTREE;
|
---|
540 |
|
---|
541 | /** Pointer to an internal tree pointer.
|
---|
542 | * In this case it's a pointer to a relative offset. */
|
---|
543 | typedef AVLOHCPHYSTREE *PPAVLOHCPHYSNODECORE;
|
---|
544 |
|
---|
545 | /** Callback function for RTAvloHCPhysDoWithAll() and RTAvloHCPhysDestroy(). */
|
---|
546 | typedef DECLCALLBACK(int) AVLOHCPHYSCALLBACK(PAVLOHCPHYSNODECORE pNode, void *pvUser);
|
---|
547 | /** Pointer to callback function for RTAvloHCPhysDoWithAll() and RTAvloHCPhysDestroy(). */
|
---|
548 | typedef AVLOHCPHYSCALLBACK *PAVLOHCPHYSCALLBACK;
|
---|
549 |
|
---|
550 | RTDECL(bool) RTAvloHCPhysInsert(PAVLOHCPHYSTREE pTree, PAVLOHCPHYSNODECORE pNode);
|
---|
551 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysRemove(PAVLOHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
552 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysGet(PAVLOHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
553 | RTDECL(int) RTAvloHCPhysDoWithAll(PAVLOHCPHYSTREE pTree, int fFromLeft, PAVLOHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
554 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysGetBestFit(PAVLOHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
555 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysRemoveBestFit(PAVLOHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
556 | RTDECL(int) RTAvloHCPhysDestroy(PAVLOHCPHYSTREE pTree, PAVLOHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
557 |
|
---|
558 | /** @} */
|
---|
559 |
|
---|
560 |
|
---|
561 |
|
---|
562 | /** AVL tree of RTIOPORTs - using relative offsets internally.
|
---|
563 | * @{
|
---|
564 | */
|
---|
565 |
|
---|
566 | /**
|
---|
567 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
568 | */
|
---|
569 | typedef int32_t AVLOIOPORTPTR;
|
---|
570 |
|
---|
571 | /**
|
---|
572 | * AVL Core node.
|
---|
573 | */
|
---|
574 | typedef struct _AVLOIOPortNodeCore
|
---|
575 | {
|
---|
576 | /** Offset to the left leaf node, relative to this field. */
|
---|
577 | AVLOIOPORTPTR pLeft;
|
---|
578 | /** Offset to the right leaf node, relative to this field. */
|
---|
579 | AVLOIOPORTPTR pRight;
|
---|
580 | /** Key value. */
|
---|
581 | RTIOPORT Key;
|
---|
582 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
583 | unsigned char uchHeight;
|
---|
584 | } AVLOIOPORTNODECORE, *PAVLOIOPORTNODECORE;
|
---|
585 |
|
---|
586 | /** A offset base tree with uint32_t keys. */
|
---|
587 | typedef AVLOIOPORTPTR AVLOIOPORTTREE;
|
---|
588 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
589 | typedef AVLOIOPORTTREE *PAVLOIOPORTTREE;
|
---|
590 |
|
---|
591 | /** Pointer to an internal tree pointer.
|
---|
592 | * In this case it's a pointer to a relative offset. */
|
---|
593 | typedef AVLOIOPORTTREE *PPAVLOIOPORTNODECORE;
|
---|
594 |
|
---|
595 | /** Callback function for RTAvloIOPortDoWithAll() and RTAvloIOPortDestroy(). */
|
---|
596 | typedef DECLCALLBACK(int) AVLOIOPORTCALLBACK(PAVLOIOPORTNODECORE pNode, void *pvUser);
|
---|
597 | /** Pointer to callback function for RTAvloIOPortDoWithAll() and RTAvloIOPortDestroy(). */
|
---|
598 | typedef AVLOIOPORTCALLBACK *PAVLOIOPORTCALLBACK;
|
---|
599 |
|
---|
600 | RTDECL(bool) RTAvloIOPortInsert(PAVLOIOPORTTREE pTree, PAVLOIOPORTNODECORE pNode);
|
---|
601 | RTDECL(PAVLOIOPORTNODECORE) RTAvloIOPortRemove(PAVLOIOPORTTREE pTree, RTIOPORT Key);
|
---|
602 | RTDECL(PAVLOIOPORTNODECORE) RTAvloIOPortGet(PAVLOIOPORTTREE pTree, RTIOPORT Key);
|
---|
603 | RTDECL(int) RTAvloIOPortDoWithAll(PAVLOIOPORTTREE pTree, int fFromLeft, PAVLOIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
604 | RTDECL(int) RTAvloIOPortDestroy(PAVLOIOPORTTREE pTree, PAVLOIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
605 |
|
---|
606 | /** @} */
|
---|
607 |
|
---|
608 |
|
---|
609 | /** AVL tree of RTIOPORT ranges - using relative offsets internally.
|
---|
610 | * @{
|
---|
611 | */
|
---|
612 |
|
---|
613 | /**
|
---|
614 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
615 | */
|
---|
616 | typedef int32_t AVLROIOPORTPTR;
|
---|
617 |
|
---|
618 | /**
|
---|
619 | * AVL Core node.
|
---|
620 | */
|
---|
621 | typedef struct _AVLROIOPortNodeCore
|
---|
622 | {
|
---|
623 | /** First key value in the range (inclusive). */
|
---|
624 | RTIOPORT Key;
|
---|
625 | /** Last key value in the range (inclusive). */
|
---|
626 | RTIOPORT KeyLast;
|
---|
627 | /** Offset to the left leaf node, relative to this field. */
|
---|
628 | AVLROIOPORTPTR pLeft;
|
---|
629 | /** Offset to the right leaf node, relative to this field. */
|
---|
630 | AVLROIOPORTPTR pRight;
|
---|
631 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
632 | unsigned char uchHeight;
|
---|
633 | } AVLROIOPORTNODECORE, *PAVLROIOPORTNODECORE;
|
---|
634 |
|
---|
635 | /** A offset base tree with uint32_t keys. */
|
---|
636 | typedef AVLROIOPORTPTR AVLROIOPORTTREE;
|
---|
637 | /** Pointer to a offset base tree with uint32_t keys. */
|
---|
638 | typedef AVLROIOPORTTREE *PAVLROIOPORTTREE;
|
---|
639 |
|
---|
640 | /** Pointer to an internal tree pointer.
|
---|
641 | * In this case it's a pointer to a relative offset. */
|
---|
642 | typedef AVLROIOPORTTREE *PPAVLROIOPORTNODECORE;
|
---|
643 |
|
---|
644 | /** Callback function for RTAvlroIOPortDoWithAll() and RTAvlroIOPortDestroy(). */
|
---|
645 | typedef DECLCALLBACK(int) AVLROIOPORTCALLBACK(PAVLROIOPORTNODECORE pNode, void *pvUser);
|
---|
646 | /** Pointer to callback function for RTAvlroIOPortDoWithAll() and RTAvlroIOPortDestroy(). */
|
---|
647 | typedef AVLROIOPORTCALLBACK *PAVLROIOPORTCALLBACK;
|
---|
648 |
|
---|
649 | RTDECL(bool) RTAvlroIOPortInsert(PAVLROIOPORTTREE pTree, PAVLROIOPORTNODECORE pNode);
|
---|
650 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortRemove(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
651 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortGet(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
652 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortRangeGet(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
653 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortRangeRemove(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
654 | RTDECL(int) RTAvlroIOPortDoWithAll(PAVLROIOPORTTREE pTree, int fFromLeft, PAVLROIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
655 | RTDECL(int) RTAvlroIOPortDestroy(PAVLROIOPORTTREE pTree, PAVLROIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
656 |
|
---|
657 | /** @} */
|
---|
658 |
|
---|
659 |
|
---|
660 | /** AVL tree of RTHCPHYSes.
|
---|
661 | * @{
|
---|
662 | */
|
---|
663 |
|
---|
664 | /**
|
---|
665 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
666 | */
|
---|
667 | typedef struct _AVLHCPhysNodeCore *AVLHCPHYSPTR;
|
---|
668 |
|
---|
669 | /**
|
---|
670 | * AVL Core node.
|
---|
671 | */
|
---|
672 | typedef struct _AVLHCPhysNodeCore
|
---|
673 | {
|
---|
674 | /** Offset to the left leaf node, relative to this field. */
|
---|
675 | AVLHCPHYSPTR pLeft;
|
---|
676 | /** Offset to the right leaf node, relative to this field. */
|
---|
677 | AVLHCPHYSPTR pRight;
|
---|
678 | /** Key value. */
|
---|
679 | RTHCPHYS Key;
|
---|
680 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
681 | unsigned char uchHeight;
|
---|
682 | } AVLHCPHYSNODECORE, *PAVLHCPHYSNODECORE;
|
---|
683 |
|
---|
684 | /** A offset base tree with RTHCPHYS keys. */
|
---|
685 | typedef AVLHCPHYSPTR AVLHCPHYSTREE;
|
---|
686 | /** Pointer to a offset base tree with RTHCPHYS keys. */
|
---|
687 | typedef AVLHCPHYSTREE *PAVLHCPHYSTREE;
|
---|
688 |
|
---|
689 | /** Pointer to an internal tree pointer.
|
---|
690 | * In this case it's a pointer to a relative offset. */
|
---|
691 | typedef AVLHCPHYSTREE *PPAVLHCPHYSNODECORE;
|
---|
692 |
|
---|
693 | /** Callback function for RTAvlHCPhysDoWithAll() and RTAvlHCPhysDestroy(). */
|
---|
694 | typedef DECLCALLBACK(int) AVLHCPHYSCALLBACK(PAVLHCPHYSNODECORE pNode, void *pvUser);
|
---|
695 | /** Pointer to callback function for RTAvlHCPhysDoWithAll() and RTAvlHCPhysDestroy(). */
|
---|
696 | typedef AVLHCPHYSCALLBACK *PAVLHCPHYSCALLBACK;
|
---|
697 |
|
---|
698 | RTDECL(bool) RTAvlHCPhysInsert(PAVLHCPHYSTREE pTree, PAVLHCPHYSNODECORE pNode);
|
---|
699 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysRemove(PAVLHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
700 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysGet(PAVLHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
701 | RTDECL(int) RTAvlHCPhysDoWithAll(PAVLHCPHYSTREE pTree, int fFromLeft, PAVLHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
702 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysGetBestFit(PAVLHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
703 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysRemoveBestFit(PAVLHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
704 | RTDECL(int) RTAvlHCPhysDestroy(PAVLHCPHYSTREE pTree, PAVLHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
705 |
|
---|
706 | /** @} */
|
---|
707 |
|
---|
708 |
|
---|
709 | /** @} */
|
---|
710 |
|
---|
711 | __END_DECLS
|
---|
712 |
|
---|
713 | #endif
|
---|
714 |
|
---|