18 #ifndef __H__OCULAR_UTILS_CIRCULAR_QUEUE__H__
19 #define __H__OCULAR_UTILS_CIRCULAR_QUEUE__H__
42 template<
typename T, std::
size_t MAX_ELEMENTS>
51 : m_Last(MAX_ELEMENTS - 1), m_Head(0), m_Tail(0), m_NumElements(0)
71 if(m_NumElements < MAX_ELEMENTS)
73 m_Array[m_Tail] = element;
93 retElement = m_Array[m_Head];
106 if(m_NumElements > 0)
121 bool retVal =
false;;
123 if(m_NumElements > 0)
125 retElement = m_Array[m_Head];
137 return m_NumElements;
157 if (m_NumElements > 0)
160 if (m_Head != m_Last)
178 if (m_NumElements < MAX_ELEMENTS)
180 if (m_Tail != m_Last)
195 unsigned m_NumElements;
200 std::array<T, MAX_ELEMENTS> m_Array;
bool dequeue(T &retElement)
Definition: CircularQueue.hpp:87
Definition: CircularQueue.hpp:43
bool enqueue(T const element)
Definition: CircularQueue.hpp:67
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
CircularQueue()
Definition: CircularQueue.hpp:50
unsigned getNumElements() const
Definition: CircularQueue.hpp:135
bool peek(T &retElement)
Definition: CircularQueue.hpp:119
void clear()
Definition: CircularQueue.hpp:143