FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
OrderedInputPriorityQueue Class Referencefinal

Encapsulation class for a priority queue. More...

#include <OrderedInput.hpp>

Classes

struct  ltOrderedInputBlockPtr
 Less-than operator for OrderedInputBlock pointers. More...
 

Public Member Functions

 OrderedInputPriorityQueue ()
 
 ~OrderedInputPriorityQueue ()
 
size_t getQueueLength () const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Returns the number of entries in the queue. More...
 
OrderedInputBlockpopNextBlock (uint_fast8_t decrementBy=1) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") NONNULL_RETURN
 Removes the first element from the queue and returns it. More...
 
void removeNextBlock (uint_fast8_t decrementBy=1) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Specialized routine that does the equivalent of popNextBlock(), but does not intend to examine the block. More...
 
OrderedInputBlockpeekNextBlock () const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") NONNULL_RETURN
 Similar to popNextBlock() but does not remove the entry from the queue. More...
 
void pushBlock (OrderedInputBlock *block, uint_fast8_t incrementBy=1) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Add a new entry to the queue. More...
 

Protected Types

typedef std::vector< OrderedInputBlock * > pQueueContainer_t
 

Protected Attributes

std::priority_queue< OrderedInputBlock *, pQueueContainer_t, ltOrderedInputBlockPtrpQueue
 
size_t pQueueSize
 

Detailed Description

Encapsulation class for a priority queue.

The interface provided by this class allows the OrderedMultipleInputFilter logic to be separated from the actual implementation selected to realize a priority queue.

There are 5 functions implemented, which could be abstracted as an interface if a cost was not incurred. For the time being, these are not virtual functions.

The getQueueLength() function returns how many elements are in the queue. A value of 0 serves to indicate an empty queue. The count is maintained as a variable that can be retrieved using a single load instruction, so the cost is O(1).

The peekNextBlock() function gets the next element without affecting the queue, whereas removeNextBlock() simply removes the next element without examining it. The popNextBlock() function combines both to retrieve the next block and remove it from the queue. New elements are added via pushBlock().

Member Typedef Documentation

◆ pQueueContainer_t

Constructor & Destructor Documentation

◆ OrderedInputPriorityQueue()

OrderedInputPriorityQueue::OrderedInputPriorityQueue ( )
inline

◆ ~OrderedInputPriorityQueue()

OrderedInputPriorityQueue::~OrderedInputPriorityQueue ( )
inline

Member Function Documentation

◆ getQueueLength()

◆ peekNextBlock()

OrderedInputBlock* OrderedInputPriorityQueue::peekNextBlock ( ) const
inline

Similar to popNextBlock() but does not remove the entry from the queue.

Warning
Call only if content is in queue

References OME_PREFETCH.

Referenced by OrderedMultipleInputFilter::processQueue().

◆ popNextBlock()

OrderedInputBlock* OrderedInputPriorityQueue::popNextBlock ( uint_fast8_t  decrementBy = 1)
inline

Removes the first element from the queue and returns it.

Parameters
decrementByis an optional parameter that can be set to 0 if the client knows it will do an immediate pushBlock() with an increment of 0. This special scenario enables the increment/decrement instructions to be optimized away.
Warning
Call only if content is in queue

References OME_PREFETCH.

Referenced by OrderedInputSourceProxyWithReordering::getNextInputBlock(), and OrderedMultipleInputFilter::purgeQueue().

◆ pushBlock()

void OrderedInputPriorityQueue::pushBlock ( OrderedInputBlock block,
uint_fast8_t  incrementBy = 1 
)
inline

Add a new entry to the queue.

Parameters
blockspecifies the block to be added.
incrementByis an optional parameter that can be set to 0 if the client knows it just did a removeNextBlock() call with a decrement of 0. This usage enables the increment/decrement instructions to be optimized away.

Referenced by OrderedInputSourceProxyWithReordering::getNextInputBlock(), OrderedInputSourceProxyWithReordering::OrderedInputSourceProxyWithReordering(), OrderedMultipleInputFilter::preloadQueue(), and OrderedMultipleInputFilter::processQueue().

◆ removeNextBlock()

void OrderedInputPriorityQueue::removeNextBlock ( uint_fast8_t  decrementBy = 1)
inline

Specialized routine that does the equivalent of popNextBlock(), but does not intend to examine the block.

Parameters
decrementByis an optional parameter that can be set to 0 if the client knows it will do an immediate pushBlock() with an increment of 0. This sequence enables the increment/decrement instructions to be optimized away.
Warning
Call only if content is in queue

Referenced by OrderedMultipleInputFilter::processQueue().

Member Data Documentation

◆ pQueue

std::priority_queue<OrderedInputBlock *,pQueueContainer_t,ltOrderedInputBlockPtr> OrderedInputPriorityQueue::pQueue
protected

◆ pQueueSize

size_t OrderedInputPriorityQueue::pQueueSize
protected

The documentation for this class was generated from the following file:
Generated: Tue Jul 28 2020 16:03:27
Support Information