VirtualBox

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

Last change on this file since 58591 was 56290, checked in by vboxsync, 10 years ago

IPRT: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1/* $Id: avl_Enum.cpp.h 56290 2015-06-09 14:01:31Z vboxsync $ */
2/** @file
3 * Enumeration routines for AVL trees.
4 */
5
6/*
7 * Copyright (C) 2006-2015 Oracle Corporation
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 (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef _kAVLEnum_h_
28#define _kAVLEnum_h_
29
30
31/**
32 * Gets the root node.
33 *
34 * @returns Pointer to the root node.
35 * @returns NULL if the tree is empty.
36 *
37 * @param ppTree Pointer to pointer to the tree root node.
38 */
39KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetRoot)(PPKAVLNODECORE ppTree)
40{
41 return KAVL_GET_POINTER_NULL(ppTree);
42}
43
44
45/**
46 * Gets the right node.
47 *
48 * @returns Pointer to the right node.
49 * @returns NULL if no right node.
50 *
51 * @param pNode The current node.
52 */
53KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetRight)(PKAVLNODECORE pNode)
54{
55 if (pNode)
56 return KAVL_GET_POINTER_NULL(&pNode->pRight);
57 return NULL;
58}
59
60
61/**
62 * Gets the left node.
63 *
64 * @returns Pointer to the left node.
65 * @returns NULL if no left node.
66 *
67 * @param pNode The current node.
68 */
69KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetLeft)(PKAVLNODECORE pNode)
70{
71 if (pNode)
72 return KAVL_GET_POINTER_NULL(&pNode->pLeft);
73 return NULL;
74}
75
76
77# ifdef KAVL_EQUAL_ALLOWED
78/**
79 * Gets the next node with an equal (start) key.
80 *
81 * @returns Pointer to the next equal node.
82 * @returns NULL if the current node was the last one with this key.
83 *
84 * @param pNode The current node.
85 */
86KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetNextEqual)(PKAVLNODECORE pNode)
87{
88 if (pNode)
89 return KAVL_GET_POINTER_NULL(&pNode->pList);
90 return NULL;
91}
92# endif /* KAVL_EQUAL_ALLOWED */
93
94#endif
95
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