Ocular Engine
Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS > Class Template Reference

#include <PriorityMultiQueue.hpp>

Public Member Functions

bool enqueue (T const element, Core::Priority priority)
 
bool dequeue ()
 
bool dequeue (T &retElement)
 
bool dequeue (Core::Priority priority, T &retElement)
 
unsigned getNumElements () const
 
unsigned getNumElementsCritical () const
 
unsigned getNumElementsHigh () const
 
unsigned getNumElementsMedium () const
 
unsigned getNumElementsLow () const
 
bool empty ()
 
void clear ()
 

Detailed Description

template<typename T, std::size_t MAX_ELEMENTS>
class Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >

The PriorityMultiQueue is a priority system based off of the priority levels defined in Core::Priority

This structure is best suited for situations where high volumes of enqueue and dequeue actions are expected, and can perform up to 250 times faster than the STL std::priority_queue in this regard. Conversely, random-access is not supported and (currently) neither is set iteration.

If random-access and/or element iteration is required, please see PriorityList.

Member Function Documentation

template<typename T, std::size_t MAX_ELEMENTS>
bool Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::dequeue ( )
inline

Dequeues the first available element from the priority queues.
The queues are attempted to be dequeued in this order:

  • Critical
  • High
  • Medium
  • Low
Parameters
[out]retElementThe element removed from the queue.
Returns
TRUE if an element was successfully dequeued.
template<typename T, std::size_t MAX_ELEMENTS>
bool Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::dequeue ( T &  retElement)
inline

Dequeues the first available element from the priority queues.
The queues are attempted to be dequeued in this order:

  • Critical
  • High
  • Medium
  • Low
Parameters
[out]retElementThe element removed from the queue.
Returns
TRUE if an element was successfully dequeued.
template<typename T, std::size_t MAX_ELEMENTS>
bool Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::dequeue ( Core::Priority  priority,
T &  retElement 
)
inline

Dequeues the element at the front of the specified queue.

Parameters
[out]retElementThe element removed from the queue.
Returns
TRUE if an element was successfully dequeued.
template<typename T, std::size_t MAX_ELEMENTS>
bool Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::empty ( )
inline
Returns
TRUE if container is empty.
template<typename T, std::size_t MAX_ELEMENTS>
bool Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::enqueue ( T const  element,
Core::Priority  priority 
)
inline

Enqueues the element inside of the specified priority queue.

Returns
TRUE if successfully enqueued.
template<typename T, std::size_t MAX_ELEMENTS>
unsigned Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::getNumElements ( ) const
inline
Returns
Total number of elements across all priority levels.
template<typename T, std::size_t MAX_ELEMENTS>
unsigned Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::getNumElementsCritical ( ) const
inline
Returns
Number of elements in the Critical priority queue.
template<typename T, std::size_t MAX_ELEMENTS>
unsigned Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::getNumElementsHigh ( ) const
inline
Returns
Number of elements in the High priority queue.
template<typename T, std::size_t MAX_ELEMENTS>
unsigned Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::getNumElementsLow ( ) const
inline
Returns
Number of elements in the Low priority queue.
template<typename T, std::size_t MAX_ELEMENTS>
unsigned Ocular::Utils::PriorityMultiQueue< T, MAX_ELEMENTS >::getNumElementsMedium ( ) const
inline
Returns
Number of elements in the Medium priority queue.

The documentation for this class was generated from the following file: