VirtualBox

Changeset 34218 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Nov 21, 2010 5:00:38 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67962
Message:

AVL: add range version with uint64_t keys

File:
1 edited

Legend:

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

    r33268 r34218  
    297297
    298298
     299/** AVL tree of uint64_t ranges.
     300 * @{
     301 */
     302
     303/**
     304 * AVL key type
     305 */
     306typedef uint64_t AVLRU64KEY;
     307
     308/**
     309 * AVL Core node.
     310 */
     311typedef struct AVLRU64NodeCore
     312{
     313    AVLRU64KEY               Key;        /**< First key value in the range (inclusive). */
     314    AVLRU64KEY               KeyLast;    /**< Last key value in the range (inclusive). */
     315    struct AVLRU64NodeCore  *pLeft;      /**< Pointer to left leaf node. */
     316    struct AVLRU64NodeCore  *pRight;     /**< Pointer to right leaf node. */
     317    unsigned char            uchHeight;  /**< Height of this tree: max(height(left), height(right)) + 1 */
     318} AVLRU64NODECORE, *PAVLRU64NODECORE, **PPAVLRU64NODECORE;
     319
     320/** A tree with void pointer keys. */
     321typedef PAVLRU64NODECORE    AVLRU64TREE;
     322/** Pointer to a tree with void pointer keys. */
     323typedef PPAVLRU64NODECORE   PAVLRU64TREE;
     324
     325/** Callback function for AVLRU64DoWithAll(). */
     326typedef DECLCALLBACK(int) AVLRU64CALLBACK(PAVLRU64NODECORE, void *);
     327/** Pointer to callback function for AVLU64DoWithAll(). */
     328typedef AVLRU64CALLBACK *PAVLRU64CALLBACK;
     329
     330/*
     331 * Functions.
     332 */
     333RTDECL(bool)             RTAvlrU64Insert(PAVLRU64TREE ppTree, PAVLRU64NODECORE pNode);
     334RTDECL(PAVLRU64NODECORE) RTAvlrU64Remove(PAVLRU64TREE ppTree, AVLRU64KEY Key);
     335RTDECL(PAVLRU64NODECORE) RTAvlrU64Get(PAVLRU64TREE ppTree, AVLRU64KEY Key);
     336RTDECL(PAVLRU64NODECORE) RTAvlrU64RangeGet(PAVLRU64TREE ppTree, AVLRU64KEY Key);
     337RTDECL(PAVLRU64NODECORE) RTAvlrU64RangeRemove(PAVLRU64TREE ppTree, AVLRU64KEY Key);
     338RTDECL(PAVLRU64NODECORE) RTAvlrU64GetBestFit(PAVLRU64TREE ppTree, AVLRU64KEY Key, bool fAbove);
     339RTDECL(PAVLRU64NODECORE) RTAvlrU64RemoveBestFit(PAVLRU64TREE ppTree, AVLRU64KEY Key, bool fAbove);
     340RTDECL(int)              RTAvlrU64DoWithAll(PAVLRU64TREE ppTree, int fFromLeft, PAVLRU64CALLBACK pfnCallBack, void *pvParam);
     341RTDECL(int)              RTAvlrU64Destroy(PAVLRU64TREE ppTree, PAVLRU64CALLBACK pfnCallBack, void *pvParam);
     342
     343/** @} */
     344
     345
     346
    299347/** AVL tree of RTGCPHYSes - using relative offsets internally.
    300348 * @{
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