VirtualBox

source: vbox/trunk/src/VBox/Runtime/table/avl_Enum.cpp.h@ 4953

Last change on this file since 4953 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1/* $Id: avl_Enum.cpp.h 4071 2007-08-07 17:07:59Z 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
18#ifndef _kAVLEnum_h_
19#define _kAVLEnum_h_
20
21
22/**
23 * Gets the root node.
24 *
25 * @returns Pointer to the root node.
26 * @returns NULL if the tree is empty.
27 *
28 * @param ppTree Pointer to pointer to the tree root node.
29 */
30RTDECL(PKAVLNODECORE) KAVL_FN(GetRoot)(PPKAVLNODECORE ppTree)
31{
32 return KAVL_GET_POINTER_NULL(ppTree);
33}
34
35
36/**
37 * Gets the right node.
38 *
39 * @returns Pointer to the right node.
40 * @returns NULL if no right node.
41 *
42 * @param pNode The current node.
43 */
44RTDECL(PKAVLNODECORE) KAVL_FN(GetRight)(PKAVLNODECORE pNode)
45{
46 if (pNode)
47 return KAVL_GET_POINTER_NULL(&pNode->pRight);
48 return NULL;
49}
50
51
52/**
53 * Gets the left node.
54 *
55 * @returns Pointer to the left node.
56 * @returns NULL if no left node.
57 *
58 * @param pNode The current node.
59 */
60RTDECL(PKAVLNODECORE) KAVL_FN(GetLeft)(PKAVLNODECORE pNode)
61{
62 if (pNode)
63 return KAVL_GET_POINTER_NULL(&pNode->pLeft);
64 return NULL;
65}
66
67
68# ifdef KAVL_EQUAL_ALLOWED
69/**
70 * Gets the next node with an equal (start) key.
71 *
72 * @returns Pointer to the next equal node.
73 * @returns NULL if the current node was the last one with this key.
74 *
75 * @param pNode The current node.
76 */
77RTDECL(PKAVLNODECORE) KAVL_FN(GetNextEqual)(PKAVLNODECORE pNode)
78{
79 if (pNode)
80 return KAVL_GET_POINTER_NULL(&pNode->pList);
81 return NULL;
82}
83# endif /* KAVL_EQUAL_ALLOWED */
84
85#endif
86
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette