1 | /* $Id: avl_Enum.cpp.h 2981 2007-06-01 16:01:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Enumeration routines for AVL trees.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef _kAVLEnum_h_
|
---|
23 | #define _kAVLEnum_h_
|
---|
24 |
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * Gets the root node.
|
---|
28 | *
|
---|
29 | * @returns Pointer to the root node.
|
---|
30 | * @returns NULL if the tree is empty.
|
---|
31 | *
|
---|
32 | * @param ppTree Pointer to pointer to the tree root node.
|
---|
33 | */
|
---|
34 | RTDECL(PKAVLNODECORE) KAVL_FN(GetRoot)(PPKAVLNODECORE ppTree)
|
---|
35 | {
|
---|
36 | return KAVL_GET_POINTER_NULL(ppTree);
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Gets the right node.
|
---|
42 | *
|
---|
43 | * @returns Pointer to the right node.
|
---|
44 | * @returns NULL if no right node.
|
---|
45 | *
|
---|
46 | * @param pNode The current node.
|
---|
47 | */
|
---|
48 | RTDECL(PKAVLNODECORE) KAVL_FN(GetRight)(PKAVLNODECORE pNode)
|
---|
49 | {
|
---|
50 | if (pNode)
|
---|
51 | return KAVL_GET_POINTER_NULL(&pNode->pRight);
|
---|
52 | return NULL;
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Gets the left node.
|
---|
58 | *
|
---|
59 | * @returns Pointer to the left node.
|
---|
60 | * @returns NULL if no left node.
|
---|
61 | *
|
---|
62 | * @param pNode The current node.
|
---|
63 | */
|
---|
64 | RTDECL(PKAVLNODECORE) KAVL_FN(GetLeft)(PKAVLNODECORE pNode)
|
---|
65 | {
|
---|
66 | if (pNode)
|
---|
67 | return KAVL_GET_POINTER_NULL(&pNode->pLeft);
|
---|
68 | return NULL;
|
---|
69 | }
|
---|
70 |
|
---|
71 |
|
---|
72 | # ifdef KAVL_EQUAL_ALLOWED
|
---|
73 | /**
|
---|
74 | * Gets the next node with an equal (start) key.
|
---|
75 | *
|
---|
76 | * @returns Pointer to the next equal node.
|
---|
77 | * @returns NULL if the current node was the last one with this key.
|
---|
78 | *
|
---|
79 | * @param pNode The current node.
|
---|
80 | */
|
---|
81 | RTDECL(PKAVLNODECORE) KAVL_FN(GetNextEqual)(PKAVLNODECORE pNode)
|
---|
82 | {
|
---|
83 | if (pNode)
|
---|
84 | return KAVL_GET_POINTER_NULL(&pNode->pList);
|
---|
85 | return NULL;
|
---|
86 | }
|
---|
87 | # endif /* KAVL_EQUAL_ALLOWED */
|
---|
88 |
|
---|
89 | #endif
|
---|
90 |
|
---|