VirtualBox

Changeset 32284 in vbox


Ignore:
Timestamp:
Sep 7, 2010 12:29:14 PM (14 years ago)
Author:
vboxsync
Message:

Pointer based GCPhys AVL tree

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/avl.h

    r28800 r32284  
    912912/** @} */
    913913
     914/** AVL tree of RTGCPHYSes.
     915 * @{
     916 */
     917
     918/**
     919 * AVL 'pointer' type for the relative offset pointer scheme.
     920 */
     921typedef struct _AVLGCPhysNodeCore  *AVLGCPHYSPTR;
     922
     923/**
     924 * AVL Core node.
     925 */
     926typedef struct _AVLGCPhysNodeCore
     927{
     928    /** Offset to the left leaf node, relative to this field. */
     929    AVLGCPHYSPTR        pLeft;
     930    /** Offset to the right leaf node, relative to this field. */
     931    AVLGCPHYSPTR        pRight;
     932    /** Key value. */
     933    RTGCPHYS            Key;
     934    /** Height of this tree: max(height(left), height(right)) + 1 */
     935    unsigned char       uchHeight;
     936} AVLGCPHYSNODECORE, *PAVLGCPHYSNODECORE;
     937
     938/** A offset base tree with RTGCPHYS keys. */
     939typedef AVLGCPHYSPTR      AVLGCPHYSTREE;
     940/** Pointer to a offset base tree with RTGCPHYS keys. */
     941typedef AVLGCPHYSTREE    *PAVLGCPHYSTREE;
     942
     943/** Pointer to an internal tree pointer.
     944 * In this case it's a pointer to a relative offset. */
     945typedef AVLGCPHYSTREE    *PPAVLGCPHYSNODECORE;
     946
     947/** Callback function for RTAvlGCPhysDoWithAll() and RTAvlGCPhysDestroy(). */
     948typedef DECLCALLBACK(int)   AVLGCPHYSCALLBACK(PAVLGCPHYSNODECORE pNode, void *pvUser);
     949/** Pointer to callback function for RTAvlGCPhysDoWithAll() and RTAvlGCPhysDestroy(). */
     950typedef AVLGCPHYSCALLBACK *PAVLGCPHYSCALLBACK;
     951
     952RTDECL(bool)                    RTAvlGCPhysInsert(PAVLGCPHYSTREE pTree, PAVLGCPHYSNODECORE pNode);
     953RTDECL(PAVLGCPHYSNODECORE)      RTAvlGCPhysRemove(PAVLGCPHYSTREE pTree, RTGCPHYS Key);
     954RTDECL(PAVLGCPHYSNODECORE)      RTAvlGCPhysGet(PAVLGCPHYSTREE pTree, RTGCPHYS Key);
     955RTDECL(int)                     RTAvlGCPhysDoWithAll(PAVLGCPHYSTREE pTree, int fFromLeft, PAVLGCPHYSCALLBACK pfnCallBack, void *pvParam);
     956RTDECL(PAVLGCPHYSNODECORE)      RTAvlGCPhysGetBestFit(PAVLGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
     957RTDECL(PAVLGCPHYSNODECORE)      RTAvlGCPhysRemoveBestFit(PAVLGCPHYSTREE ppTree, RTGCPHYS Key, bool fAbove);
     958RTDECL(int)                     RTAvlGCPhysDestroy(PAVLGCPHYSTREE pTree, PAVLGCPHYSCALLBACK pfnCallBack, void *pvParam);
     959
     960/** @} */
     961
    914962
    915963/** AVL tree of RTFOFF ranges.
Note: See TracChangeset for help on using the changeset viewer.

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