ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Methods | Private Fields | Private Methods | List of all members
HashTable< T, TStored, TKey, TIfMapped, THash, TEqual, TAccess, THashCaching, TRecycling >::ElementHandle Class Reference

#include <hashtable.hpp>

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

Class Description

template<typename T, typename TStored, typename TKey, typename TIfMapped, typename THash, typename TEqual, typename TAccess, Caching THashCaching = Caching::Auto, typename TRecycling = Recycling::Private>
class aworx::lib::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 propper re-insertion.

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

Definition at line 523 of file hashtable.hpp.

Public Methods

 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
 

Private Fields

Elementelement
 The extracted element.
 
HashTabletable
 The table we belong to.
 

Private Methods

 ElementHandle (HashTable *pTable, Element *pElement)
 

Constructor & Destructor Documentation

◆ ElementHandle() [1/4]

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]

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]

ElementHandle ( )
inline

Default constructor creating and empty handle.

Definition at line 556 of file hashtable.hpp.

◆ ElementHandle() [4/4]

ElementHandle ( ElementHandle other)
delete

Deleted copy constructor.

◆ ~ElementHandle()

~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.

Member Function Documentation

◆ IsEmpty()

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()

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()

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]

ElementHandle& operator= ( const ElementHandle other)
delete

Deleted copy assignment operator.

◆ operator=() [2/2]

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()

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: