Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

avl.h

Go to the documentation of this file.
/** @file
 * IPRT - AVL Trees.
 */

/*
 * Copyright (C) 1999-2003 knut st. osmundsen <bird-src-spam@anduin.net>
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 *
 * The contents of this file may alternatively be used under the terms
 * of the Common Development and Distribution License Version 1.0
 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
 * VirtualBox OSE distribution, in which case the provisions of the
 * CDDL are applicable instead of those of the GPL.
 *
 * You may elect to license modified versions of this file under the
 * terms and conditions of either the GPL or the CDDL or both.
 */

#ifndef ___iprt_avl_h
#define ___iprt_avl_h

#include <iprt/cdefs.h>
#include <iprt/types.h>

RT_C_DECLS_BEGIN

/** @defgroup grp_rt_avl    RTAvl - AVL Trees
 * @ingroup grp_rt
 * @{
 */


/** AVL tree of void pointers.
 * @{
 */

/**
 * AVL key type
 */
00047 typedef void *  AVLPVKEY;

/**
 * AVL Core node.
 */
00052 typedef struct _AVLPVNodeCore
{
    AVLPVKEY                Key;        /** Key value. */
00055     struct _AVLPVNodeCore  *pLeft;      /** Pointer to left leaf node. */
00056     struct _AVLPVNodeCore  *pRight;     /** Pointer to right leaf node. */
00057     unsigned char           uchHeight;  /** Height of this tree: max(height(left), height(right)) + 1 */
} AVLPVNODECORE, *PAVLPVNODECORE, **PPAVLPVNODECORE;

/** A tree with void pointer keys. */
00061 typedef PAVLPVNODECORE     AVLPVTREE;
/** Pointer to a tree with void pointer keys. */
00063 typedef PPAVLPVNODECORE    PAVLPVTREE;

/** Callback function for AVLPVDoWithAll(). */
00066 typedef DECLCALLBACK(int) AVLPVCALLBACK(PAVLPVNODECORE, void *);
/** Pointer to callback function for AVLPVDoWithAll(). */
typedef AVLPVCALLBACK *PAVLPVCALLBACK;

/*
 * Functions.
 */
RTDECL(bool)            RTAvlPVInsert(PAVLPVTREE ppTree, PAVLPVNODECORE pNode);
RTDECL(PAVLPVNODECORE)  RTAvlPVRemove(PAVLPVTREE ppTree, AVLPVKEY Key);
RTDECL(PAVLPVNODECORE)  RTAvlPVGet(PAVLPVTREE ppTree, AVLPVKEY Key);
RTDECL(PAVLPVNODECORE)  RTAvlPVGetBestFit(PAVLPVTREE ppTree, AVLPVKEY Key, bool fAbove);
RTDECL(PAVLPVNODECORE)  RTAvlPVRemoveBestFit(PAVLPVTREE ppTree, AVLPVKEY Key, bool fAbove);
RTDECL(int)             RTAvlPVDoWithAll(PAVLPVTREE ppTree, int fFromLeft, PAVLPVCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)             RTAvlPVDestroy(PAVLPVTREE ppTree, PAVLPVCALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of unsigned long.
 * @{
 */

/**
 * AVL key type
 */
00091 typedef unsigned long   AVLULKEY;

/**
 * AVL Core node.
 */
00096 typedef struct _AVLULNodeCore
{
    AVLULKEY                Key;        /** Key value. */
00099     struct _AVLULNodeCore  *pLeft;      /** Pointer to left leaf node. */
00100     struct _AVLULNodeCore  *pRight;     /** Pointer to right leaf node. */
00101     unsigned char           uchHeight;  /** Height of this tree: max(height(left), height(right)) + 1 */
} AVLULNODECORE, *PAVLULNODECORE, **PPAVLULNODECORE;


/** Callback function for AVLULDoWithAll(). */
00106 typedef DECLCALLBACK(int) AVLULCALLBACK(PAVLULNODECORE, void*);
/** Pointer to callback function for AVLULDoWithAll(). */
typedef AVLULCALLBACK *PAVLULCALLBACK;


/*
 * Functions.
 */
RTDECL(bool)            RTAvlULInsert(PPAVLULNODECORE ppTree, PAVLULNODECORE pNode);
RTDECL(PAVLULNODECORE)  RTAvlULRemove(PPAVLULNODECORE ppTree, AVLULKEY Key);
RTDECL(PAVLULNODECORE)  RTAvlULGet(PPAVLULNODECORE ppTree, AVLULKEY Key);
RTDECL(PAVLULNODECORE)  RTAvlULGetBestFit(PPAVLULNODECORE ppTree, AVLULKEY Key, bool fAbove);
RTDECL(PAVLULNODECORE)  RTAvlULRemoveBestFit(PPAVLULNODECORE ppTree, AVLULKEY Key, bool fAbove);
RTDECL(int)             RTAvlULDoWithAll(PPAVLULNODECORE ppTree, int fFromLeft, PAVLULCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)             RTAvlULDestroy(PPAVLULNODECORE pTree, PAVLULCALLBACK pfnCallBack, void *pvParam);

/** @} */



/** AVL tree of uint32_t
 * @{
 */

/** AVL key type. */
00131 typedef uint32_t    AVLU32KEY;

/** AVL Core node. */
00134 typedef struct _AVLU32NodeCore
{
00136     AVLU32KEY               Key;        /**< Key value. */
00137     struct _AVLU32NodeCore *pLeft;      /**< Pointer to left leaf node. */
00138     struct _AVLU32NodeCore *pRight;     /**< Pointer to right leaf node. */
00139     unsigned char           uchHeight;  /**< Height of this tree: max(height(left), height(right)) + 1 */
} AVLU32NODECORE, *PAVLU32NODECORE, **PPAVLU32NODECORE;

/** A tree with void pointer keys. */
00143 typedef PAVLU32NODECORE     AVLU32TREE;
/** Pointer to a tree with void pointer keys. */
00145 typedef PPAVLU32NODECORE    PAVLU32TREE;

/** Callback function for AVLU32DoWithAll() & AVLU32Destroy(). */
00148 typedef DECLCALLBACK(int) AVLU32CALLBACK(PAVLU32NODECORE, void*);
/** Pointer to callback function for AVLU32DoWithAll() & AVLU32Destroy(). */
typedef AVLU32CALLBACK *PAVLU32CALLBACK;


/*
 * Functions.
 */
RTDECL(bool)            RTAvlU32Insert(PAVLU32TREE pTree, PAVLU32NODECORE pNode);
RTDECL(PAVLU32NODECORE) RTAvlU32Remove(PAVLU32TREE pTree, AVLU32KEY Key);
RTDECL(PAVLU32NODECORE) RTAvlU32Get(PAVLU32TREE pTree, AVLU32KEY Key);
RTDECL(PAVLU32NODECORE) RTAvlU32GetBestFit(PAVLU32TREE pTree, AVLU32KEY Key, bool fAbove);
RTDECL(PAVLU32NODECORE) RTAvlU32RemoveBestFit(PAVLU32TREE pTree, AVLU32KEY Key, bool fAbove);
RTDECL(int)             RTAvlU32DoWithAll(PAVLU32TREE pTree, int fFromLeft, PAVLU32CALLBACK pfnCallBack, void *pvParam);
RTDECL(int)             RTAvlU32Destroy(PAVLU32TREE pTree, PAVLU32CALLBACK pfnCallBack, void *pvParam);

/** @} */

/**
 * AVL uint32_t type for the relative offset pointer scheme.
 */
00169 typedef int32_t     AVLOU32;

typedef uint32_t     AVLOU32KEY;

/**
 * AVL Core node.
 */
00176 typedef struct _AVLOU32NodeCore
{
    /** Key value. */
00179     AVLOU32KEY          Key;
    /** Offset to the left leaf node, relative to this field. */
00181     AVLOU32             pLeft;
    /** Offset to the right leaf node, relative to this field. */
00183     AVLOU32             pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00185     unsigned char       uchHeight;
} AVLOU32NODECORE, *PAVLOU32NODECORE;

/** A offset base tree with uint32_t keys. */
00189 typedef AVLOU32         AVLOU32TREE;
/** Pointer to a offset base tree with uint32_t keys. */
00191 typedef AVLOU32TREE    *PAVLOU32TREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00195 typedef AVLOU32TREE    *PPAVLOU32NODECORE;

/** Callback function for RTAvloU32DoWithAll(). */
typedef DECLCALLBACK(int)   AVLOU32CALLBACK(PAVLOU32NODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvloU32DoWithAll(). */
00200 typedef AVLOU32CALLBACK *PAVLOU32CALLBACK;

RTDECL(bool)                  RTAvloU32Insert(PAVLOU32TREE pTree, PAVLOU32NODECORE pNode);
RTDECL(PAVLOU32NODECORE)      RTAvloU32Remove(PAVLOU32TREE pTree, AVLOU32KEY Key);
RTDECL(PAVLOU32NODECORE)      RTAvloU32Get(PAVLOU32TREE pTree, AVLOU32KEY Key);
RTDECL(int)                   RTAvloU32DoWithAll(PAVLOU32TREE pTree, int fFromLeft, PAVLOU32CALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLOU32NODECORE)      RTAvloU32GetBestFit(PAVLOU32TREE ppTree, AVLOU32KEY Key, bool fAbove);
RTDECL(PAVLOU32NODECORE)      RTAvloU32RemoveBestFit(PAVLOU32TREE ppTree, AVLOU32KEY Key, bool fAbove);
RTDECL(int)                   RTAvloU32Destroy(PAVLOU32TREE pTree, PAVLOU32CALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of uint32_t, list duplicates.
 * @{
 */

/** AVL key type. */
00218 typedef uint32_t    AVLLU32KEY;

/** AVL Core node. */
00221 typedef struct _AVLLU32NodeCore
{
00223     AVLLU32KEY                  Key;        /**< Key value. */
00224     unsigned char               uchHeight;  /**< Height of this tree: max(height(left), height(right)) + 1 */
00225     struct _AVLLU32NodeCore    *pLeft;      /**< Pointer to left leaf node. */
00226     struct _AVLLU32NodeCore    *pRight;     /**< Pointer to right leaf node. */
00227     struct _AVLLU32NodeCore    *pList;      /**< Pointer to next node with the same key. */
} AVLLU32NODECORE, *PAVLLU32NODECORE, **PPAVLLU32NODECORE;

/** Callback function for RTAvllU32DoWithAll() & RTAvllU32Destroy(). */
00231 typedef DECLCALLBACK(int) AVLLU32CALLBACK(PAVLLU32NODECORE, void*);
/** Pointer to callback function for RTAvllU32DoWithAll() & RTAvllU32Destroy(). */
typedef AVLLU32CALLBACK *PAVLLU32CALLBACK;


/*
 * Functions.
 */
RTDECL(bool)                RTAvllU32Insert(PPAVLLU32NODECORE ppTree, PAVLLU32NODECORE pNode);
RTDECL(PAVLLU32NODECORE)    RTAvllU32Remove(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key);
RTDECL(PAVLLU32NODECORE)    RTAvllU32Get(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key);
RTDECL(PAVLLU32NODECORE)    RTAvllU32GetBestFit(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key, bool fAbove);
RTDECL(PAVLLU32NODECORE)    RTAvllU32RemoveBestFit(PPAVLLU32NODECORE ppTree, AVLLU32KEY Key, bool fAbove);
RTDECL(int)                 RTAvllU32DoWithAll(PPAVLLU32NODECORE ppTree, int fFromLeft, PAVLLU32CALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                 RTAvllU32Destroy(PPAVLLU32NODECORE pTree, PAVLLU32CALLBACK pfnCallBack, void *pvParam);

/** @} */



/** AVL tree of RTGCPHYSes - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00258 typedef int32_t     AVLOGCPHYS;

/**
 * AVL Core node.
 */
00263 typedef struct _AVLOGCPhysNodeCore
{
    /** Key value. */
00266     RTGCPHYS            Key;
    /** Offset to the left leaf node, relative to this field. */
00268     AVLOGCPHYS          pLeft;
    /** Offset to the right leaf node, relative to this field. */
00270     AVLOGCPHYS          pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00272     unsigned char       uchHeight;
    /** Padding */
00274     unsigned char       Padding[7];
} AVLOGCPHYSNODECORE, *PAVLOGCPHYSNODECORE;

/** A offset base tree with uint32_t keys. */
00278 typedef AVLOGCPHYS         AVLOGCPHYSTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00280 typedef AVLOGCPHYSTREE    *PAVLOGCPHYSTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00284 typedef AVLOGCPHYSTREE    *PPAVLOGCPHYSNODECORE;

/** Callback function for RTAvloGCPhysDoWithAll() and RTAvloGCPhysDestroy(). */
typedef DECLCALLBACK(int)   AVLOGCPHYSCALLBACK(PAVLOGCPHYSNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvloGCPhysDoWithAll() and RTAvloGCPhysDestroy(). */
00289 typedef AVLOGCPHYSCALLBACK *PAVLOGCPHYSCALLBACK;

RTDECL(bool)                    RTAvloGCPhysInsert(PAVLOGCPHYSTREE pTree, PAVLOGCPHYSNODECORE pNode);
RTDECL(PAVLOGCPHYSNODECORE)     RTAvloGCPhysRemove(PAVLOGCPHYSTREE pTree, RTGCPHYS Key);
RTDECL(PAVLOGCPHYSNODECORE)     RTAvloGCPhysGet(PAVLOGCPHYSTREE pTree, RTGCPHYS Key);
RTDECL(int)                     RTAvloGCPhysDoWithAll(PAVLOGCPHYSTREE pTree, int fFromLeft, PAVLOGCPHYSCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLOGCPHYSNODECORE)     RTAvloGCPhysGetBestFit(PAVLOGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
RTDECL(PAVLOGCPHYSNODECORE)     RTAvloGCPhysRemoveBestFit(PAVLOGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
RTDECL(int)                     RTAvloGCPhysDestroy(PAVLOGCPHYSTREE pTree, PAVLOGCPHYSCALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of RTGCPHYS ranges - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00309 typedef int32_t     AVLROGCPHYS;

/**
 * AVL Core node.
 */
00314 typedef struct _AVLROGCPhysNodeCore
{
    /** First key value in the range (inclusive). */
00317     RTGCPHYS            Key;
    /** Last key value in the range (inclusive). */
00319     RTGCPHYS            KeyLast;
    /** Offset to the left leaf node, relative to this field. */
00321     AVLROGCPHYS         pLeft;
    /** Offset to the right leaf node, relative to this field. */
00323     AVLROGCPHYS         pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00325     unsigned char       uchHeight;
    /** Padding */
00327     unsigned char       Padding[7];
} AVLROGCPHYSNODECORE, *PAVLROGCPHYSNODECORE;

/** A offset base tree with uint32_t keys. */
00331 typedef AVLROGCPHYS         AVLROGCPHYSTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00333 typedef AVLROGCPHYSTREE    *PAVLROGCPHYSTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00337 typedef AVLROGCPHYSTREE    *PPAVLROGCPHYSNODECORE;

/** Callback function for RTAvlroGCPhysDoWithAll() and RTAvlroGCPhysDestroy(). */
typedef DECLCALLBACK(int)   AVLROGCPHYSCALLBACK(PAVLROGCPHYSNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlroGCPhysDoWithAll() and RTAvlroGCPhysDestroy(). */
00342 typedef AVLROGCPHYSCALLBACK *PAVLROGCPHYSCALLBACK;

RTDECL(bool)                    RTAvlroGCPhysInsert(PAVLROGCPHYSTREE pTree, PAVLROGCPHYSNODECORE pNode);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysRemove(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysGet(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysRangeGet(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysRangeRemove(PAVLROGCPHYSTREE pTree, RTGCPHYS Key);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysGetBestFit(PAVLROGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
RTDECL(int)                     RTAvlroGCPhysDoWithAll(PAVLROGCPHYSTREE pTree, int fFromLeft, PAVLROGCPHYSCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                     RTAvlroGCPhysDestroy(PAVLROGCPHYSTREE pTree, PAVLROGCPHYSCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysGetRoot(PAVLROGCPHYSTREE pTree);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysGetLeft(PAVLROGCPHYSNODECORE pNode);
RTDECL(PAVLROGCPHYSNODECORE)    RTAvlroGCPhysGetRight(PAVLROGCPHYSNODECORE pNode);

/** @} */


/** AVL tree of RTGCPTRs.
 * @{
 */

/**
 * AVL Core node.
 */
00366 typedef struct _AVLGCPtrNodeCore
{
    /** Key value. */
00369     RTGCPTR             Key;
    /** Pointer to the left node. */
00371     struct _AVLGCPtrNodeCore *pLeft;
    /** Pointer to the right node. */
00373     struct _AVLGCPtrNodeCore *pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00375     unsigned char       uchHeight;
} AVLGCPTRNODECORE, *PAVLGCPTRNODECORE, **PPAVLGCPTRNODECORE;

/** A tree of RTGCPTR keys. */
00379 typedef PAVLGCPTRNODECORE     AVLGCPTRTREE;
/** Pointer to a tree of RTGCPTR keys. */
00381 typedef PPAVLGCPTRNODECORE    PAVLGCPTRTREE;

/** Callback function for RTAvlGCPtrDoWithAll(). */
typedef DECLCALLBACK(int)   AVLGCPTRCALLBACK(PAVLGCPTRNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlGCPtrDoWithAll(). */
00386 typedef AVLGCPTRCALLBACK *PAVLGCPTRCALLBACK;

RTDECL(bool)                    RTAvlGCPtrInsert(PAVLGCPTRTREE pTree, PAVLGCPTRNODECORE pNode);
RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrRemove(PAVLGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrGet(PAVLGCPTRTREE pTree, RTGCPTR Key);
RTDECL(int)                     RTAvlGCPtrDoWithAll(PAVLGCPTRTREE pTree, int fFromLeft, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrGetBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrRemoveBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
RTDECL(int)                     RTAvlGCPtrDestroy(PAVLGCPTRTREE pTree, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of RTGCPTRs - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00406 typedef int32_t     AVLOGCPTR;

/**
 * AVL Core node.
 */
00411 typedef struct _AVLOGCPtrNodeCore
{
    /** Key value. */
00414     RTGCPTR             Key;
    /** Offset to the left leaf node, relative to this field. */
00416     AVLOGCPTR           pLeft;
    /** Offset to the right leaf node, relative to this field. */
00418     AVLOGCPTR           pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00420     unsigned char       uchHeight;
    unsigned char       padding[GC_ARCH_BITS == 64 ? 7 : 3];
} AVLOGCPTRNODECORE, *PAVLOGCPTRNODECORE;

/** A offset base tree with uint32_t keys. */
00425 typedef AVLOGCPTR         AVLOGCPTRTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00427 typedef AVLOGCPTRTREE    *PAVLOGCPTRTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00431 typedef AVLOGCPTRTREE    *PPAVLOGCPTRNODECORE;

/** Callback function for RTAvloGCPtrDoWithAll(). */
typedef DECLCALLBACK(int)   AVLOGCPTRCALLBACK(PAVLOGCPTRNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvloGCPtrDoWithAll(). */
00436 typedef AVLOGCPTRCALLBACK *PAVLOGCPTRCALLBACK;

RTDECL(bool)                    RTAvloGCPtrInsert(PAVLOGCPTRTREE pTree, PAVLOGCPTRNODECORE pNode);
RTDECL(PAVLOGCPTRNODECORE)      RTAvloGCPtrRemove(PAVLOGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLOGCPTRNODECORE)      RTAvloGCPtrGet(PAVLOGCPTRTREE pTree, RTGCPTR Key);
RTDECL(int)                     RTAvloGCPtrDoWithAll(PAVLOGCPTRTREE pTree, int fFromLeft, PAVLOGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLOGCPTRNODECORE)      RTAvloGCPtrGetBestFit(PAVLOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
RTDECL(PAVLOGCPTRNODECORE)      RTAvloGCPtrRemoveBestFit(PAVLOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
RTDECL(int)                     RTAvloGCPtrDestroy(PAVLOGCPTRTREE pTree, PAVLOGCPTRCALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of RTGCPTR ranges.
 * @{
 */

/**
 * AVL Core node.
 */
00456 typedef struct _AVLRGCPtrNodeCore
{
    /** First key value in the range (inclusive). */
00459     RTGCPTR             Key;
    /** Last key value in the range (inclusive). */
00461     RTGCPTR             KeyLast;
    /** Offset to the left leaf node, relative to this field. */
00463     struct _AVLRGCPtrNodeCore  *pLeft;
    /** Offset to the right leaf node, relative to this field. */
00465     struct _AVLRGCPtrNodeCore  *pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00467     unsigned char       uchHeight;
} AVLRGCPTRNODECORE, *PAVLRGCPTRNODECORE;

/** A offset base tree with RTGCPTR keys. */
00471 typedef PAVLRGCPTRNODECORE AVLRGCPTRTREE;
/** Pointer to a offset base tree with RTGCPTR keys. */
00473 typedef AVLRGCPTRTREE    *PAVLRGCPTRTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00477 typedef AVLRGCPTRTREE    *PPAVLRGCPTRNODECORE;

/** Callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
typedef DECLCALLBACK(int)   AVLRGCPTRCALLBACK(PAVLRGCPTRNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
00482 typedef AVLRGCPTRCALLBACK *PAVLRGCPTRCALLBACK;

RTDECL(bool)                   RTAvlrGCPtrInsert(       PAVLRGCPTRTREE pTree, PAVLRGCPTRNODECORE pNode);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrRemove(       PAVLRGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrGet(          PAVLRGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrGetBestFit(   PAVLRGCPTRTREE pTree, RTGCPTR Key, bool fAbove);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrRangeGet(     PAVLRGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrRangeRemove(  PAVLRGCPTRTREE pTree, RTGCPTR Key);
RTDECL(int)                    RTAvlrGCPtrDoWithAll(    PAVLRGCPTRTREE pTree, int fFromLeft, PAVLRGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                    RTAvlrGCPtrDestroy(      PAVLRGCPTRTREE pTree, PAVLRGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrGetRoot(      PAVLRGCPTRTREE pTree);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrGetLeft(      PAVLRGCPTRNODECORE pNode);
RTDECL(PAVLRGCPTRNODECORE)     RTAvlrGCPtrGetRight(     PAVLRGCPTRNODECORE pNode);

/** @} */


/** AVL tree of RTGCPTR ranges - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00506 typedef int32_t     AVLROGCPTR;

/**
 * AVL Core node.
 */
00511 typedef struct _AVLROGCPtrNodeCore
{
    /** First key value in the range (inclusive). */
00514     RTGCPTR             Key;
    /** Last key value in the range (inclusive). */
00516     RTGCPTR             KeyLast;
    /** Offset to the left leaf node, relative to this field. */
00518     AVLROGCPTR          pLeft;
    /** Offset to the right leaf node, relative to this field. */
00520     AVLROGCPTR          pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00522     unsigned char       uchHeight;
    unsigned char       padding[GC_ARCH_BITS == 64 ? 7 : 7];
} AVLROGCPTRNODECORE, *PAVLROGCPTRNODECORE;

/** A offset base tree with uint32_t keys. */
00527 typedef AVLROGCPTR         AVLROGCPTRTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00529 typedef AVLROGCPTRTREE    *PAVLROGCPTRTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00533 typedef AVLROGCPTRTREE    *PPAVLROGCPTRNODECORE;

/** Callback function for RTAvlroGCPtrDoWithAll() and RTAvlroGCPtrDestroy(). */
typedef DECLCALLBACK(int)   AVLROGCPTRCALLBACK(PAVLROGCPTRNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlroGCPtrDoWithAll() and RTAvlroGCPtrDestroy(). */
00538 typedef AVLROGCPTRCALLBACK *PAVLROGCPTRCALLBACK;

RTDECL(bool)                    RTAvlroGCPtrInsert(PAVLROGCPTRTREE pTree, PAVLROGCPTRNODECORE pNode);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrRemove(PAVLROGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrGet(PAVLROGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrGetBestFit(PAVLROGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrRangeGet(PAVLROGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrRangeRemove(PAVLROGCPTRTREE pTree, RTGCPTR Key);
RTDECL(int)                     RTAvlroGCPtrDoWithAll(PAVLROGCPTRTREE pTree, int fFromLeft, PAVLROGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                     RTAvlroGCPtrDestroy(PAVLROGCPTRTREE pTree, PAVLROGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrGetRoot(PAVLROGCPTRTREE pTree);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrGetLeft(PAVLROGCPTRNODECORE pNode);
RTDECL(PAVLROGCPTRNODECORE)     RTAvlroGCPtrGetRight(PAVLROGCPTRNODECORE pNode);

/** @} */


/** AVL tree of RTGCPTR ranges (overlapping supported) - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00562 typedef int32_t     AVLROOGCPTR;

/**
 * AVL Core node.
 */
00567 typedef struct _AVLROOGCPtrNodeCore
{
    /** First key value in the range (inclusive). */
00570     RTGCPTR             Key;
    /** Last key value in the range (inclusive). */
00572     RTGCPTR             KeyLast;
    /** Offset to the left leaf node, relative to this field. */
00574     AVLROOGCPTR         pLeft;
    /** Offset to the right leaf node, relative to this field. */
00576     AVLROOGCPTR         pRight;
    /** Pointer to the list of string with the same key. Don't touch. */
00578     AVLROOGCPTR         pList;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00580     unsigned char       uchHeight;
} AVLROOGCPTRNODECORE, *PAVLROOGCPTRNODECORE;

/** A offset base tree with uint32_t keys. */
00584 typedef AVLROOGCPTR         AVLROOGCPTRTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00586 typedef AVLROOGCPTRTREE    *PAVLROOGCPTRTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00590 typedef AVLROOGCPTRTREE    *PPAVLROOGCPTRNODECORE;

/** Callback function for RTAvlrooGCPtrDoWithAll() and RTAvlrooGCPtrDestroy(). */
typedef DECLCALLBACK(int)   AVLROOGCPTRCALLBACK(PAVLROOGCPTRNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlrooGCPtrDoWithAll() and RTAvlrooGCPtrDestroy(). */
00595 typedef AVLROOGCPTRCALLBACK *PAVLROOGCPTRCALLBACK;

RTDECL(bool)                    RTAvlrooGCPtrInsert(PAVLROOGCPTRTREE pTree, PAVLROOGCPTRNODECORE pNode);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrRemove(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrGet(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrGetBestFit(PAVLROOGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrRangeGet(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrRangeRemove(PAVLROOGCPTRTREE pTree, RTGCPTR Key);
RTDECL(int)                     RTAvlrooGCPtrDoWithAll(PAVLROOGCPTRTREE pTree, int fFromLeft, PAVLROOGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                     RTAvlrooGCPtrDestroy(PAVLROOGCPTRTREE pTree, PAVLROOGCPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrGetRoot(PAVLROOGCPTRTREE pTree);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrGetLeft(PAVLROOGCPTRNODECORE pNode);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrGetRight(PAVLROOGCPTRNODECORE pNode);
RTDECL(PAVLROOGCPTRNODECORE)    RTAvlrooGCPtrGetNextEqual(PAVLROOGCPTRNODECORE pNode);

/** @} */


/** AVL tree of RTUINTPTR.
 * @{
 */

/**
 * AVL RTUINTPTR node core.
 */
00620 typedef struct _AVLUIntPtrNodeCore
{
    /** Key value. */
00623     RTUINTPTR                   Key;
    /** Offset to the left leaf node, relative to this field. */
00625     struct _AVLUIntPtrNodeCore *pLeft;
    /** Offset to the right leaf node, relative to this field. */
00627     struct _AVLUIntPtrNodeCore *pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00629     unsigned char               uchHeight;
} AVLUINTPTRNODECORE;
/** Pointer to a RTUINTPTR AVL node core.*/
00632 typedef AVLUINTPTRNODECORE *PAVLUINTPTRNODECORE;

/** A pointer based tree with RTUINTPTR keys. */
00635 typedef PAVLUINTPTRNODECORE AVLUINTPTRTREE;
/** Pointer to a offset base tree with RTUINTPTR keys. */
00637 typedef AVLUINTPTRTREE     *PAVLUINTPTRTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a pointer. */
00641 typedef AVLUINTPTRTREE     *PPAVLUINTPTRNODECORE;

/** Callback function for RTAvlUIntPtrDoWithAll() and RTAvlUIntPtrDestroy(). */
typedef DECLCALLBACK(int)    AVLUINTPTRCALLBACK(PAVLUINTPTRNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlUIntPtrDoWithAll() and RTAvlUIntPtrDestroy(). */
00646 typedef AVLUINTPTRCALLBACK *PAVLUINTPTRCALLBACK;

RTDECL(bool)                    RTAvlUIntPtrInsert(    PAVLUINTPTRTREE pTree, PAVLUINTPTRNODECORE pNode);
RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrRemove(    PAVLUINTPTRTREE pTree, RTUINTPTR Key);
RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGet(       PAVLUINTPTRTREE pTree, RTUINTPTR Key);
RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetBestFit(PAVLUINTPTRTREE pTree, RTUINTPTR Key, bool fAbove);
RTDECL(int)                     RTAvlUIntPtrDoWithAll( PAVLUINTPTRTREE pTree, int fFromLeft, PAVLUINTPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                     RTAvlUIntPtrDestroy(   PAVLUINTPTRTREE pTree, PAVLUINTPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetRoot(   PAVLUINTPTRTREE pTree);
RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetLeft(   PAVLUINTPTRNODECORE pNode);
RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetRight(  PAVLUINTPTRNODECORE pNode);

/** @} */


/** AVL tree of RTUINTPTR ranges.
 * @{
 */

/**
 * AVL RTUINTPTR range node core.
 */
00668 typedef struct _AVLRUIntPtrNodeCore
{
    /** First key value in the range (inclusive). */
00671     RTUINTPTR                       Key;
    /** Last key value in the range (inclusive). */
00673     RTUINTPTR                       KeyLast;
    /** Offset to the left leaf node, relative to this field. */
00675     struct _AVLRUIntPtrNodeCore    *pLeft;
    /** Offset to the right leaf node, relative to this field. */
00677     struct _AVLRUIntPtrNodeCore    *pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00679     unsigned char                   uchHeight;
} AVLRUINTPTRNODECORE;
/** Pointer to an AVL RTUINTPTR range node code. */
00682 typedef AVLRUINTPTRNODECORE *PAVLRUINTPTRNODECORE;

/** A pointer based tree with RTUINTPTR ranges. */
00685 typedef PAVLRUINTPTRNODECORE AVLRUINTPTRTREE;
/** Pointer to a pointer based tree with RTUINTPTR ranges. */
00687 typedef AVLRUINTPTRTREE     *PAVLRUINTPTRTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a pointer. */
00691 typedef AVLRUINTPTRTREE     *PPAVLRUINTPTRNODECORE;

/** Callback function for RTAvlrUIntPtrDoWithAll() and RTAvlrUIntPtrDestroy(). */
typedef DECLCALLBACK(int)    AVLRUINTPTRCALLBACK(PAVLRUINTPTRNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlrUIntPtrDoWithAll() and RTAvlrUIntPtrDestroy(). */
00696 typedef AVLRUINTPTRCALLBACK *PAVLRUINTPTRCALLBACK;

RTDECL(bool)                   RTAvlrUIntPtrInsert(     PAVLRUINTPTRTREE pTree, PAVLRUINTPTRNODECORE pNode);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrRemove(     PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrGet(        PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrGetBestFit( PAVLRUINTPTRTREE pTree, RTUINTPTR Key, bool fAbove);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrRangeGet(   PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrRangeRemove(PAVLRUINTPTRTREE pTree, RTUINTPTR Key);
RTDECL(int)                    RTAvlrUIntPtrDoWithAll(  PAVLRUINTPTRTREE pTree, int fFromLeft, PAVLRUINTPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                    RTAvlrUIntPtrDestroy(    PAVLRUINTPTRTREE pTree, PAVLRUINTPTRCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrGetRoot(    PAVLRUINTPTRTREE pTree);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrGetLeft(    PAVLRUINTPTRNODECORE pNode);
RTDECL(PAVLRUINTPTRNODECORE)   RTAvlrUIntPtrGetRight(   PAVLRUINTPTRNODECORE pNode);

/** @} */


/** AVL tree of RTHCPHYSes - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00720 typedef int32_t     AVLOHCPHYS;

/**
 * AVL Core node.
 */
00725 typedef struct _AVLOHCPhysNodeCore
{
    /** Key value. */
00728     RTHCPHYS            Key;
    /** Offset to the left leaf node, relative to this field. */
00730     AVLOHCPHYS          pLeft;
    /** Offset to the right leaf node, relative to this field. */
00732     AVLOHCPHYS          pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00734     unsigned char       uchHeight;
#if HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64
    unsigned char       Padding[7]; /**< Alignment padding. */
#endif
} AVLOHCPHYSNODECORE, *PAVLOHCPHYSNODECORE;

/** A offset base tree with uint32_t keys. */
00741 typedef AVLOHCPHYS         AVLOHCPHYSTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00743 typedef AVLOHCPHYSTREE    *PAVLOHCPHYSTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00747 typedef AVLOHCPHYSTREE    *PPAVLOHCPHYSNODECORE;

/** Callback function for RTAvloHCPhysDoWithAll() and RTAvloHCPhysDestroy(). */
typedef DECLCALLBACK(int)   AVLOHCPHYSCALLBACK(PAVLOHCPHYSNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvloHCPhysDoWithAll() and RTAvloHCPhysDestroy(). */
00752 typedef AVLOHCPHYSCALLBACK *PAVLOHCPHYSCALLBACK;

RTDECL(bool)                    RTAvloHCPhysInsert(PAVLOHCPHYSTREE pTree, PAVLOHCPHYSNODECORE pNode);
RTDECL(PAVLOHCPHYSNODECORE)     RTAvloHCPhysRemove(PAVLOHCPHYSTREE pTree, RTHCPHYS Key);
RTDECL(PAVLOHCPHYSNODECORE)     RTAvloHCPhysGet(PAVLOHCPHYSTREE pTree, RTHCPHYS Key);
RTDECL(int)                     RTAvloHCPhysDoWithAll(PAVLOHCPHYSTREE pTree, int fFromLeft, PAVLOHCPHYSCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLOHCPHYSNODECORE)     RTAvloHCPhysGetBestFit(PAVLOHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
RTDECL(PAVLOHCPHYSNODECORE)     RTAvloHCPhysRemoveBestFit(PAVLOHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
RTDECL(int)                     RTAvloHCPhysDestroy(PAVLOHCPHYSTREE pTree, PAVLOHCPHYSCALLBACK pfnCallBack, void *pvParam);

/** @} */



/** AVL tree of RTIOPORTs - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00773 typedef int32_t     AVLOIOPORTPTR;

/**
 * AVL Core node.
 */
00778 typedef struct _AVLOIOPortNodeCore
{
    /** Offset to the left leaf node, relative to this field. */
00781     AVLOIOPORTPTR       pLeft;
    /** Offset to the right leaf node, relative to this field. */
00783     AVLOIOPORTPTR       pRight;
    /** Key value. */
00785     RTIOPORT            Key;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00787     unsigned char       uchHeight;
} AVLOIOPORTNODECORE, *PAVLOIOPORTNODECORE;

/** A offset base tree with uint32_t keys. */
00791 typedef AVLOIOPORTPTR      AVLOIOPORTTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00793 typedef AVLOIOPORTTREE    *PAVLOIOPORTTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00797 typedef AVLOIOPORTTREE    *PPAVLOIOPORTNODECORE;

/** Callback function for RTAvloIOPortDoWithAll() and RTAvloIOPortDestroy(). */
typedef DECLCALLBACK(int)   AVLOIOPORTCALLBACK(PAVLOIOPORTNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvloIOPortDoWithAll() and RTAvloIOPortDestroy(). */
00802 typedef AVLOIOPORTCALLBACK *PAVLOIOPORTCALLBACK;

RTDECL(bool)                    RTAvloIOPortInsert(PAVLOIOPORTTREE pTree, PAVLOIOPORTNODECORE pNode);
RTDECL(PAVLOIOPORTNODECORE)     RTAvloIOPortRemove(PAVLOIOPORTTREE pTree, RTIOPORT Key);
RTDECL(PAVLOIOPORTNODECORE)     RTAvloIOPortGet(PAVLOIOPORTTREE pTree, RTIOPORT Key);
RTDECL(int)                     RTAvloIOPortDoWithAll(PAVLOIOPORTTREE pTree, int fFromLeft, PAVLOIOPORTCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLOIOPORTNODECORE)     RTAvloIOPortGetBestFit(PAVLOIOPORTTREE ppTree, RTIOPORT Key, bool fAbove);
RTDECL(PAVLOIOPORTNODECORE)     RTAvloIOPortRemoveBestFit(PAVLOIOPORTTREE ppTree, RTIOPORT Key, bool fAbove);
RTDECL(int)                     RTAvloIOPortDestroy(PAVLOIOPORTTREE pTree, PAVLOIOPORTCALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of RTIOPORT ranges - using relative offsets internally.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00822 typedef int32_t     AVLROIOPORTPTR;

/**
 * AVL Core node.
 */
00827 typedef struct _AVLROIOPortNodeCore
{
    /** First key value in the range (inclusive). */
00830     RTIOPORT            Key;
    /** Last key value in the range (inclusive). */
00832     RTIOPORT            KeyLast;
    /** Offset to the left leaf node, relative to this field. */
00834     AVLROIOPORTPTR      pLeft;
    /** Offset to the right leaf node, relative to this field. */
00836     AVLROIOPORTPTR      pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00838     unsigned char       uchHeight;
} AVLROIOPORTNODECORE, *PAVLROIOPORTNODECORE;

/** A offset base tree with uint32_t keys. */
00842 typedef AVLROIOPORTPTR      AVLROIOPORTTREE;
/** Pointer to a offset base tree with uint32_t keys. */
00844 typedef AVLROIOPORTTREE    *PAVLROIOPORTTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00848 typedef AVLROIOPORTTREE    *PPAVLROIOPORTNODECORE;

/** Callback function for RTAvlroIOPortDoWithAll() and RTAvlroIOPortDestroy(). */
typedef DECLCALLBACK(int)   AVLROIOPORTCALLBACK(PAVLROIOPORTNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlroIOPortDoWithAll() and RTAvlroIOPortDestroy(). */
00853 typedef AVLROIOPORTCALLBACK *PAVLROIOPORTCALLBACK;

RTDECL(bool)                    RTAvlroIOPortInsert(PAVLROIOPORTTREE pTree, PAVLROIOPORTNODECORE pNode);
RTDECL(PAVLROIOPORTNODECORE)    RTAvlroIOPortRemove(PAVLROIOPORTTREE pTree, RTIOPORT Key);
RTDECL(PAVLROIOPORTNODECORE)    RTAvlroIOPortGet(PAVLROIOPORTTREE pTree, RTIOPORT Key);
RTDECL(PAVLROIOPORTNODECORE)    RTAvlroIOPortRangeGet(PAVLROIOPORTTREE pTree, RTIOPORT Key);
RTDECL(PAVLROIOPORTNODECORE)    RTAvlroIOPortRangeRemove(PAVLROIOPORTTREE pTree, RTIOPORT Key);
RTDECL(int)                     RTAvlroIOPortDoWithAll(PAVLROIOPORTTREE pTree, int fFromLeft, PAVLROIOPORTCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                     RTAvlroIOPortDestroy(PAVLROIOPORTTREE pTree, PAVLROIOPORTCALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of RTHCPHYSes.
 * @{
 */

/**
 * AVL 'pointer' type for the relative offset pointer scheme.
 */
00873 typedef struct _AVLHCPhysNodeCore  *AVLHCPHYSPTR;

/**
 * AVL Core node.
 */
00878 typedef struct _AVLHCPhysNodeCore
{
    /** Offset to the left leaf node, relative to this field. */
00881     AVLHCPHYSPTR        pLeft;
    /** Offset to the right leaf node, relative to this field. */
00883     AVLHCPHYSPTR        pRight;
    /** Key value. */
00885     RTHCPHYS            Key;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00887     unsigned char       uchHeight;
} AVLHCPHYSNODECORE, *PAVLHCPHYSNODECORE;

/** A offset base tree with RTHCPHYS keys. */
00891 typedef AVLHCPHYSPTR      AVLHCPHYSTREE;
/** Pointer to a offset base tree with RTHCPHYS keys. */
00893 typedef AVLHCPHYSTREE    *PAVLHCPHYSTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00897 typedef AVLHCPHYSTREE    *PPAVLHCPHYSNODECORE;

/** Callback function for RTAvlHCPhysDoWithAll() and RTAvlHCPhysDestroy(). */
typedef DECLCALLBACK(int)   AVLHCPHYSCALLBACK(PAVLHCPHYSNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlHCPhysDoWithAll() and RTAvlHCPhysDestroy(). */
00902 typedef AVLHCPHYSCALLBACK *PAVLHCPHYSCALLBACK;

RTDECL(bool)                    RTAvlHCPhysInsert(PAVLHCPHYSTREE pTree, PAVLHCPHYSNODECORE pNode);
RTDECL(PAVLHCPHYSNODECORE)      RTAvlHCPhysRemove(PAVLHCPHYSTREE pTree, RTHCPHYS Key);
RTDECL(PAVLHCPHYSNODECORE)      RTAvlHCPhysGet(PAVLHCPHYSTREE pTree, RTHCPHYS Key);
RTDECL(int)                     RTAvlHCPhysDoWithAll(PAVLHCPHYSTREE pTree, int fFromLeft, PAVLHCPHYSCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLHCPHYSNODECORE)      RTAvlHCPhysGetBestFit(PAVLHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
RTDECL(PAVLHCPHYSNODECORE)      RTAvlHCPhysRemoveBestFit(PAVLHCPHYSTREE ppTree, RTHCPHYS Key, bool fAbove);
RTDECL(int)                     RTAvlHCPhysDestroy(PAVLHCPHYSTREE pTree, PAVLHCPHYSCALLBACK pfnCallBack, void *pvParam);

/** @} */


/** AVL tree of RTFOFF ranges.
 * @{
 */

/**
 * AVL Core node.
 */
00922 typedef struct _AVLRFOFFNodeCore
{
    /** First key value in the range (inclusive). */
00925     RTFOFF             Key;
    /** Last key value in the range (inclusive). */
00927     RTFOFF             KeyLast;
    /** Offset to the left leaf node, relative to this field. */
00929     struct _AVLRFOFFNodeCore  *pLeft;
    /** Offset to the right leaf node, relative to this field. */
00931     struct _AVLRFOFFNodeCore  *pRight;
    /** Height of this tree: max(height(left), height(right)) + 1 */
00933     unsigned char       uchHeight;
} AVLRFOFFNODECORE, *PAVLRFOFFNODECORE;

/** A pointer based tree with RTFOFF ranges. */
00937 typedef PAVLRFOFFNODECORE AVLRFOFFTREE;
/** Pointer to a pointer based tree with RTFOFF ranges. */
00939 typedef AVLRFOFFTREE    *PAVLRFOFFTREE;

/** Pointer to an internal tree pointer.
 * In this case it's a pointer to a relative offset. */
00943 typedef AVLRFOFFTREE    *PPAVLRFOFFNODECORE;

/** Callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
typedef DECLCALLBACK(int)   AVLRFOFFCALLBACK(PAVLRFOFFNODECORE pNode, void *pvUser);
/** Pointer to callback function for RTAvlrGCPtrDoWithAll() and RTAvlrGCPtrDestroy(). */
00948 typedef AVLRFOFFCALLBACK *PAVLRFOFFCALLBACK;

RTDECL(bool)                  RTAvlrFileOffsetInsert(       PAVLRFOFFTREE pTree, PAVLRFOFFNODECORE pNode);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetRemove(       PAVLRFOFFTREE pTree, RTFOFF Key);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetGet(          PAVLRFOFFTREE pTree, RTFOFF Key);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetGetBestFit(   PAVLRFOFFTREE pTree, RTFOFF Key, bool fAbove);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetRangeGet(     PAVLRFOFFTREE pTree, RTFOFF Key);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetRangeRemove(  PAVLRFOFFTREE pTree, RTFOFF Key);
RTDECL(int)                   RTAvlrFileOffsetDoWithAll(    PAVLRFOFFTREE pTree, int fFromLeft, PAVLRFOFFCALLBACK pfnCallBack, void *pvParam);
RTDECL(int)                   RTAvlrFileOffsetDestroy(      PAVLRFOFFTREE pTree, PAVLRFOFFCALLBACK pfnCallBack, void *pvParam);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetGetRoot(      PAVLRFOFFTREE pTree);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetGetLeft(      PAVLRFOFFNODECORE pNode);
RTDECL(PAVLRFOFFNODECORE)     RTAvlrFileOffsetGetRight(     PAVLRFOFFNODECORE pNode);

/** @} */

/** @} */

RT_C_DECLS_END

#endif


Generated by  Doxygen 1.6.0   Back to index