27 this->m_queue =
nullptr;
40 if (
nullptr != this->m_queue) {
46 this->m_msgSize = msgSize;
47 this->m_depth = depth;
48 return this->initialize(depth, msgSize);
59 bool ret = enqueue(buffer, size, priority);
66 if( this->m_count > this->m_maxCount ) {
67 this->m_maxCount = this->m_count;
80 bool ret = dequeue(buffer, size, priority);
92 return (this->m_count == this->m_depth);
96 return (this->m_count == 0);
100 return this->m_count;
104 return this->m_maxCount;
109 return this->m_msgSize;
113 return this->m_depth;
117 return (index % this->m_depth) * (
sizeof(
NATIVE_INT_TYPE) + this->m_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.