gwnavruntime/querysystem/workingmemcontainers/workingmembinaryheap.h Source File
Go to the documentation of this file.
8 #ifndef Navigation_WorkingMemBinaryHeap_H
9 #define Navigation_WorkingMemBinaryHeap_H
20 static const IndexInBinHeap IndexInBinHeap_Removed = IndexInBinHeap_UnSet - 1;
23 class WorkingMemBinaryHeapIndexTracker_None
27 static void OnRemove(T& ) {}
28 static void OnSwap(T& , T& ) {}
31 template <
class Item,
typename Comparator = DefaultLess<Item>,
typename BinaryHeapIndexTracker = WorkingMemBinaryHeapIndexTracker_None<Item> >
32 class WorkingMemBinaryHeap
35 WorkingMemBinaryHeap();
36 WorkingMemBinaryHeap(WorkingMemory* workingMemory);
38 void Init(WorkingMemory* workingMemory);
40 KY_INLINE
bool IsInitialized()
const;
42 KY_INLINE
KyUInt32 GetCapacity()
const;
44 KY_INLINE
bool IsEmpty()
const;
45 KY_INLINE
bool IsFull();
47 KY_INLINE
void Clear();
51 KY_INLINE
void GetFirst(Item& item)
const;
55 KY_INLINE
const Item& GetFirst()
const;
58 void Insert(
const Item& item);
63 void ExtractFirst(Item& item);
70 Comparator& GetComparator() {
return m_comparator; }
72 void ReleaseWorkingMemoryBuffer() { m_heap.ReleaseWorkingMemoryBuffer(); }
75 KY_INLINE
KyUInt32 GetParentIndex(
KyUInt32 index) {
return (index - 1) >> 1; }
76 KY_INLINE
KyUInt32 GetLeftChildIndex(
KyUInt32 index) {
return (index << 1) + 1; }
77 KY_INLINE
KyUInt32 GetRigthChildIndex(
KyUInt32 index) {
return (index << 1) + 2; }
80 void PercolateUp(
KyUInt32 HoleIndex);
86 WorkingMemArray<Item> m_heap;
88 Comparator m_comparator;
89 BinaryHeapIndexTracker m_binayHeapTracker;
Definition: gamekitcrowddispersion.h:20
#define KyUInt16MAXVAL
The maximum value that can be stored in the KyUInt16 variable type.
Definition: types.h:230
unsigned short KyUInt16
Type used internally to represent an unsigned 16-bit integer.
Definition: types.h:40
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36