58 indexes[pQueue->
stopIndex % depth] = index;
70 MaxHeap* heap =
new MaxHeap;
74 if( !heap->create(depth) ) {
77 U8* data =
new U8[depth*(
sizeof(msgSize) + msgSize)];
82 if (
NULL == indexes) {
86 indexes[ii] = getBufferIndex(ii);
88 PriorityQueue* priorityQueue =
new PriorityQueue;
89 if (
NULL == priorityQueue) {
92 priorityQueue->heap = heap;
93 priorityQueue->data = data;
94 priorityQueue->indexes = indexes;
95 priorityQueue->startIndex = 0;
96 priorityQueue->stopIndex = depth;
97 this->queue = priorityQueue;
101 void BufferQueue::finalize() {
102 PriorityQueue* pQueue =
static_cast<PriorityQueue*
>(this->queue);
105 MaxHeap* heap = pQueue->heap;
109 U8* data = pQueue->data;
126 PriorityQueue* pQueue =
static_cast<PriorityQueue*
>(this->queue);
127 MaxHeap* heap = pQueue->heap;
128 U8* data = pQueue->data;
134 bool ret = heap->push(priority, index);
138 this->enqueueBuffer(buffer, size, data, index);
146 PriorityQueue* pQueue =
static_cast<PriorityQueue*
>(this->queue);
147 MaxHeap* heap = pQueue->heap;
148 U8* data = pQueue->data;
152 bool ret = heap->pop(priority, index);
155 ret = this->dequeueBuffer(buffer, size, data, index);
159 ret = heap->push(priority, index);