Documentation 6b54b78464
Loading...
Searching...
No Matches
CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold > Class Template Reference

A queue-type container (push back, pop front), but with fast deletion of arbitrary items (possibly in the middle). More...

#include <CFastFindAndEraseQueue.hpp>

Public Types

enum  { ErasedValue = ErasedValue_ }
 
using ItemType = ItemType_
 
using Iterator = typename std::vector< ItemType >::const_iterator
 

Public Member Functions

 CFastFindAndEraseQueue ()=default
 Default construct.
 
 CFastFindAndEraseQueue (size_t N)
 Construct and initialize with [0,N) range.
 
size_t size () const
 
bool empty () const
 
Iterator begin () const
 
Iterator end () const
 
void push_back (ItemType value)
 Push back an item, that should be unique.
 
ItemType front () const
 Get the item in front of the queue.
 
bool findAndErase (const ItemType value)
 Main event, look for an item and erase it if present.
 

Detailed Description

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
class CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >

A queue-type container (push back, pop front), but with fast deletion of arbitrary items (possibly in the middle).

Parameters
[in]ItemType_- Type of the stored items.
[in]ErasedValue_- Value used to mark items for erasure.
[in]CleanupThreshold- Number of marked items that triggers full cleanup.
Note
It would not be a good idea to use non-trivial item types.

Member Typedef Documentation

◆ ItemType

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
using CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::ItemType = ItemType_

◆ Iterator

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
using CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::Iterator = typename std::vector<ItemType>::const_iterator

Member Enumeration Documentation

◆ anonymous enum

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
anonymous enum
Enumerator
ErasedValue 

Constructor & Destructor Documentation

◆ CFastFindAndEraseQueue() [1/2]

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::CFastFindAndEraseQueue ( )
default

Default construct.

◆ CFastFindAndEraseQueue() [2/2]

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::CFastFindAndEraseQueue ( size_t  N)
inline

Construct and initialize with [0,N) range.

Member Function Documentation

◆ begin()

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
Iterator CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::begin ( ) const
inline

◆ empty()

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
bool CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::empty ( ) const
inline

◆ end()

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
Iterator CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::end ( ) const
inline

◆ findAndErase()

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
bool CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::findAndErase ( const ItemType  value)
inline

Main event, look for an item and erase it if present.

Parameters
[in]value- Item to look for.
Returns
True, if something was erased, false otherwise.

◆ front()

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
ItemType CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::front ( ) const
inline

Get the item in front of the queue.

◆ push_back()

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
void CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::push_back ( ItemType  value)
inline

Push back an item, that should be unique.

Parameters
[in]value- The new item.

◆ size()

template<typename ItemType_ = unsigned long, ItemType_ ErasedValue_ = std::numeric_limits<ItemType_>::max(), size_t CleanupThreshold = 8192>
size_t CFastFindAndEraseQueue< ItemType_, ErasedValue_, CleanupThreshold >::size ( ) const
inline

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