35#ifndef IMT_BASE_CORE_UTIL_DEQUEUE_H
36#define IMT_BASE_CORE_UTIL_DEQUEUE_H
108 return m_pMem[m_tail];
119 return m_pMem[m_tail];
130 return m_pMem[this->circularAddTo(m_head, m_queueSize - 1, m_queueSize)];
141 return m_pMem[this->circularAddTo(m_head, m_queueSize - 1, m_queueSize)];
159 size_t const head {m_head};
160 size_t const tail {m_tail};
173 size_t const add {this->circularAddTo(m_head, 1, m_queueSize)};
174 size_t const tail {m_tail};
182 size_t const m_queueSize;
190 size_t volatile m_head;
195 size_t volatile m_tail;
200 static size_t circularAddTo(
size_t volatile to,
size_t val,
size_t size) {
201 return (to + val) %
size;
208 m_queueSize {queueSize},
216 size_t const tmp {this->circularAddTo(m_head, 1, m_queueSize)};
225 size_t const tmp {this->circularAddTo(m_tail, m_queueSize - 1, m_queueSize)};
236 size_t const head {m_head};
237 size_t const tail {m_tail};
240 size_t const tmp {this->circularAddTo(m_tail, 1, m_queueSize)};
249 size_t const head {m_head};
250 size_t const tail {m_tail};
253 size_t const tmp {this->circularAddTo(m_head, m_queueSize - 1, m_queueSize)};
260 size_t const tmpHead {m_head};
261 size_t const tmpTail {m_tail};
263 if (tmpHead >= tmpTail) {
264 return tmpHead - tmpTail;
267 return (m_queueSize - tmpTail) + tmpHead;
Dequeue, Queue able to pop/push elements either from front or back.
void pop_front()
Removes the front element of the queue.
bool full() const
Returns if the queue is full.
T const & back() const
Returns the back element of the queue.
size_t size() const
Returns the current number of elements in the queue.
void push_back(T const &e)
Adds a new element to the back of the queue.
T const & front() const
Returns the front element of the queue.
bool empty() const
Returns if the queue is empty.
T & back()
Returns the back element of the queue.
T & front()
Returns the front element of the queue.
Dequeue(T *mem, uint16_t queueSize) noexcept
Constructor.
void pop_back()
Removes the last element of the queue.
void push_front(T const &e)
Adds a new element to the front of the queue.
This is a application specific file which is used to configure Imt.Base.Core.Math.
unsigned __int16 uint16_t