ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
HashTable< T, TStored, TKey, TIfMapped, THash, TEqual, TAccess, THashCaching, TRecycling >::ElementHandle Class Reference

Description:

template<typename T, typename TStored, typename TKey, typename TIfMapped, typename THash, typename TEqual, typename TAccess, lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
class alib::monomem::HashTable< T, TStored, TKey, TIfMapped, THash, TEqual, TAccess, THashCaching, TRecycling >::ElementHandle

A value of this type is returned with methods Extract, which allows to remove an element from the hashtable, without deleting its allocated storage and destructing its custom value.

This handle allows write access to the value of an extracted element. In combination with methods Insert(ElementHandle&) and InsertIfNotExistent(ElementHandle&), this allows to change parts of the element value, including the key-portion with proper re-insertion.

Objects of this type can not be copied, but just moved.

Definition at line 523 of file hashtable.hpp.

#include <hashtable.hpp>

Collaboration diagram for HashTable< T, TStored, TKey, TIfMapped, THash, TEqual, TAccess, THashCaching, TRecycling >::ElementHandle:
[legend]

Public Method Index:

 ElementHandle ()
 
 ElementHandle (ElementHandle &&other)
 
 ElementHandle (ElementHandle &other)=delete
 
 ~ElementHandle ()
 
bool IsEmpty () const
 
KeyTypeKey () const
 
template<typename TEnableIf = TIfMapped>
 Mapped () const
 
ElementHandleoperator= (const ElementHandle &other)=delete
 
ElementHandleoperator= (ElementHandle &&other)
 
T & Value () const
 

Field Details:

◆ element

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
Element* element
private

The extracted element.

Definition at line 531 of file hashtable.hpp.

◆ table

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
HashTable* table
private

The table we belong to.

Definition at line 530 of file hashtable.hpp.

Constructor(s) / Destructor Details::

◆ ElementHandle() [1/4]

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
ElementHandle ( HashTable * pTable,
Element * pElement )
inlineprivate

Constructor setting fields table and element.

Parameters
pTableThe table we belong to.
pElementThe extracted element.

Definition at line 538 of file hashtable.hpp.

◆ ElementHandle() [2/4]

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
ElementHandle ( ElementHandle && other)
inline

Move constructor setting the moved object to emtpy.

Parameters
otherThe handle to move.

Definition at line 548 of file hashtable.hpp.

◆ ElementHandle() [3/4]

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
ElementHandle ( )
inline

Default constructor creating and empty handle.

Definition at line 556 of file hashtable.hpp.

◆ ElementHandle() [4/4]

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
ElementHandle ( ElementHandle & other)
delete

Deleted copy constructor.

◆ ~ElementHandle()

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
~ElementHandle ( )
inline

Destructor. If this handle is not empty, the allocated storage of the represented element is added to the list of recyclable objects.

Definition at line 589 of file hashtable.hpp.

Method Details:

◆ IsEmpty()

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
bool IsEmpty ( ) const
inline

Determines if this is a "valid" handle.

Returns
Returns true if this objects represents a valid element, false otherwise.

Definition at line 601 of file hashtable.hpp.

◆ Key()

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
KeyType & Key ( ) const
inline

Returns a mutable reference to the key-portion of this element's data. Must not be invoked on empty instances.

Returns
Returns a mutable reference to the key-portion of the represented element.

Definition at line 612 of file hashtable.hpp.

◆ Mapped()

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
template<typename TEnableIf = TIfMapped>
Mapped ( ) const
inline

Returns a mutable reference to the mapped-portion of this element's data. Must not be invoked on empty instances.

Availability
This method is only available with hash map mode.
Template Parameters
TEnableIfUsed to select this method if applicable. Do not specify.
Returns
Returns a mutable reference to the mapped object.

Definition at line 625 of file hashtable.hpp.

◆ operator=() [1/2]

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
ElementHandle & operator= ( const ElementHandle & other)
delete

Deleted copy assignment operator.

◆ operator=() [2/2]

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
ElementHandle & operator= ( ElementHandle && other)
inline

Move assignment. Disposes any current content, and moves other into this.

Parameters
otherThe handle to move into this object.
Returns
A reference to this.

Definition at line 571 of file hashtable.hpp.

◆ Value()

template<typename T , typename TStored , typename TKey , typename TIfMapped , typename THash , typename TEqual , typename TAccess , lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private>
T & Value ( ) const
inline

Returns a mutable reference to this element's data. Must not be invoked on empty instances.

Returns
Returns a mutable reference to value of the represented element.

Definition at line 606 of file hashtable.hpp.


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