1 | /** @file
|
---|
2 | * IPRT - AVL Trees.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 1999-2012 knut st. osmundsen <[email protected]>
|
---|
7 | *
|
---|
8 | * Permission is hereby granted, free of charge, to any person
|
---|
9 | * obtaining a copy of this software and associated documentation
|
---|
10 | * files (the "Software"), to deal in the Software without
|
---|
11 | * restriction, including without limitation the rights to use,
|
---|
12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
13 | * copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following
|
---|
15 | * conditions:
|
---|
16 | *
|
---|
17 | * The above copyright notice and this permission notice shall be
|
---|
18 | * included in all copies or substantial portions of the Software.
|
---|
19 | *
|
---|
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
27 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___iprt_avl_h
|
---|
31 | #define ___iprt_avl_h
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 | RT_C_DECLS_BEGIN
|
---|
37 |
|
---|
38 | /** @defgroup grp_rt_avl RTAvl - AVL Trees
|
---|
39 | * @ingroup grp_rt
|
---|
40 | * @{
|
---|
41 | */
|
---|
42 |
|
---|
43 |
|
---|
44 | /** AVL tree of void pointers.
|
---|
45 | * @{
|
---|
46 | */
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * AVL key type
|
---|
50 | */
|
---|
51 | typedef void * AVLPVKEY;
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * AVL Core node.
|
---|
55 | */
|
---|
56 | typedef struct _AVLPVNodeCore
|
---|
57 | {
|
---|
58 | AVLPVKEY Key; /** Key value. */
|
---|
59 | struct _AVLPVNodeCore *pLeft; /** Pointer to left leaf node. */
|
---|
60 | struct _AVLPVNodeCore *pRight; /** Pointer to right leaf node. */
|
---|
61 | unsigned char uchHeight; /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
62 | } AVLPVNODECORE, *PAVLPVNODECORE, **PPAVLPVNODECORE;
|
---|
63 |
|
---|
64 | /** A tree with void pointer keys. */
|
---|
65 | typedef PAVLPVNODECORE AVLPVTREE;
|
---|
66 | /** Pointer to a tree with void pointer keys. */
|
---|
67 | typedef PPAVLPVNODECORE PAVLPVTREE;
|
---|
68 |
|
---|
69 | /** Callback function for AVLPVDoWithAll().
|
---|
70 | * @returns IPRT status codes. */
|
---|
71 | typedef DECLCALLBACK(int) AVLPVCALLBACK(PAVLPVNODECORE, void *);
|
---|
72 | /** Pointer to callback function for AVLPVDoWithAll(). */
|
---|
73 | typedef AVLPVCALLBACK *PAVLPVCALLBACK;
|
---|
74 |
|
---|
75 | /*
|
---|
76 | * Functions.
|
---|
77 | */
|
---|
78 | RTDECL(bool) RTAvlPVInsert(PAVLPVTREE ppTree, PAVLPVNODECORE pNode);
|
---|
79 | RTDECL(PAVLPVNODECORE) RTAvlPVRemove(PAVLPVTREE ppTree, AVLPVKEY Key);
|
---|
80 | RTDECL(PAVLPVNODECORE) RTAvlPVGet(PAVLPVTREE ppTree, AVLPVKEY Key);
|
---|
81 | RTDECL(PAVLPVNODECORE) RTAvlPVGetBestFit(PAVLPVTREE ppTree, AVLPVKEY Key, bool fAbove);
|
---|
82 | RTDECL(PAVLPVNODECORE) RTAvlPVRemoveBestFit(PAVLPVTREE ppTree, AVLPVKEY Key, bool fAbove);
|
---|
83 | RTDECL(int) RTAvlPVDoWithAll(PAVLPVTREE ppTree, int fFromLeft, PAVLPVCALLBACK pfnCallBack, void *pvParam);
|
---|
84 | RTDECL(int) RTAvlPVDestroy(PAVLPVTREE ppTree, PAVLPVCALLBACK pfnCallBack, void *pvParam);
|
---|
85 |
|
---|
86 | /** @} */
|
---|
87 |
|
---|
88 |
|
---|
89 | /** AVL tree of unsigned long.
|
---|
90 | * @{
|
---|
91 | */
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * AVL key type
|
---|
95 | */
|
---|
96 | typedef unsigned long AVLULKEY;
|
---|
97 |
|
---|
98 | /**
|
---|
99 | * AVL Core node.
|
---|
100 | */
|
---|
101 | typedef struct _AVLULNodeCore
|
---|
102 | {
|
---|
103 | AVLULKEY Key; /** Key value. */
|
---|
104 | struct _AVLULNodeCore *pLeft; /** Pointer to left leaf node. */
|
---|
105 | struct _AVLULNodeCore *pRight; /** Pointer to right leaf node. */
|
---|
106 | unsigned char uchHeight; /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
107 | } AVLULNODECORE, *PAVLULNODECORE, **PPAVLULNODECORE;
|
---|
108 |
|
---|
109 |
|
---|
110 | /** Callback function for AVLULDoWithAll().
|
---|
111 | * @returns IPRT status codes. */
|
---|
112 | typedef DECLCALLBACK(int) AVLULCALLBACK(PAVLULNODECORE, void*);
|
---|
113 | /** Pointer to callback function for AVLULDoWithAll(). */
|
---|
114 | typedef AVLULCALLBACK *PAVLULCALLBACK;
|
---|
115 |
|
---|
116 |
|
---|
117 | /*
|
---|
118 | * Functions.
|
---|
119 | */
|
---|
120 | RTDECL(bool) RTAvlULInsert(PPAVLULNODECORE ppTree, PAVLULNODECORE pNode);
|
---|
121 | RTDECL(PAVLULNODECORE) RTAvlULRemove(PPAVLULNODECORE ppTree, AVLULKEY Key);
|
---|
122 | RTDECL(PAVLULNODECORE) RTAvlULGet(PPAVLULNODECORE ppTree, AVLULKEY Key);
|
---|
123 | RTDECL(PAVLULNODECORE) RTAvlULGetBestFit(PPAVLULNODECORE ppTree, AVLULKEY Key, bool fAbove);
|
---|
124 | RTDECL(PAVLULNODECORE) RTAvlULRemoveBestFit(PPAVLULNODECORE ppTree, AVLULKEY Key, bool fAbove);
|
---|
125 | RTDECL(int) RTAvlULDoWithAll(PPAVLULNODECORE ppTree, int fFromLeft, PAVLULCALLBACK pfnCallBack, void *pvParam);
|
---|
126 | RTDECL(int) RTAvlULDestroy(PPAVLULNODECORE pTree, PAVLULCALLBACK pfnCallBack, void *pvParam);
|
---|
127 |
|
---|
128 | /** @} */
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 | /** AVL tree of void pointer ranges.
|
---|
133 | * @{
|
---|
134 | */
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * AVL key type
|
---|
138 | */
|
---|
139 | typedef void *AVLRPVKEY;
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * AVL Core node.
|
---|
143 | */
|
---|
144 | typedef struct AVLRPVNodeCore
|
---|
145 | {
|
---|
146 | AVLRPVKEY Key; /**< First key value in the range (inclusive). */
|
---|
147 | AVLRPVKEY KeyLast; /**< Last key value in the range (inclusive). */
|
---|
148 | struct AVLRPVNodeCore *pLeft; /**< Pointer to left leaf node. */
|
---|
149 | struct AVLRPVNodeCore *pRight; /**< Pointer to right leaf node. */
|
---|
150 | unsigned char uchHeight; /**< Height of this tree: max(height(left), height(right)) + 1 */
|
---|
151 | } AVLRPVNODECORE, *PAVLRPVNODECORE, **PPAVLRPVNODECORE;
|
---|
152 |
|
---|
153 | /** A tree with void pointer keys. */
|
---|
154 | typedef PAVLRPVNODECORE AVLRPVTREE;
|
---|
155 | /** Pointer to a tree with void pointer keys. */
|
---|
156 | typedef PPAVLRPVNODECORE PAVLRPVTREE;
|
---|
157 |
|
---|
158 | /** Callback function for AVLPVDoWithAll().
|
---|
159 | * @returns IPRT status codes. */
|
---|
160 | typedef DECLCALLBACK(int) AVLRPVCALLBACK(PAVLRPVNODECORE, void *);
|
---|
161 | /** Pointer to callback function for AVLPVDoWithAll(). */
|
---|
162 | typedef AVLRPVCALLBACK *PAVLRPVCALLBACK;
|
---|
163 |
|
---|
164 | /*
|
---|
165 | * Functions.
|
---|
166 | */
|
---|
167 | RTDECL(bool) RTAvlrPVInsert(PAVLRPVTREE ppTree, PAVLRPVNODECORE pNode);
|
---|
168 | RTDECL(PAVLRPVNODECORE) RTAvlrPVRemove(PAVLRPVTREE ppTree, AVLRPVKEY Key);
|
---|
169 | RTDECL(PAVLRPVNODECORE) RTAvlrPVGet(PAVLRPVTREE ppTree, AVLRPVKEY Key);
|
---|
170 | RTDECL(PAVLRPVNODECORE) RTAvlrPVRangeGet(PAVLRPVTREE ppTree, AVLRPVKEY Key);
|
---|
171 | RTDECL(PAVLRPVNODECORE) RTAvlrPVRangeRemove(PAVLRPVTREE ppTree, AVLRPVKEY Key);
|
---|
172 | RTDECL(PAVLRPVNODECORE) RTAvlrPVGetBestFit(PAVLRPVTREE ppTree, AVLRPVKEY Key, bool fAbove);
|
---|
173 | RTDECL(PAVLRPVNODECORE) RTAvlrPVRemoveBestFit(PAVLRPVTREE ppTree, AVLRPVKEY Key, bool fAbove);
|
---|
174 | RTDECL(int) RTAvlrPVDoWithAll(PAVLRPVTREE ppTree, int fFromLeft, PAVLRPVCALLBACK pfnCallBack, void *pvParam);
|
---|
175 | RTDECL(int) RTAvlrPVDestroy(PAVLRPVTREE ppTree, PAVLRPVCALLBACK pfnCallBack, void *pvParam);
|
---|
176 |
|
---|
177 | /** @} */
|
---|
178 |
|
---|
179 |
|
---|
180 |
|
---|
181 | /** AVL tree of uint32_t
|
---|
182 | * @{
|
---|
183 | */
|
---|
184 |
|
---|
185 | /** AVL key type. */
|
---|
186 | typedef uint32_t AVLU32KEY;
|
---|
187 |
|
---|
188 | /** AVL Core node. */
|
---|
189 | typedef struct _AVLU32NodeCore
|
---|
190 | {
|
---|
191 | AVLU32KEY Key; /**< Key value. */
|
---|
192 | struct _AVLU32NodeCore *pLeft; /**< Pointer to left leaf node. */
|
---|
193 | struct _AVLU32NodeCore *pRight; /**< Pointer to right leaf node. */
|
---|
194 | unsigned char uchHeight; /**< Height of this tree: max(height(left), height(right)) + 1 */
|
---|
195 | } AVLU32NODECORE, *PAVLU32NODECORE, **PPAVLU32NODECORE;
|
---|
196 |
|
---|
197 | /** A tree with void pointer keys. */
|
---|
198 | typedef PAVLU32NODECORE AVLU32TREE;
|
---|
199 | /** Pointer to a tree with void pointer keys. */
|
---|
200 | typedef PPAVLU32NODECORE PAVLU32TREE;
|
---|
201 |
|
---|
202 | /** Callback function for AVLU32DoWithAll() & AVLU32Destroy().
|
---|
203 | * @returns IPRT status codes. */
|
---|
204 | typedef DECLCALLBACK(int) AVLU32CALLBACK(PAVLU32NODECORE, void*);
|
---|
205 | /** Pointer to callback function for AVLU32DoWithAll() & AVLU32Destroy(). */
|
---|
206 | typedef AVLU32CALLBACK *PAVLU32CALLBACK;
|
---|
207 |
|
---|
208 |
|
---|
209 | /*
|
---|
210 | * Functions.
|
---|
211 | */
|
---|
212 | RTDECL(bool) RTAvlU32Insert(PAVLU32TREE pTree, PAVLU32NODECORE pNode);
|
---|
213 | RTDECL(PAVLU32NODECORE) RTAvlU32Remove(PAVLU32TREE pTree, AVLU32KEY Key);
|
---|
214 | RTDECL(PAVLU32NODECORE) RTAvlU32Get(PAVLU32TREE pTree, AVLU32KEY Key);
|
---|
215 | RTDECL(PAVLU32NODECORE) RTAvlU32GetBestFit(PAVLU32TREE pTree, AVLU32KEY Key, bool fAbove);
|
---|
216 | RTDECL(PAVLU32NODECORE) RTAvlU32RemoveBestFit(PAVLU32TREE pTree, AVLU32KEY Key, bool fAbove);
|
---|
217 | RTDECL(int) RTAvlU32DoWithAll(PAVLU32TREE pTree, int fFromLeft, PAVLU32CALLBACK pfnCallBack, void *pvParam);
|
---|
218 | RTDECL(int) RTAvlU32Destroy(PAVLU32TREE pTree, PAVLU32CALLBACK pfnCallBack, void *pvParam);
|
---|
219 |
|
---|
220 | /** @} */
|
---|
221 |
|
---|
222 | /**
|
---|
223 | * AVL uint32_t type for the relative offset pointer scheme.
|
---|
224 | */
|
---|
225 | typedef int32_t AVLOU32;
|
---|
226 |
|
---|
227 | typedef uint32_t AVLOU32KEY;
|
---|
228 |
|
---|
229 | /**
|
---|
230 | * AVL Core node.
|
---|
231 | */
|
---|
232 | typedef struct _AVLOU32NodeCore
|
---|
233 | {
|
---|
234 | /** Key value. */
|
---|
235 | AVLOU32KEY Key;
|
---|
236 | /** Offset to the left leaf node, relative to this field. */
|
---|
237 | AVLOU32 pLeft;
|
---|
238 | /** Offset to the right leaf node, relative to this field. */
|
---|
239 | AVLOU32 pRight;
|
---|
240 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
241 | unsigned char uchHeight;
|
---|
242 | } AVLOU32NODECORE, *PAVLOU32NODECORE;
|
---|
243 |
|
---|
244 | /** A offset base tree with uint32_t keys. */
|
---|
245 | typedef AVLOU32 AVLOU32TREE;
|
---|
246 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
247 | typedef AVLOU32TREE *PAVLOU32TREE;
|
---|
248 |
|
---|
249 | /** Pointer to an internal tree pointer.
|
---|
250 | * In this case it's a pointer to a relative offset. */
|
---|
251 | typedef AVLOU32TREE *PPAVLOU32NODECORE;
|
---|
252 |
|
---|
253 | /** Callback function for RTAvloU32DoWithAll().
|
---|
254 | * @returns IPRT status codes. */
|
---|
255 | typedef DECLCALLBACK(int) AVLOU32CALLBACK(PAVLOU32NODECORE pNode, void *pvUser);
|
---|
256 | /** Pointer to callback function for RTAvloU32DoWithAll(). */
|
---|
257 | typedef AVLOU32CALLBACK *PAVLOU32CALLBACK;
|
---|
258 |
|
---|
259 | RTDECL(bool) RTAvloU32Insert(PAVLOU32TREE pTree, PAVLOU32NODECORE pNode);
|
---|
260 | RTDECL(PAVLOU32NODECORE) RTAvloU32Remove(PAVLOU32TREE pTree, AVLOU32KEY Key);
|
---|
261 | RTDECL(PAVLOU32NODECORE) RTAvloU32Get(PAVLOU32TREE pTree, AVLOU32KEY Key);
|
---|
262 | RTDECL(int) RTAvloU32DoWithAll(PAVLOU32TREE pTree, int fFromLeft, PAVLOU32CALLBACK pfnCallBack, void *pvParam);
|
---|
263 | RTDECL(PAVLOU32NODECORE) RTAvloU32GetBestFit(PAVLOU32TREE ppTree, AVLOU32KEY Key, bool fAbove);
|
---|
264 | RTDECL(PAVLOU32NODECORE) RTAvloU32RemoveBestFit(PAVLOU32TREE ppTree, AVLOU32KEY Key, bool fAbove);
|
---|
265 | RTDECL(int) RTAvloU32Destroy(PAVLOU32TREE pTree, PAVLOU32CALLBACK pfnCallBack, void *pvParam);
|
---|
266 |
|
---|
267 | /** @} */
|
---|
268 |
|
---|
269 |
|
---|
270 | /** AVL tree of uint32_t, list duplicates.
|
---|
271 | * @{
|
---|
272 | */
|
---|
273 |
|
---|
274 | /** AVL key type. */
|
---|
275 | typedef uint32_t AVLLU32KEY;
|
---|
276 |
|
---|
277 | /** AVL Core node. */
|
---|
278 | typedef struct _AVLLU32NodeCore
|
---|
279 | {
|
---|
280 | AVLLU32KEY Key; /**< Key value. */
|
---|
281 | unsigned char uchHeight; /**< Height of this tree: max(height(left), height(right)) + 1 */
|
---|
282 | struct _AVLLU32NodeCore *pLeft; /**< Pointer to left leaf node. */
|
---|
283 | struct _AVLLU32NodeCore *pRight; /**< Pointer to right leaf node. */
|
---|
284 | struct _AVLLU32NodeCore *pList; /**< Pointer to next node with the same key. */
|
---|
285 | } AVLLU32NODECORE, *PAVLLU32NODECORE, **PPAVLLU32NODECORE;
|
---|
286 |
|
---|
287 | /** Callback function for RTAvllU32DoWithAll() & RTAvllU32Destroy().
|
---|
288 | * @returns IPRT status codes. */
|
---|
289 | typedef DECLCALLBACK(int) AVLLU32CALLBACK(PAVLLU32NODECORE, void*);
|
---|
290 | /** Pointer to callback function for RTAvllU32DoWithAll() & RTAvllU32Destroy(). */
|
---|
291 | typedef AVLLU32CALLBACK *PAVLLU32CALLBACK;
|
---|
292 |
|
---|
293 |
|
---|
294 | /*
|
---|
295 | * Functions.
|
---|
296 | */
|
---|
297 | RTDECL(bool) RTAvllU32Insert(PPAVLLU32NODECORE ppTree, PAVLLU32NODECORE pNode);
|
---|
298 | RTDECL(PAVLLU32NODECORE) RTAvllU32Remove(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key);
|
---|
299 | RTDECL(PAVLLU32NODECORE) RTAvllU32RemoveNode(PPAVLLU32NODECORE ppTree, PAVLLU32NODECORE pNode);
|
---|
300 | RTDECL(PAVLLU32NODECORE) RTAvllU32Get(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key);
|
---|
301 | RTDECL(PAVLLU32NODECORE) RTAvllU32GetBestFit(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key, bool fAbove);
|
---|
302 | RTDECL(PAVLLU32NODECORE) RTAvllU32RemoveBestFit(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key, bool fAbove);
|
---|
303 | RTDECL(int) RTAvllU32DoWithAll(PPAVLLU32NODECORE ppTree, int fFromLeft, PAVLLU32CALLBACK pfnCallBack, void *pvParam);
|
---|
304 | RTDECL(int) RTAvllU32Destroy(PPAVLLU32NODECORE pTree, PAVLLU32CALLBACK pfnCallBack, void *pvParam);
|
---|
305 |
|
---|
306 | /** @} */
|
---|
307 |
|
---|
308 |
|
---|
309 |
|
---|
310 | /** AVL tree of uint64_t ranges.
|
---|
311 | * @{
|
---|
312 | */
|
---|
313 |
|
---|
314 | /**
|
---|
315 | * AVL key type
|
---|
316 | */
|
---|
317 | typedef uint64_t AVLRU64KEY;
|
---|
318 |
|
---|
319 | /**
|
---|
320 | * AVL Core node.
|
---|
321 | */
|
---|
322 | typedef struct AVLRU64NodeCore
|
---|
323 | {
|
---|
324 | AVLRU64KEY Key; /**< First key value in the range (inclusive). */
|
---|
325 | AVLRU64KEY KeyLast; /**< Last key value in the range (inclusive). */
|
---|
326 | struct AVLRU64NodeCore *pLeft; /**< Pointer to left leaf node. */
|
---|
327 | struct AVLRU64NodeCore *pRight; /**< Pointer to right leaf node. */
|
---|
328 | unsigned char uchHeight; /**< Height of this tree: max(height(left), height(right)) + 1 */
|
---|
329 | } AVLRU64NODECORE, *PAVLRU64NODECORE, **PPAVLRU64NODECORE;
|
---|
330 |
|
---|
331 | /** A tree with void pointer keys. */
|
---|
332 | typedef PAVLRU64NODECORE AVLRU64TREE;
|
---|
333 | /** Pointer to a tree with void pointer keys. */
|
---|
334 | typedef PPAVLRU64NODECORE PAVLRU64TREE;
|
---|
335 |
|
---|
336 | /** Callback function for AVLRU64DoWithAll().
|
---|
337 | * @returns IPRT status codes. */
|
---|
338 | typedef DECLCALLBACK(int) AVLRU64CALLBACK(PAVLRU64NODECORE, void *);
|
---|
339 | /** Pointer to callback function for AVLU64DoWithAll(). */
|
---|
340 | typedef AVLRU64CALLBACK *PAVLRU64CALLBACK;
|
---|
341 |
|
---|
342 | /*
|
---|
343 | * Functions.
|
---|
344 | */
|
---|
345 | RTDECL(bool) RTAvlrU64Insert(PAVLRU64TREE ppTree, PAVLRU64NODECORE pNode);
|
---|
346 | RTDECL(PAVLRU64NODECORE) RTAvlrU64Remove(PAVLRU64TREE ppTree, AVLRU64KEY Key);
|
---|
347 | RTDECL(PAVLRU64NODECORE) RTAvlrU64Get(PAVLRU64TREE ppTree, AVLRU64KEY Key);
|
---|
348 | RTDECL(PAVLRU64NODECORE) RTAvlrU64RangeGet(PAVLRU64TREE ppTree, AVLRU64KEY Key);
|
---|
349 | RTDECL(PAVLRU64NODECORE) RTAvlrU64RangeRemove(PAVLRU64TREE ppTree, AVLRU64KEY Key);
|
---|
350 | RTDECL(PAVLRU64NODECORE) RTAvlrU64GetBestFit(PAVLRU64TREE ppTree, AVLRU64KEY Key, bool fAbove);
|
---|
351 | RTDECL(PAVLRU64NODECORE) RTAvlrU64RemoveBestFit(PAVLRU64TREE ppTree, AVLRU64KEY Key, bool fAbove);
|
---|
352 | RTDECL(int) RTAvlrU64DoWithAll(PAVLRU64TREE ppTree, int fFromLeft, PAVLRU64CALLBACK pfnCallBack, void *pvParam);
|
---|
353 | RTDECL(int) RTAvlrU64Destroy(PAVLRU64TREE ppTree, PAVLRU64CALLBACK pfnCallBack, void *pvParam);
|
---|
354 |
|
---|
355 | /** @} */
|
---|
356 |
|
---|
357 |
|
---|
358 |
|
---|
359 | /** AVL tree of RTGCPHYSes - using relative offsets internally.
|
---|
360 | * @{
|
---|
361 | */
|
---|
362 |
|
---|
363 | /**
|
---|
364 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
365 | */
|
---|
366 | typedef int32_t AVLOGCPHYS;
|
---|
367 |
|
---|
368 | /**
|
---|
369 | * AVL Core node.
|
---|
370 | */
|
---|
371 | typedef struct _AVLOGCPhysNodeCore
|
---|
372 | {
|
---|
373 | /** Key value. */
|
---|
374 | RTGCPHYS Key;
|
---|
375 | /** Offset to the left leaf node, relative to this field. */
|
---|
376 | AVLOGCPHYS pLeft;
|
---|
377 | /** Offset to the right leaf node, relative to this field. */
|
---|
378 | AVLOGCPHYS pRight;
|
---|
379 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
380 | unsigned char uchHeight;
|
---|
381 | /** Padding */
|
---|
382 | unsigned char Padding[7];
|
---|
383 | } AVLOGCPHYSNODECORE, *PAVLOGCPHYSNODECORE;
|
---|
384 |
|
---|
385 | /** A offset base tree with uint32_t keys. */
|
---|
386 | typedef AVLOGCPHYS AVLOGCPHYSTREE;
|
---|
387 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
388 | typedef AVLOGCPHYSTREE *PAVLOGCPHYSTREE;
|
---|
389 |
|
---|
390 | /** Pointer to an internal tree pointer.
|
---|
391 | * In this case it's a pointer to a relative offset. */
|
---|
392 | typedef AVLOGCPHYSTREE *PPAVLOGCPHYSNODECORE;
|
---|
393 |
|
---|
394 | /** Callback function for RTAvloGCPhysDoWithAll() and RTAvloGCPhysDestroy().
|
---|
395 | * @returns IPRT status codes. */
|
---|
396 | typedef DECLCALLBACK(int) AVLOGCPHYSCALLBACK(PAVLOGCPHYSNODECORE pNode, void *pvUser);
|
---|
397 | /** Pointer to callback function for RTAvloGCPhysDoWithAll() and RTAvloGCPhysDestroy(). */
|
---|
398 | typedef AVLOGCPHYSCALLBACK *PAVLOGCPHYSCALLBACK;
|
---|
399 |
|
---|
400 | RTDECL(bool) RTAvloGCPhysInsert(PAVLOGCPHYSTREE pTree, PAVLOGCPHYSNODECORE pNode);
|
---|
401 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysRemove(PAVLOGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
402 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysGet(PAVLOGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
403 | RTDECL(int) RTAvloGCPhysDoWithAll(PAVLOGCPHYSTREE pTree, int fFromLeft, PAVLOGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
404 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysGetBestFit(PAVLOGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
405 | RTDECL(PAVLOGCPHYSNODECORE) RTAvloGCPhysRemoveBestFit(PAVLOGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
406 | RTDECL(int) RTAvloGCPhysDestroy(PAVLOGCPHYSTREE pTree, PAVLOGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
407 |
|
---|
408 | /** @} */
|
---|
409 |
|
---|
410 |
|
---|
411 | /** AVL tree of RTGCPHYS ranges - using relative offsets internally.
|
---|
412 | * @{
|
---|
413 | */
|
---|
414 |
|
---|
415 | /**
|
---|
416 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
417 | */
|
---|
418 | typedef int32_t AVLROGCPHYS;
|
---|
419 |
|
---|
420 | /**
|
---|
421 | * AVL Core node.
|
---|
422 | */
|
---|
423 | typedef struct _AVLROGCPhysNodeCore
|
---|
424 | {
|
---|
425 | /** First key value in the range (inclusive). */
|
---|
426 | RTGCPHYS Key;
|
---|
427 | /** Last key value in the range (inclusive). */
|
---|
428 | RTGCPHYS KeyLast;
|
---|
429 | /** Offset to the left leaf node, relative to this field. */
|
---|
430 | AVLROGCPHYS pLeft;
|
---|
431 | /** Offset to the right leaf node, relative to this field. */
|
---|
432 | AVLROGCPHYS pRight;
|
---|
433 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
434 | unsigned char uchHeight;
|
---|
435 | /** Padding */
|
---|
436 | unsigned char Padding[7];
|
---|
437 | } AVLROGCPHYSNODECORE, *PAVLROGCPHYSNODECORE;
|
---|
438 |
|
---|
439 | /** A offset base tree with uint32_t keys. */
|
---|
440 | typedef AVLROGCPHYS AVLROGCPHYSTREE;
|
---|
441 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
442 | typedef AVLROGCPHYSTREE *PAVLROGCPHYSTREE;
|
---|
443 |
|
---|
444 | /** Pointer to an internal tree pointer.
|
---|
445 | * In this case it's a pointer to a relative offset. */
|
---|
446 | typedef AVLROGCPHYSTREE *PPAVLROGCPHYSNODECORE;
|
---|
447 |
|
---|
448 | /** Callback function for RTAvlroGCPhysDoWithAll() and RTAvlroGCPhysDestroy().
|
---|
449 | * @returns IPRT status codes. */
|
---|
450 | typedef DECLCALLBACK(int) AVLROGCPHYSCALLBACK(PAVLROGCPHYSNODECORE pNode, void *pvUser);
|
---|
451 | /** Pointer to callback function for RTAvlroGCPhysDoWithAll() and RTAvlroGCPhysDestroy(). */
|
---|
452 | typedef AVLROGCPHYSCALLBACK *PAVLROGCPHYSCALLBACK;
|
---|
453 |
|
---|
454 | RTDECL(bool) RTAvlroGCPhysInsert(PAVLROGCPHYSTREE pTree, PAVLROGCPHYSNODECORE pNode);
|
---|
455 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysRemove(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
456 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGet(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
457 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysRangeGet(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
458 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysRangeRemove(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
459 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetBestFit(PAVLROGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
460 | RTDECL(int) RTAvlroGCPhysDoWithAll(PAVLROGCPHYSTREE pTree, int fFromLeft, PAVLROGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
461 | RTDECL(int) RTAvlroGCPhysDestroy(PAVLROGCPHYSTREE pTree, PAVLROGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
462 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetRoot(PAVLROGCPHYSTREE pTree);
|
---|
463 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetLeft(PAVLROGCPHYSNODECORE pNode);
|
---|
464 | RTDECL(PAVLROGCPHYSNODECORE) RTAvlroGCPhysGetRight(PAVLROGCPHYSNODECORE pNode);
|
---|
465 |
|
---|
466 | /** @} */
|
---|
467 |
|
---|
468 |
|
---|
469 | /** AVL tree of RTGCPTRs.
|
---|
470 | * @{
|
---|
471 | */
|
---|
472 |
|
---|
473 | /**
|
---|
474 | * AVL Core node.
|
---|
475 | */
|
---|
476 | typedef struct _AVLGCPtrNodeCore
|
---|
477 | {
|
---|
478 | /** Key value. */
|
---|
479 | RTGCPTR Key;
|
---|
480 | /** Pointer to the left node. */
|
---|
481 | struct _AVLGCPtrNodeCore *pLeft;
|
---|
482 | /** Pointer to the right node. */
|
---|
483 | struct _AVLGCPtrNodeCore *pRight;
|
---|
484 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
485 | unsigned char uchHeight;
|
---|
486 | } AVLGCPTRNODECORE, *PAVLGCPTRNODECORE, **PPAVLGCPTRNODECORE;
|
---|
487 |
|
---|
488 | /** A tree of RTGCPTR keys. */
|
---|
489 | typedef PAVLGCPTRNODECORE AVLGCPTRTREE;
|
---|
490 | /** Pointer to a tree of RTGCPTR keys. */
|
---|
491 | typedef PPAVLGCPTRNODECORE PAVLGCPTRTREE;
|
---|
492 |
|
---|
493 | /** Callback function for RTAvlGCPtrDoWithAll().
|
---|
494 | * @returns IPRT status codes. */
|
---|
495 | typedef DECLCALLBACK(int) AVLGCPTRCALLBACK(PAVLGCPTRNODECORE pNode, void *pvUser);
|
---|
496 | /** Pointer to callback function for RTAvlGCPtrDoWithAll(). */
|
---|
497 | typedef AVLGCPTRCALLBACK *PAVLGCPTRCALLBACK;
|
---|
498 |
|
---|
499 | RTDECL(bool) RTAvlGCPtrInsert(PAVLGCPTRTREE pTree, PAVLGCPTRNODECORE pNode);
|
---|
500 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrRemove(PAVLGCPTRTREE pTree, RTGCPTR Key);
|
---|
501 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrGet(PAVLGCPTRTREE pTree, RTGCPTR Key);
|
---|
502 | RTDECL(int) RTAvlGCPtrDoWithAll(PAVLGCPTRTREE pTree, int fFromLeft, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
503 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrGetBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
504 | RTDECL(PAVLGCPTRNODECORE) RTAvlGCPtrRemoveBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
505 | RTDECL(int) RTAvlGCPtrDestroy(PAVLGCPTRTREE pTree, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
506 |
|
---|
507 | /** @} */
|
---|
508 |
|
---|
509 |
|
---|
510 | /** AVL tree of RTGCPTRs - using relative offsets internally.
|
---|
511 | * @{
|
---|
512 | */
|
---|
513 |
|
---|
514 | /**
|
---|
515 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
516 | */
|
---|
517 | typedef int32_t AVLOGCPTR;
|
---|
518 |
|
---|
519 | /**
|
---|
520 | * AVL Core node.
|
---|
521 | */
|
---|
522 | typedef struct _AVLOGCPtrNodeCore
|
---|
523 | {
|
---|
524 | /** Key value. */
|
---|
525 | RTGCPTR Key;
|
---|
526 | /** Offset to the left leaf node, relative to this field. */
|
---|
527 | AVLOGCPTR pLeft;
|
---|
528 | /** Offset to the right leaf node, relative to this field. */
|
---|
529 | AVLOGCPTR pRight;
|
---|
530 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
531 | unsigned char uchHeight;
|
---|
532 | unsigned char padding[GC_ARCH_BITS == 64 ? 7 : 3];
|
---|
533 | } AVLOGCPTRNODECORE, *PAVLOGCPTRNODECORE;
|
---|
534 |
|
---|
535 | /** A offset base tree with uint32_t keys. */
|
---|
536 | typedef AVLOGCPTR AVLOGCPTRTREE;
|
---|
537 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
538 | typedef AVLOGCPTRTREE *PAVLOGCPTRTREE;
|
---|
539 |
|
---|
540 | /** Pointer to an internal tree pointer.
|
---|
541 | * In this case it's a pointer to a relative offset. */
|
---|
542 | typedef AVLOGCPTRTREE *PPAVLOGCPTRNODECORE;
|
---|
543 |
|
---|
544 | /** Callback function for RTAvloGCPtrDoWithAll().
|
---|
545 | * @returns IPRT status codes. */
|
---|
546 | typedef DECLCALLBACK(int) AVLOGCPTRCALLBACK(PAVLOGCPTRNODECORE pNode, void *pvUser);
|
---|
547 | /** Pointer to callback function for RTAvloGCPtrDoWithAll(). */
|
---|
548 | typedef AVLOGCPTRCALLBACK *PAVLOGCPTRCALLBACK;
|
---|
549 |
|
---|
550 | RTDECL(bool) RTAvloGCPtrInsert(PAVLOGCPTRTREE pTree, PAVLOGCPTRNODECORE pNode);
|
---|
551 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrRemove(PAVLOGCPTRTREE pTree, RTGCPTR Key);
|
---|
552 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrGet(PAVLOGCPTRTREE pTree, RTGCPTR Key);
|
---|
553 | RTDECL(int) RTAvloGCPtrDoWithAll(PAVLOGCPTRTREE pTree, int fFromLeft, PAVLOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
554 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrGetBestFit(PAVLOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
555 | RTDECL(PAVLOGCPTRNODECORE) RTAvloGCPtrRemoveBestFit(PAVLOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
556 | RTDECL(int) RTAvloGCPtrDestroy(PAVLOGCPTRTREE pTree, PAVLOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
557 |
|
---|
558 | /** @} */
|
---|
559 |
|
---|
560 |
|
---|
561 | /** AVL tree of RTGCPTR ranges.
|
---|
562 | * @{
|
---|
563 | */
|
---|
564 |
|
---|
565 | /**
|
---|
566 | * AVL Core node.
|
---|
567 | */
|
---|
568 | typedef struct _AVLRGCPtrNodeCore
|
---|
569 | {
|
---|
570 | /** First key value in the range (inclusive). */
|
---|
571 | RTGCPTR Key;
|
---|
572 | /** Last key value in the range (inclusive). */
|
---|
573 | RTGCPTR KeyLast;
|
---|
574 | /** Offset to the left leaf node, relative to this field. */
|
---|
575 | struct _AVLRGCPtrNodeCore *pLeft;
|
---|
576 | /** Offset to the right leaf node, relative to this field. */
|
---|
577 | struct _AVLRGCPtrNodeCore *pRight;
|
---|
578 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
579 | unsigned char uchHeight;
|
---|
580 | } AVLRGCPTRNODECORE, *PAVLRGCPTRNODECORE;
|
---|
581 |
|
---|
582 | /** A offset base tree with RTGCPTR keys. */
|
---|
583 | typedef PAVLRGCPTRNODECORE AVLRGCPTRTREE;
|
---|
584 | /** Pointer to an offset base tree with RTGCPTR keys. */
|
---|
585 | typedef AVLRGCPTRTREE *PAVLRGCPTRTREE;
|
---|
586 |
|
---|
587 | /** Pointer to an internal tree pointer.
|
---|
588 | * In this case it's a pointer to a relative offset. */
|
---|
589 | typedef AVLRGCPTRTREE *PPAVLRGCPTRNODECORE;
|
---|
590 |
|
---|
591 | /** Callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy().
|
---|
592 | * @returns IPRT status codes. */
|
---|
593 | typedef DECLCALLBACK(int) AVLRGCPTRCALLBACK(PAVLRGCPTRNODECORE pNode, void *pvUser);
|
---|
594 | /** Pointer to callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
|
---|
595 | typedef AVLRGCPTRCALLBACK *PAVLRGCPTRCALLBACK;
|
---|
596 |
|
---|
597 | RTDECL(bool) RTAvlrGCPtrInsert( PAVLRGCPTRTREE pTree, PAVLRGCPTRNODECORE pNode);
|
---|
598 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrRemove( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
599 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGet( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
600 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetBestFit( PAVLRGCPTRTREE pTree, RTGCPTR Key, bool fAbove);
|
---|
601 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrRangeGet( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
602 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrRangeRemove( PAVLRGCPTRTREE pTree, RTGCPTR Key);
|
---|
603 | RTDECL(int) RTAvlrGCPtrDoWithAll( PAVLRGCPTRTREE pTree, int fFromLeft, PAVLRGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
604 | RTDECL(int) RTAvlrGCPtrDestroy( PAVLRGCPTRTREE pTree, PAVLRGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
605 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetRoot( PAVLRGCPTRTREE pTree);
|
---|
606 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetLeft( PAVLRGCPTRNODECORE pNode);
|
---|
607 | RTDECL(PAVLRGCPTRNODECORE) RTAvlrGCPtrGetRight( PAVLRGCPTRNODECORE pNode);
|
---|
608 |
|
---|
609 | /** @} */
|
---|
610 |
|
---|
611 |
|
---|
612 | /** AVL tree of RTGCPTR ranges - using relative offsets internally.
|
---|
613 | * @{
|
---|
614 | */
|
---|
615 |
|
---|
616 | /**
|
---|
617 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
618 | */
|
---|
619 | typedef int32_t AVLROGCPTR;
|
---|
620 |
|
---|
621 | /**
|
---|
622 | * AVL Core node.
|
---|
623 | */
|
---|
624 | typedef struct _AVLROGCPtrNodeCore
|
---|
625 | {
|
---|
626 | /** First key value in the range (inclusive). */
|
---|
627 | RTGCPTR Key;
|
---|
628 | /** Last key value in the range (inclusive). */
|
---|
629 | RTGCPTR KeyLast;
|
---|
630 | /** Offset to the left leaf node, relative to this field. */
|
---|
631 | AVLROGCPTR pLeft;
|
---|
632 | /** Offset to the right leaf node, relative to this field. */
|
---|
633 | AVLROGCPTR pRight;
|
---|
634 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
635 | unsigned char uchHeight;
|
---|
636 | unsigned char padding[GC_ARCH_BITS == 64 ? 7 : 7];
|
---|
637 | } AVLROGCPTRNODECORE, *PAVLROGCPTRNODECORE;
|
---|
638 |
|
---|
639 | /** A offset base tree with uint32_t keys. */
|
---|
640 | typedef AVLROGCPTR AVLROGCPTRTREE;
|
---|
641 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
642 | typedef AVLROGCPTRTREE *PAVLROGCPTRTREE;
|
---|
643 |
|
---|
644 | /** Pointer to an internal tree pointer.
|
---|
645 | * In this case it's a pointer to a relative offset. */
|
---|
646 | typedef AVLROGCPTRTREE *PPAVLROGCPTRNODECORE;
|
---|
647 |
|
---|
648 | /** Callback function for RTAvlroGCPtrDoWithAll() and RTAvlroGCPtrDestroy().
|
---|
649 | * @returns IPRT status codes. */
|
---|
650 | typedef DECLCALLBACK(int) AVLROGCPTRCALLBACK(PAVLROGCPTRNODECORE pNode, void *pvUser);
|
---|
651 | /** Pointer to callback function for RTAvlroGCPtrDoWithAll() and RTAvlroGCPtrDestroy(). */
|
---|
652 | typedef AVLROGCPTRCALLBACK *PAVLROGCPTRCALLBACK;
|
---|
653 |
|
---|
654 | RTDECL(bool) RTAvlroGCPtrInsert(PAVLROGCPTRTREE pTree, PAVLROGCPTRNODECORE pNode);
|
---|
655 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrRemove(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
656 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGet(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
657 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetBestFit(PAVLROGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
658 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrRangeGet(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
659 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrRangeRemove(PAVLROGCPTRTREE pTree, RTGCPTR Key);
|
---|
660 | RTDECL(int) RTAvlroGCPtrDoWithAll(PAVLROGCPTRTREE pTree, int fFromLeft, PAVLROGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
661 | RTDECL(int) RTAvlroGCPtrDestroy(PAVLROGCPTRTREE pTree, PAVLROGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
662 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetRoot(PAVLROGCPTRTREE pTree);
|
---|
663 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetLeft(PAVLROGCPTRNODECORE pNode);
|
---|
664 | RTDECL(PAVLROGCPTRNODECORE) RTAvlroGCPtrGetRight(PAVLROGCPTRNODECORE pNode);
|
---|
665 |
|
---|
666 | /** @} */
|
---|
667 |
|
---|
668 |
|
---|
669 | /** AVL tree of RTGCPTR ranges (overlapping supported) - using relative offsets internally.
|
---|
670 | * @{
|
---|
671 | */
|
---|
672 |
|
---|
673 | /**
|
---|
674 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
675 | */
|
---|
676 | typedef int32_t AVLROOGCPTR;
|
---|
677 |
|
---|
678 | /**
|
---|
679 | * AVL Core node.
|
---|
680 | */
|
---|
681 | typedef struct _AVLROOGCPtrNodeCore
|
---|
682 | {
|
---|
683 | /** First key value in the range (inclusive). */
|
---|
684 | RTGCPTR Key;
|
---|
685 | /** Last key value in the range (inclusive). */
|
---|
686 | RTGCPTR KeyLast;
|
---|
687 | /** Offset to the left leaf node, relative to this field. */
|
---|
688 | AVLROOGCPTR pLeft;
|
---|
689 | /** Offset to the right leaf node, relative to this field. */
|
---|
690 | AVLROOGCPTR pRight;
|
---|
691 | /** Pointer to the list of string with the same key. Don't touch. */
|
---|
692 | AVLROOGCPTR pList;
|
---|
693 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
694 | unsigned char uchHeight;
|
---|
695 | } AVLROOGCPTRNODECORE, *PAVLROOGCPTRNODECORE;
|
---|
696 |
|
---|
697 | /** A offset base tree with uint32_t keys. */
|
---|
698 | typedef AVLROOGCPTR AVLROOGCPTRTREE;
|
---|
699 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
700 | typedef AVLROOGCPTRTREE *PAVLROOGCPTRTREE;
|
---|
701 |
|
---|
702 | /** Pointer to an internal tree pointer.
|
---|
703 | * In this case it's a pointer to a relative offset. */
|
---|
704 | typedef AVLROOGCPTRTREE *PPAVLROOGCPTRNODECORE;
|
---|
705 |
|
---|
706 | /** Callback function for RTAvlrooGCPtrDoWithAll() and RTAvlrooGCPtrDestroy().
|
---|
707 | * @returns IPRT status codes. */
|
---|
708 | typedef DECLCALLBACK(int) AVLROOGCPTRCALLBACK(PAVLROOGCPTRNODECORE pNode, void *pvUser);
|
---|
709 | /** Pointer to callback function for RTAvlrooGCPtrDoWithAll() and RTAvlrooGCPtrDestroy(). */
|
---|
710 | typedef AVLROOGCPTRCALLBACK *PAVLROOGCPTRCALLBACK;
|
---|
711 |
|
---|
712 | RTDECL(bool) RTAvlrooGCPtrInsert(PAVLROOGCPTRTREE pTree, PAVLROOGCPTRNODECORE pNode);
|
---|
713 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrRemove(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
714 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGet(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
715 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetBestFit(PAVLROOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
|
---|
716 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrRangeGet(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
717 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrRangeRemove(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
|
---|
718 | RTDECL(int) RTAvlrooGCPtrDoWithAll(PAVLROOGCPTRTREE pTree, int fFromLeft, PAVLROOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
719 | RTDECL(int) RTAvlrooGCPtrDestroy(PAVLROOGCPTRTREE pTree, PAVLROOGCPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
720 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetRoot(PAVLROOGCPTRTREE pTree);
|
---|
721 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetLeft(PAVLROOGCPTRNODECORE pNode);
|
---|
722 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetRight(PAVLROOGCPTRNODECORE pNode);
|
---|
723 | RTDECL(PAVLROOGCPTRNODECORE) RTAvlrooGCPtrGetNextEqual(PAVLROOGCPTRNODECORE pNode);
|
---|
724 |
|
---|
725 | /** @} */
|
---|
726 |
|
---|
727 |
|
---|
728 | /** AVL tree of RTUINTPTR.
|
---|
729 | * @{
|
---|
730 | */
|
---|
731 |
|
---|
732 | /**
|
---|
733 | * AVL RTUINTPTR node core.
|
---|
734 | */
|
---|
735 | typedef struct _AVLUIntPtrNodeCore
|
---|
736 | {
|
---|
737 | /** Key value. */
|
---|
738 | RTUINTPTR Key;
|
---|
739 | /** Offset to the left leaf node, relative to this field. */
|
---|
740 | struct _AVLUIntPtrNodeCore *pLeft;
|
---|
741 | /** Offset to the right leaf node, relative to this field. */
|
---|
742 | struct _AVLUIntPtrNodeCore *pRight;
|
---|
743 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
744 | unsigned char uchHeight;
|
---|
745 | } AVLUINTPTRNODECORE;
|
---|
746 | /** Pointer to a RTUINTPTR AVL node core.*/
|
---|
747 | typedef AVLUINTPTRNODECORE *PAVLUINTPTRNODECORE;
|
---|
748 |
|
---|
749 | /** A pointer based tree with RTUINTPTR keys. */
|
---|
750 | typedef PAVLUINTPTRNODECORE AVLUINTPTRTREE;
|
---|
751 | /** Pointer to an offset base tree with RTUINTPTR keys. */
|
---|
752 | typedef AVLUINTPTRTREE *PAVLUINTPTRTREE;
|
---|
753 |
|
---|
754 | /** Pointer to an internal tree pointer.
|
---|
755 | * In this case it's a pointer to a pointer. */
|
---|
756 | typedef AVLUINTPTRTREE *PPAVLUINTPTRNODECORE;
|
---|
757 |
|
---|
758 | /** Callback function for RTAvlUIntPtrDoWithAll() and RTAvlUIntPtrDestroy().
|
---|
759 | * @returns IPRT status codes. */
|
---|
760 | typedef DECLCALLBACK(int) AVLUINTPTRCALLBACK(PAVLUINTPTRNODECORE pNode, void *pvUser);
|
---|
761 | /** Pointer to callback function for RTAvlUIntPtrDoWithAll() and RTAvlUIntPtrDestroy(). */
|
---|
762 | typedef AVLUINTPTRCALLBACK *PAVLUINTPTRCALLBACK;
|
---|
763 |
|
---|
764 | RTDECL(bool) RTAvlUIntPtrInsert( PAVLUINTPTRTREE pTree, PAVLUINTPTRNODECORE pNode);
|
---|
765 | RTDECL(PAVLUINTPTRNODECORE) RTAvlUIntPtrRemove( PAVLUINTPTRTREE pTree, RTUINTPTR Key);
|
---|
766 | RTDECL(PAVLUINTPTRNODECORE) RTAvlUIntPtrGet( PAVLUINTPTRTREE pTree, RTUINTPTR Key);
|
---|
767 | RTDECL(PAVLUINTPTRNODECORE) RTAvlUIntPtrGetBestFit(PAVLUINTPTRTREE pTree, RTUINTPTR Key, bool fAbove);
|
---|
768 | RTDECL(int) RTAvlUIntPtrDoWithAll( PAVLUINTPTRTREE pTree, int fFromLeft, PAVLUINTPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
769 | RTDECL(int) RTAvlUIntPtrDestroy( PAVLUINTPTRTREE pTree, PAVLUINTPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
770 | RTDECL(PAVLUINTPTRNODECORE) RTAvlUIntPtrGetRoot( PAVLUINTPTRTREE pTree);
|
---|
771 | RTDECL(PAVLUINTPTRNODECORE) RTAvlUIntPtrGetLeft( PAVLUINTPTRNODECORE pNode);
|
---|
772 | RTDECL(PAVLUINTPTRNODECORE) RTAvlUIntPtrGetRight( PAVLUINTPTRNODECORE pNode);
|
---|
773 |
|
---|
774 | /** @} */
|
---|
775 |
|
---|
776 |
|
---|
777 | /** AVL tree of RTUINTPTR ranges.
|
---|
778 | * @{
|
---|
779 | */
|
---|
780 |
|
---|
781 | /**
|
---|
782 | * AVL RTUINTPTR range node core.
|
---|
783 | */
|
---|
784 | typedef struct _AVLRUIntPtrNodeCore
|
---|
785 | {
|
---|
786 | /** First key value in the range (inclusive). */
|
---|
787 | RTUINTPTR Key;
|
---|
788 | /** Last key value in the range (inclusive). */
|
---|
789 | RTUINTPTR KeyLast;
|
---|
790 | /** Offset to the left leaf node, relative to this field. */
|
---|
791 | struct _AVLRUIntPtrNodeCore *pLeft;
|
---|
792 | /** Offset to the right leaf node, relative to this field. */
|
---|
793 | struct _AVLRUIntPtrNodeCore *pRight;
|
---|
794 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
795 | unsigned char uchHeight;
|
---|
796 | } AVLRUINTPTRNODECORE;
|
---|
797 | /** Pointer to an AVL RTUINTPTR range node code. */
|
---|
798 | typedef AVLRUINTPTRNODECORE *PAVLRUINTPTRNODECORE;
|
---|
799 |
|
---|
800 | /** A pointer based tree with RTUINTPTR ranges. */
|
---|
801 | typedef PAVLRUINTPTRNODECORE AVLRUINTPTRTREE;
|
---|
802 | /** Pointer to a pointer based tree with RTUINTPTR ranges. */
|
---|
803 | typedef AVLRUINTPTRTREE *PAVLRUINTPTRTREE;
|
---|
804 |
|
---|
805 | /** Pointer to an internal tree pointer.
|
---|
806 | * In this case it's a pointer to a pointer. */
|
---|
807 | typedef AVLRUINTPTRTREE *PPAVLRUINTPTRNODECORE;
|
---|
808 |
|
---|
809 | /** Callback function for RTAvlrUIntPtrDoWithAll() and RTAvlrUIntPtrDestroy().
|
---|
810 | * @returns IPRT status codes. */
|
---|
811 | typedef DECLCALLBACK(int) AVLRUINTPTRCALLBACK(PAVLRUINTPTRNODECORE pNode, void *pvUser);
|
---|
812 | /** Pointer to callback function for RTAvlrUIntPtrDoWithAll() and RTAvlrUIntPtrDestroy(). */
|
---|
813 | typedef AVLRUINTPTRCALLBACK *PAVLRUINTPTRCALLBACK;
|
---|
814 |
|
---|
815 | RTDECL(bool) RTAvlrUIntPtrInsert( PAVLRUINTPTRTREE pTree, PAVLRUINTPTRNODECORE pNode);
|
---|
816 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrRemove( PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
|
---|
817 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrGet( PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
|
---|
818 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrGetBestFit( PAVLRUINTPTRTREE pTree, RTUINTPTR Key, bool fAbove);
|
---|
819 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrRangeGet( PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
|
---|
820 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrRangeRemove(PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
|
---|
821 | RTDECL(int) RTAvlrUIntPtrDoWithAll( PAVLRUINTPTRTREE pTree, int fFromLeft, PAVLRUINTPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
822 | RTDECL(int) RTAvlrUIntPtrDestroy( PAVLRUINTPTRTREE pTree, PAVLRUINTPTRCALLBACK pfnCallBack, void *pvParam);
|
---|
823 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrGetRoot( PAVLRUINTPTRTREE pTree);
|
---|
824 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrGetLeft( PAVLRUINTPTRNODECORE pNode);
|
---|
825 | RTDECL(PAVLRUINTPTRNODECORE) RTAvlrUIntPtrGetRight( PAVLRUINTPTRNODECORE pNode);
|
---|
826 |
|
---|
827 | /** @} */
|
---|
828 |
|
---|
829 |
|
---|
830 | /** AVL tree of RTHCPHYSes - using relative offsets internally.
|
---|
831 | * @{
|
---|
832 | */
|
---|
833 |
|
---|
834 | /**
|
---|
835 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
836 | */
|
---|
837 | typedef int32_t AVLOHCPHYS;
|
---|
838 |
|
---|
839 | /**
|
---|
840 | * AVL Core node.
|
---|
841 | */
|
---|
842 | typedef struct _AVLOHCPhysNodeCore
|
---|
843 | {
|
---|
844 | /** Key value. */
|
---|
845 | RTHCPHYS Key;
|
---|
846 | /** Offset to the left leaf node, relative to this field. */
|
---|
847 | AVLOHCPHYS pLeft;
|
---|
848 | /** Offset to the right leaf node, relative to this field. */
|
---|
849 | AVLOHCPHYS pRight;
|
---|
850 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
851 | unsigned char uchHeight;
|
---|
852 | #if HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64
|
---|
853 | unsigned char Padding[7]; /**< Alignment padding. */
|
---|
854 | #endif
|
---|
855 | } AVLOHCPHYSNODECORE, *PAVLOHCPHYSNODECORE;
|
---|
856 |
|
---|
857 | /** A offset base tree with uint32_t keys. */
|
---|
858 | typedef AVLOHCPHYS AVLOHCPHYSTREE;
|
---|
859 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
860 | typedef AVLOHCPHYSTREE *PAVLOHCPHYSTREE;
|
---|
861 |
|
---|
862 | /** Pointer to an internal tree pointer.
|
---|
863 | * In this case it's a pointer to a relative offset. */
|
---|
864 | typedef AVLOHCPHYSTREE *PPAVLOHCPHYSNODECORE;
|
---|
865 |
|
---|
866 | /** Callback function for RTAvloHCPhysDoWithAll() and RTAvloHCPhysDestroy().
|
---|
867 | * @returns IPRT status codes. */
|
---|
868 | typedef DECLCALLBACK(int) AVLOHCPHYSCALLBACK(PAVLOHCPHYSNODECORE pNode, void *pvUser);
|
---|
869 | /** Pointer to callback function for RTAvloHCPhysDoWithAll() and RTAvloHCPhysDestroy(). */
|
---|
870 | typedef AVLOHCPHYSCALLBACK *PAVLOHCPHYSCALLBACK;
|
---|
871 |
|
---|
872 | RTDECL(bool) RTAvloHCPhysInsert(PAVLOHCPHYSTREE pTree, PAVLOHCPHYSNODECORE pNode);
|
---|
873 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysRemove(PAVLOHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
874 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysGet(PAVLOHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
875 | RTDECL(int) RTAvloHCPhysDoWithAll(PAVLOHCPHYSTREE pTree, int fFromLeft, PAVLOHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
876 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysGetBestFit(PAVLOHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
877 | RTDECL(PAVLOHCPHYSNODECORE) RTAvloHCPhysRemoveBestFit(PAVLOHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
878 | RTDECL(int) RTAvloHCPhysDestroy(PAVLOHCPHYSTREE pTree, PAVLOHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
879 |
|
---|
880 | /** @} */
|
---|
881 |
|
---|
882 |
|
---|
883 |
|
---|
884 | /** AVL tree of RTIOPORTs - using relative offsets internally.
|
---|
885 | * @{
|
---|
886 | */
|
---|
887 |
|
---|
888 | /**
|
---|
889 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
890 | */
|
---|
891 | typedef int32_t AVLOIOPORTPTR;
|
---|
892 |
|
---|
893 | /**
|
---|
894 | * AVL Core node.
|
---|
895 | */
|
---|
896 | typedef struct _AVLOIOPortNodeCore
|
---|
897 | {
|
---|
898 | /** Offset to the left leaf node, relative to this field. */
|
---|
899 | AVLOIOPORTPTR pLeft;
|
---|
900 | /** Offset to the right leaf node, relative to this field. */
|
---|
901 | AVLOIOPORTPTR pRight;
|
---|
902 | /** Key value. */
|
---|
903 | RTIOPORT Key;
|
---|
904 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
905 | unsigned char uchHeight;
|
---|
906 | } AVLOIOPORTNODECORE, *PAVLOIOPORTNODECORE;
|
---|
907 |
|
---|
908 | /** A offset base tree with uint32_t keys. */
|
---|
909 | typedef AVLOIOPORTPTR AVLOIOPORTTREE;
|
---|
910 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
911 | typedef AVLOIOPORTTREE *PAVLOIOPORTTREE;
|
---|
912 |
|
---|
913 | /** Pointer to an internal tree pointer.
|
---|
914 | * In this case it's a pointer to a relative offset. */
|
---|
915 | typedef AVLOIOPORTTREE *PPAVLOIOPORTNODECORE;
|
---|
916 |
|
---|
917 | /** Callback function for RTAvloIOPortDoWithAll() and RTAvloIOPortDestroy().
|
---|
918 | * @returns IPRT status codes. */
|
---|
919 | typedef DECLCALLBACK(int) AVLOIOPORTCALLBACK(PAVLOIOPORTNODECORE pNode, void *pvUser);
|
---|
920 | /** Pointer to callback function for RTAvloIOPortDoWithAll() and RTAvloIOPortDestroy(). */
|
---|
921 | typedef AVLOIOPORTCALLBACK *PAVLOIOPORTCALLBACK;
|
---|
922 |
|
---|
923 | RTDECL(bool) RTAvloIOPortInsert(PAVLOIOPORTTREE pTree, PAVLOIOPORTNODECORE pNode);
|
---|
924 | RTDECL(PAVLOIOPORTNODECORE) RTAvloIOPortRemove(PAVLOIOPORTTREE pTree, RTIOPORT Key);
|
---|
925 | RTDECL(PAVLOIOPORTNODECORE) RTAvloIOPortGet(PAVLOIOPORTTREE pTree, RTIOPORT Key);
|
---|
926 | RTDECL(int) RTAvloIOPortDoWithAll(PAVLOIOPORTTREE pTree, int fFromLeft, PAVLOIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
927 | RTDECL(PAVLOIOPORTNODECORE) RTAvloIOPortGetBestFit(PAVLOIOPORTTREE ppTree, RTIOPORT Key, bool fAbove);
|
---|
928 | RTDECL(PAVLOIOPORTNODECORE) RTAvloIOPortRemoveBestFit(PAVLOIOPORTTREE ppTree, RTIOPORT Key, bool fAbove);
|
---|
929 | RTDECL(int) RTAvloIOPortDestroy(PAVLOIOPORTTREE pTree, PAVLOIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
930 |
|
---|
931 | /** @} */
|
---|
932 |
|
---|
933 |
|
---|
934 | /** AVL tree of RTIOPORT ranges - using relative offsets internally.
|
---|
935 | * @{
|
---|
936 | */
|
---|
937 |
|
---|
938 | /**
|
---|
939 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
940 | */
|
---|
941 | typedef int32_t AVLROIOPORTPTR;
|
---|
942 |
|
---|
943 | /**
|
---|
944 | * AVL Core node.
|
---|
945 | */
|
---|
946 | typedef struct _AVLROIOPortNodeCore
|
---|
947 | {
|
---|
948 | /** First key value in the range (inclusive). */
|
---|
949 | RTIOPORT Key;
|
---|
950 | /** Last key value in the range (inclusive). */
|
---|
951 | RTIOPORT KeyLast;
|
---|
952 | /** Offset to the left leaf node, relative to this field. */
|
---|
953 | AVLROIOPORTPTR pLeft;
|
---|
954 | /** Offset to the right leaf node, relative to this field. */
|
---|
955 | AVLROIOPORTPTR pRight;
|
---|
956 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
957 | unsigned char uchHeight;
|
---|
958 | } AVLROIOPORTNODECORE, *PAVLROIOPORTNODECORE;
|
---|
959 |
|
---|
960 | /** A offset base tree with uint32_t keys. */
|
---|
961 | typedef AVLROIOPORTPTR AVLROIOPORTTREE;
|
---|
962 | /** Pointer to an offset base tree with uint32_t keys. */
|
---|
963 | typedef AVLROIOPORTTREE *PAVLROIOPORTTREE;
|
---|
964 |
|
---|
965 | /** Pointer to an internal tree pointer.
|
---|
966 | * In this case it's a pointer to a relative offset. */
|
---|
967 | typedef AVLROIOPORTTREE *PPAVLROIOPORTNODECORE;
|
---|
968 |
|
---|
969 | /** Callback function for RTAvlroIOPortDoWithAll() and RTAvlroIOPortDestroy().
|
---|
970 | * @returns IPRT status codes. */
|
---|
971 | typedef DECLCALLBACK(int) AVLROIOPORTCALLBACK(PAVLROIOPORTNODECORE pNode, void *pvUser);
|
---|
972 | /** Pointer to callback function for RTAvlroIOPortDoWithAll() and RTAvlroIOPortDestroy(). */
|
---|
973 | typedef AVLROIOPORTCALLBACK *PAVLROIOPORTCALLBACK;
|
---|
974 |
|
---|
975 | RTDECL(bool) RTAvlroIOPortInsert(PAVLROIOPORTTREE pTree, PAVLROIOPORTNODECORE pNode);
|
---|
976 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortRemove(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
977 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortGet(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
978 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortRangeGet(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
979 | RTDECL(PAVLROIOPORTNODECORE) RTAvlroIOPortRangeRemove(PAVLROIOPORTTREE pTree, RTIOPORT Key);
|
---|
980 | RTDECL(int) RTAvlroIOPortDoWithAll(PAVLROIOPORTTREE pTree, int fFromLeft, PAVLROIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
981 | RTDECL(int) RTAvlroIOPortDestroy(PAVLROIOPORTTREE pTree, PAVLROIOPORTCALLBACK pfnCallBack, void *pvParam);
|
---|
982 |
|
---|
983 | /** @} */
|
---|
984 |
|
---|
985 |
|
---|
986 | /** AVL tree of RTHCPHYSes.
|
---|
987 | * @{
|
---|
988 | */
|
---|
989 |
|
---|
990 | /**
|
---|
991 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
992 | */
|
---|
993 | typedef struct _AVLHCPhysNodeCore *AVLHCPHYSPTR;
|
---|
994 |
|
---|
995 | /**
|
---|
996 | * AVL Core node.
|
---|
997 | */
|
---|
998 | typedef struct _AVLHCPhysNodeCore
|
---|
999 | {
|
---|
1000 | /** Offset to the left leaf node, relative to this field. */
|
---|
1001 | AVLHCPHYSPTR pLeft;
|
---|
1002 | /** Offset to the right leaf node, relative to this field. */
|
---|
1003 | AVLHCPHYSPTR pRight;
|
---|
1004 | /** Key value. */
|
---|
1005 | RTHCPHYS Key;
|
---|
1006 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
1007 | unsigned char uchHeight;
|
---|
1008 | } AVLHCPHYSNODECORE, *PAVLHCPHYSNODECORE;
|
---|
1009 |
|
---|
1010 | /** A offset base tree with RTHCPHYS keys. */
|
---|
1011 | typedef AVLHCPHYSPTR AVLHCPHYSTREE;
|
---|
1012 | /** Pointer to an offset base tree with RTHCPHYS keys. */
|
---|
1013 | typedef AVLHCPHYSTREE *PAVLHCPHYSTREE;
|
---|
1014 |
|
---|
1015 | /** Pointer to an internal tree pointer.
|
---|
1016 | * In this case it's a pointer to a relative offset. */
|
---|
1017 | typedef AVLHCPHYSTREE *PPAVLHCPHYSNODECORE;
|
---|
1018 |
|
---|
1019 | /** Callback function for RTAvlHCPhysDoWithAll() and RTAvlHCPhysDestroy().
|
---|
1020 | * @returns IPRT status codes. */
|
---|
1021 | typedef DECLCALLBACK(int) AVLHCPHYSCALLBACK(PAVLHCPHYSNODECORE pNode, void *pvUser);
|
---|
1022 | /** Pointer to callback function for RTAvlHCPhysDoWithAll() and RTAvlHCPhysDestroy(). */
|
---|
1023 | typedef AVLHCPHYSCALLBACK *PAVLHCPHYSCALLBACK;
|
---|
1024 |
|
---|
1025 | RTDECL(bool) RTAvlHCPhysInsert(PAVLHCPHYSTREE pTree, PAVLHCPHYSNODECORE pNode);
|
---|
1026 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysRemove(PAVLHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
1027 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysGet(PAVLHCPHYSTREE pTree, RTHCPHYS Key);
|
---|
1028 | RTDECL(int) RTAvlHCPhysDoWithAll(PAVLHCPHYSTREE pTree, int fFromLeft, PAVLHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
1029 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysGetBestFit(PAVLHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
1030 | RTDECL(PAVLHCPHYSNODECORE) RTAvlHCPhysRemoveBestFit(PAVLHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
|
---|
1031 | RTDECL(int) RTAvlHCPhysDestroy(PAVLHCPHYSTREE pTree, PAVLHCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
1032 |
|
---|
1033 | /** @} */
|
---|
1034 |
|
---|
1035 | /** AVL tree of RTGCPHYSes.
|
---|
1036 | * @{
|
---|
1037 | */
|
---|
1038 |
|
---|
1039 | /**
|
---|
1040 | * AVL 'pointer' type for the relative offset pointer scheme.
|
---|
1041 | */
|
---|
1042 | typedef struct _AVLGCPhysNodeCore *AVLGCPHYSPTR;
|
---|
1043 |
|
---|
1044 | /**
|
---|
1045 | * AVL Core node.
|
---|
1046 | */
|
---|
1047 | typedef struct _AVLGCPhysNodeCore
|
---|
1048 | {
|
---|
1049 | /** Offset to the left leaf node, relative to this field. */
|
---|
1050 | AVLGCPHYSPTR pLeft;
|
---|
1051 | /** Offset to the right leaf node, relative to this field. */
|
---|
1052 | AVLGCPHYSPTR pRight;
|
---|
1053 | /** Key value. */
|
---|
1054 | RTGCPHYS Key;
|
---|
1055 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
1056 | unsigned char uchHeight;
|
---|
1057 | } AVLGCPHYSNODECORE, *PAVLGCPHYSNODECORE;
|
---|
1058 |
|
---|
1059 | /** A offset base tree with RTGCPHYS keys. */
|
---|
1060 | typedef AVLGCPHYSPTR AVLGCPHYSTREE;
|
---|
1061 | /** Pointer to an offset base tree with RTGCPHYS keys. */
|
---|
1062 | typedef AVLGCPHYSTREE *PAVLGCPHYSTREE;
|
---|
1063 |
|
---|
1064 | /** Pointer to an internal tree pointer.
|
---|
1065 | * In this case it's a pointer to a relative offset. */
|
---|
1066 | typedef AVLGCPHYSTREE *PPAVLGCPHYSNODECORE;
|
---|
1067 |
|
---|
1068 | /** Callback function for RTAvlGCPhysDoWithAll() and RTAvlGCPhysDestroy().
|
---|
1069 | * @returns IPRT status codes. */
|
---|
1070 | typedef DECLCALLBACK(int) AVLGCPHYSCALLBACK(PAVLGCPHYSNODECORE pNode, void *pvUser);
|
---|
1071 | /** Pointer to callback function for RTAvlGCPhysDoWithAll() and RTAvlGCPhysDestroy(). */
|
---|
1072 | typedef AVLGCPHYSCALLBACK *PAVLGCPHYSCALLBACK;
|
---|
1073 |
|
---|
1074 | RTDECL(bool) RTAvlGCPhysInsert(PAVLGCPHYSTREE pTree, PAVLGCPHYSNODECORE pNode);
|
---|
1075 | RTDECL(PAVLGCPHYSNODECORE) RTAvlGCPhysRemove(PAVLGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
1076 | RTDECL(PAVLGCPHYSNODECORE) RTAvlGCPhysGet(PAVLGCPHYSTREE pTree, RTGCPHYS Key);
|
---|
1077 | RTDECL(int) RTAvlGCPhysDoWithAll(PAVLGCPHYSTREE pTree, int fFromLeft, PAVLGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
1078 | RTDECL(PAVLGCPHYSNODECORE) RTAvlGCPhysGetBestFit(PAVLGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
1079 | RTDECL(PAVLGCPHYSNODECORE) RTAvlGCPhysRemoveBestFit(PAVLGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
|
---|
1080 | RTDECL(int) RTAvlGCPhysDestroy(PAVLGCPHYSTREE pTree, PAVLGCPHYSCALLBACK pfnCallBack, void *pvParam);
|
---|
1081 |
|
---|
1082 | /** @} */
|
---|
1083 |
|
---|
1084 |
|
---|
1085 | /** AVL tree of RTFOFF ranges.
|
---|
1086 | * @{
|
---|
1087 | */
|
---|
1088 |
|
---|
1089 | /**
|
---|
1090 | * AVL Core node.
|
---|
1091 | */
|
---|
1092 | typedef struct _AVLRFOFFNodeCore
|
---|
1093 | {
|
---|
1094 | /** First key value in the range (inclusive). */
|
---|
1095 | RTFOFF Key;
|
---|
1096 | /** Last key value in the range (inclusive). */
|
---|
1097 | RTFOFF KeyLast;
|
---|
1098 | /** Offset to the left leaf node, relative to this field. */
|
---|
1099 | struct _AVLRFOFFNodeCore *pLeft;
|
---|
1100 | /** Offset to the right leaf node, relative to this field. */
|
---|
1101 | struct _AVLRFOFFNodeCore *pRight;
|
---|
1102 | /** Height of this tree: max(height(left), height(right)) + 1 */
|
---|
1103 | unsigned char uchHeight;
|
---|
1104 | } AVLRFOFFNODECORE, *PAVLRFOFFNODECORE;
|
---|
1105 |
|
---|
1106 | /** A pointer based tree with RTFOFF ranges. */
|
---|
1107 | typedef PAVLRFOFFNODECORE AVLRFOFFTREE;
|
---|
1108 | /** Pointer to a pointer based tree with RTFOFF ranges. */
|
---|
1109 | typedef AVLRFOFFTREE *PAVLRFOFFTREE;
|
---|
1110 |
|
---|
1111 | /** Pointer to an internal tree pointer.
|
---|
1112 | * In this case it's a pointer to a relative offset. */
|
---|
1113 | typedef AVLRFOFFTREE *PPAVLRFOFFNODECORE;
|
---|
1114 |
|
---|
1115 | /** Callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy().
|
---|
1116 | * @returns IPRT status codes. */
|
---|
1117 | typedef DECLCALLBACK(int) AVLRFOFFCALLBACK(PAVLRFOFFNODECORE pNode, void *pvUser);
|
---|
1118 | /** Pointer to callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
|
---|
1119 | typedef AVLRFOFFCALLBACK *PAVLRFOFFCALLBACK;
|
---|
1120 |
|
---|
1121 | RTDECL(bool) RTAvlrFileOffsetInsert( PAVLRFOFFTREE pTree, PAVLRFOFFNODECORE pNode);
|
---|
1122 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetRemove( PAVLRFOFFTREE pTree, RTFOFF Key);
|
---|
1123 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetGet( PAVLRFOFFTREE pTree, RTFOFF Key);
|
---|
1124 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetGetBestFit( PAVLRFOFFTREE pTree, RTFOFF Key, bool fAbove);
|
---|
1125 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetRangeGet( PAVLRFOFFTREE pTree, RTFOFF Key);
|
---|
1126 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetRangeRemove( PAVLRFOFFTREE pTree, RTFOFF Key);
|
---|
1127 | RTDECL(int) RTAvlrFileOffsetDoWithAll( PAVLRFOFFTREE pTree, int fFromLeft, PAVLRFOFFCALLBACK pfnCallBack, void *pvParam);
|
---|
1128 | RTDECL(int) RTAvlrFileOffsetDestroy( PAVLRFOFFTREE pTree, PAVLRFOFFCALLBACK pfnCallBack, void *pvParam);
|
---|
1129 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetGetRoot( PAVLRFOFFTREE pTree);
|
---|
1130 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetGetLeft( PAVLRFOFFNODECORE pNode);
|
---|
1131 | RTDECL(PAVLRFOFFNODECORE) RTAvlrFileOffsetGetRight( PAVLRFOFFNODECORE pNode);
|
---|
1132 |
|
---|
1133 | /** @} */
|
---|
1134 |
|
---|
1135 | /** @} */
|
---|
1136 |
|
---|
1137 | RT_C_DECLS_END
|
---|
1138 |
|
---|
1139 | #endif
|
---|
1140 |
|
---|