27 this->queue =
nullptr;
40 if (
nullptr != this->queue) {
46 this->msgSize = msgSize;
48 return this->initialize(depth, msgSize);
59 bool ret = enqueue(buffer, size, priority);
66 if( this->count > this->maxCount ) {
67 this->maxCount = this->count;
80 bool ret = dequeue(buffer, size, priority);
92 return (this->count == this->depth);
96 return (this->count == 0);
104 return this->maxCount;
109 return this->msgSize;
117 return (index % this->depth) * (
sizeof(
NATIVE_INT_TYPE) + this->msgSize);
122 void* dest = &data[index];
123 void* ptr = memcpy(dest, &size,
sizeof(size));
127 index +=
sizeof(size);
129 ptr = memcpy(dest, buffer, size);
136 void* source = &data[index];
137 void* ptr = memcpy(&storedSize, source,
sizeof(size));
143 if(storedSize > size){
150 index +=
sizeof(size);
151 source = &data[index];
152 ptr = memcpy(buffer, source, storedSize);
PlatformPointerCastType POINTER_CAST
PlatformIntType NATIVE_INT_TYPE
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
bool create(NATIVE_UINT_TYPE depth, NATIVE_UINT_TYPE msgSize)
BufferQueue creation.
NATIVE_UINT_TYPE getCount()
Get the current number of items on the queue.
NATIVE_UINT_TYPE getMsgSize()
Get the maximum message size.
bool pop(U8 *buffer, NATIVE_UINT_TYPE &size, NATIVE_INT_TYPE &priority)
pop an item off the queue
NATIVE_UINT_TYPE getDepth()
Get the queue depths.
bool isEmpty()
check if the queue is empty
~BufferQueue()
BufferQueue deconstructor.
bool push(const U8 *buffer, NATIVE_UINT_TYPE size, NATIVE_INT_TYPE priority)
push an item onto the queue
BufferQueue()
BufferQueue constructor.
bool isFull()
check if the queue is full
NATIVE_UINT_TYPE getMaxCount()
Get the maximum number of items seen on the queue.