64 indexes[pQueue->
stopIndex % depth] = index;
81 MaxHeap* heap =
new(std::nothrow) MaxHeap;
82 if (
nullptr == heap) {
85 if( !heap->create(depth) ) {
89 U8* data =
new(std::nothrow)
U8[depth*(
sizeof(msgSize) + msgSize)];
90 if (
nullptr == data) {
95 if (
nullptr == indexes) {
103 PriorityQueue* priorityQueue =
new(std::nothrow) PriorityQueue;
104 if (
nullptr == priorityQueue) {
110 priorityQueue->heap = heap;
111 priorityQueue->data = data;
112 priorityQueue->indexes = indexes;
113 priorityQueue->startIndex = 0;
114 priorityQueue->stopIndex = depth;
115 this->m_queue = priorityQueue;
119 void BufferQueue::finalize() {
120 PriorityQueue* pQueue =
static_cast<PriorityQueue*
>(this->m_queue);
121 if (
nullptr != pQueue)
123 MaxHeap* heap = pQueue->heap;
124 if (
nullptr != heap) {
127 U8* data = pQueue->data;
128 if (
nullptr != data) {
132 if (
nullptr != indexes)
138 this->m_queue =
nullptr;
144 PriorityQueue* pQueue =
static_cast<PriorityQueue*
>(this->m_queue);
145 MaxHeap* heap = pQueue->heap;
146 U8* data = pQueue->data;
152 bool ret = heap->push(priority, index);
156 this->enqueueBuffer(buffer, size, data, index);
164 PriorityQueue* pQueue =
static_cast<PriorityQueue*
>(this->m_queue);
165 MaxHeap* heap = pQueue->heap;
166 U8* data = pQueue->data;
170 bool ret = heap->pop(priority, index);
173 ret = this->dequeueBuffer(buffer, size, data, index);
177 ret = heap->push(priority, index);
PlatformIntType NATIVE_INT_TYPE
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
PlatformAssertArgType FwAssertArgType
A stable max heap data structure.
void returnIndex(PriorityQueue *pQueue, NATIVE_UINT_TYPE depth, NATIVE_UINT_TYPE index)
NATIVE_UINT_TYPE checkoutIndex(PriorityQueue *pQueue, NATIVE_UINT_TYPE depth)
NATIVE_UINT_TYPE startIndex
NATIVE_UINT_TYPE * indexes
NATIVE_UINT_TYPE stopIndex