18 #ifndef __H__OCULAR_UTILS_PRIORITY_MULTI_QUEUE__H__
19 #define __H__OCULAR_UTILS_PRIORITY_MULTI_QUEUE__H__
21 #include "CircularQueue.hpp"
22 #include "Priority.hpp"
49 template<
typename T, std::
size_t MAX_ELEMENTS>
75 bool enqueue(T
const element, Core::Priority priority)
81 case Core::Priority::Critical:
82 result = m_CriticalPriority.enqueue(element);
85 case Core::Priority::High:
86 result = m_HighPriority.enqueue(element);
89 case Core::Priority::Medium:
90 result = m_MediumPriority.enqueue(element);
93 case Core::Priority::Low:
94 result = m_LowPriority.enqueue(element);
123 return m_CriticalPriority.dequeue() ||
124 m_HighPriority.dequeue() ||
125 m_MediumPriority.dequeue() ||
126 m_LowPriority.dequeue();
148 return m_CriticalPriority.dequeue(retElement) ||
149 m_HighPriority.dequeue(retElement) ||
150 m_MediumPriority.dequeue(retElement) ||
151 m_LowPriority.dequeue(retElement);
160 bool dequeue(Core::Priority priority, T& retElement)
166 case Core::Priority::Critical:
167 result = m_CriticalPriority.dequeue(element);
170 case Core::Priority::High:
171 result = m_HighPriority.dequeue(element);
174 case Core::Priority::Medium:
175 result = m_MediumPriority.dequeue(element);
178 case Core::Priority::Low:
179 result = m_LowPriority.dequeue(element);
205 return m_CriticalPriority.getNumElements();
213 return m_HighPriority.getNumElements();
221 return m_MediumPriority.getNumElements();
229 return m_LowPriority.getNumElements();
249 CircularQueue<T, MAX_ELEMENTS> m_CriticalPriority;
250 CircularQueue<T, MAX_ELEMENTS> m_HighPriority;
251 CircularQueue<T, MAX_ELEMENTS> m_MediumPriority;
252 CircularQueue<T, MAX_ELEMENTS> m_LowPriority;
bool enqueue(T const element, Core::Priority priority)
Definition: PriorityMultiQueue.hpp:75
unsigned getNumElementsLow() const
Definition: PriorityMultiQueue.hpp:227
bool dequeue(Core::Priority priority, T &retElement)
Definition: PriorityMultiQueue.hpp:160
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
unsigned getNumElementsCritical() const
Definition: PriorityMultiQueue.hpp:203
unsigned getNumElementsHigh() const
Definition: PriorityMultiQueue.hpp:211
unsigned getNumElements() const
Definition: PriorityMultiQueue.hpp:192
bool dequeue(T &retElement)
Definition: PriorityMultiQueue.hpp:143
Definition: PriorityMultiQueue.hpp:50
bool dequeue()
Definition: PriorityMultiQueue.hpp:118
unsigned getNumElementsMedium() const
Definition: PriorityMultiQueue.hpp:219
bool empty()
Definition: PriorityMultiQueue.hpp:235