ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
LRUCacheTable< TAllocator, TValueDescriptor, THash, TEqual >::TForwardIterator< TConstOrMutable > Class Template Reference

Description:

template<typename TAllocator, typename TValueDescriptor, typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable>
class alib::containers::LRUCacheTable< TAllocator, TValueDescriptor, THash, TEqual >::TForwardIterator< TConstOrMutable >

Templated implementation of std::iterator_traits. Will be exposed by outer class's definitions Iterator and ConstIterator.

As the name of the class indicates, this iterator satisfies the C++ standard library concept ForwardIterator .

Template Parameters
TConstOrMutableA constant or mutable version of StoredType.

Definition at line 216 of file lrucachetable.hpp.

#include <lrucachetable.hpp>

Collaboration diagram for LRUCacheTable< TAllocator, TValueDescriptor, THash, TEqual >::TForwardIterator< TConstOrMutable >:
[legend]

Public Method Index:

 TForwardIterator ()
 Default constructor.
 
 TForwardIterator (const TForwardIterator &other)=default
 
 TForwardIterator (const TMutable &mutableIt)
 
 TForwardIterator (Entry *pEntry, LRUCacheTable *pTable, integer pListIdx)
 
 TForwardIterator (LRUCacheTable *pTable, integer pListIdx)
 
template<typename... TArgs>
TConstOrMutable & Construct (TArgs &&... args) const
 
const KeyTypeKey () const
 
MappedTypeMapped () const
 
bool operator!= (TForwardIterator other) const
 
TConstOrMutable & operator* () const
 
TForwardIteratoroperator++ ()
 
TForwardIterator operator++ (int)
 
TConstOrMutable * operator-> () const
 
TForwardIteratoroperator= (const TForwardIterator &other)=default
 
bool operator== (TForwardIterator other) const
 
TConstOrMutable & Value () const
 

Protected Field Index:

Entryentry
 The pointer to the actual cache entry.
 
integer listIdx
 The actual list.
 
LRUCacheTabletable
 The pointer to the actual cache entry.
 

Private Type Index:

using difference_type = integer
 Implementation of std::iterator_traits.
 
using iterator_category = std::forward_iterator_tag
 Implementation of std::iterator_traits.
 
using pointer = TConstOrMutable*
 Implementation of std::iterator_traits.
 
using reference = TConstOrMutable&
 Implementation of std::iterator_traits.
 
using value_type = TConstOrMutable
 Implementation of std::iterator_traits.
 

Type Definition Details:

◆ difference_type

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
using difference_type = integer
private

Implementation of std::iterator_traits.

Definition at line 224 of file lrucachetable.hpp.

◆ iterator_category

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
using iterator_category = std::forward_iterator_tag
private

Implementation of std::iterator_traits.

Definition at line 222 of file lrucachetable.hpp.

◆ pointer

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
using pointer = TConstOrMutable*
private

Implementation of std::iterator_traits.

Definition at line 225 of file lrucachetable.hpp.

◆ reference

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
using reference = TConstOrMutable&
private

Implementation of std::iterator_traits.

Definition at line 226 of file lrucachetable.hpp.

◆ value_type

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
using value_type = TConstOrMutable
private

Implementation of std::iterator_traits.

Definition at line 223 of file lrucachetable.hpp.

Field Details:

◆ entry

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
Entry* entry
protected

The pointer to the actual cache entry.

Definition at line 230 of file lrucachetable.hpp.

◆ listIdx

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
integer listIdx
protected

The actual list.

Definition at line 236 of file lrucachetable.hpp.

◆ table

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
LRUCacheTable* table
protected

The pointer to the actual cache entry.

Definition at line 233 of file lrucachetable.hpp.

Constructor(s) / Destructor Details:

◆ TForwardIterator() [1/5]

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator ( )
inline

Default constructor.

Definition at line 240 of file lrucachetable.hpp.

◆ TForwardIterator() [2/5]

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator ( const TForwardIterator< TConstOrMutable > & other)
default

Copy constructor (default).

Parameters
otherThe iterator to assign from.

◆ TForwardIterator() [3/5]

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator ( const TMutable & mutableIt)

Copy constructor accepting a mutable iterator. Available only for the constant version of this iterator.

Template Parameters
TMutableThe type of this constructor's argument.
Parameters
mutableItMutable iterator to copy from.

◆ TForwardIterator() [4/5]

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator ( Entry * pEntry,
LRUCacheTable * pTable,
integer pListIdx )
inlineexplicit

Constructor that explicitly sets a valid iterator.

Parameters
pEntryPointer to a valid element.
pTableThe cache table we belong to.
pListIdxThe index of the list that pEntry belongs to.

Definition at line 264 of file lrucachetable.hpp.

◆ TForwardIterator() [5/5]

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator ( LRUCacheTable * pTable,
integer pListIdx )
inlineexplicit

Constructor.

Parameters
pTableThe cache table we belong to.
pListIdxThe index of the list to start with.

Definition at line 274 of file lrucachetable.hpp.

Here is the call graph for this function:

Method Details:

◆ Construct()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
template<typename... TArgs>
TConstOrMutable & Construct ( TArgs &&... args) const
inline

Helper method that performs a placement-new on the data this iterator refers to. This method can be used if method Try indicates a cache miss.

Template Parameters
TArgsTypes of variadic parameters given with parameter args.
Parameters
argsVariadic parameters to be forwarded to the constructor of the inserted instance of type StoredType.
Returns
A reference to the just constructed object.

Definition at line 365 of file lrucachetable.hpp.

◆ Key()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
const KeyType & Key ( ) const
inline

Retrieves the key-portion of the stored object that this iterator references.

Returns
A reference to the key-portion of the stored object.

Definition at line 381 of file lrucachetable.hpp.

◆ Mapped()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
MappedType & Mapped ( ) const
inline

Retrieves the stored object that this iterator references.
This method is an alias to operator*

Returns
A reference to the mapped-portion of the stored object.

Definition at line 390 of file lrucachetable.hpp.

◆ operator!=()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
bool operator!= ( TForwardIterator< TConstOrMutable > other) const
inline

Comparison operator.

Parameters
otherThe iterator to compare ourselves to.
Returns
true if this and given iterator are not equal, false otherwise.

Definition at line 335 of file lrucachetable.hpp.

◆ operator*()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TConstOrMutable & operator* ( ) const
inline

Retrieves the stored object that this iterator references.

Returns
A reference to the stored object.

Definition at line 344 of file lrucachetable.hpp.

◆ operator++() [1/2]

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator & operator++ ( )
inline

Prefix increment operator.

Returns
A reference to this object.

Definition at line 302 of file lrucachetable.hpp.

Here is the call graph for this function:

◆ operator++() [2/2]

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator operator++ ( int )
inline

Postfix increment operator.

Returns
An iterator value that is not increased, yet.

Definition at line 316 of file lrucachetable.hpp.

Here is the call graph for this function:

◆ operator->()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TConstOrMutable * operator-> ( ) const
inline

Retrieves a pointer to the stored object that this iterator references.

Returns
A pointer to the stored object.

Definition at line 352 of file lrucachetable.hpp.

◆ operator=()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TForwardIterator & operator= ( const TForwardIterator< TConstOrMutable > & other)
default

Copy assignment (default).

Parameters
otherThe iterator to assign from.
Returns
A reference to this object.

◆ operator==()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
bool operator== ( TForwardIterator< TConstOrMutable > other) const
inline

Comparison operator.

Parameters
otherThe iterator to compare ourselves to.
Returns
true if this and the given iterator are pointing to the same entry, false otherwise.

Definition at line 327 of file lrucachetable.hpp.

◆ Value()

template<typename TAllocator , typename TValueDescriptor , typename THash = std::hash <typename TValueDescriptor::KeyType>, typename TEqual = std::equal_to<typename TValueDescriptor::KeyType>>
template<typename TConstOrMutable >
TConstOrMutable & Value ( ) const
inline

Retrieves the stored object that this iterator references.

Returns
A reference to the stored object.

Definition at line 373 of file lrucachetable.hpp.


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