123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #ifndef __LOC_HEAP__
- #define __LOC_HEAP__
- #include <stddef.h>
- #include <string.h>
- namespace loc_util {
- class LocRankable {
- public:
- virtual inline ~LocRankable() {}
-
-
-
-
-
- virtual int ranks(LocRankable& rankable) = 0;
-
- inline bool outRanks(LocRankable& rankable) { return ranks(rankable) > 0; }
- };
- class LocHeapNode;
- class LocHeap {
- protected:
- LocHeapNode* mTree;
- public:
- inline LocHeap() : mTree(NULL) {}
- ~LocHeap();
-
-
-
-
-
- void push(LocRankable& node);
-
-
-
-
- LocRankable* peek();
-
-
-
- LocRankable* pop();
-
-
-
-
- LocRankable* remove(LocRankable& rankable);
- #ifdef __LOC_UNIT_TEST__
- bool checkTree();
- uint32_t getTreeSize();
- #endif
- };
- }
- #endif
|