Aleph-w  1.9
General library for algorithms and data structures
Aleph::LhashTableVtl< Key, Cmp > Struct Template Reference

#include <tpl_lhash.H>

+ Inheritance diagram for Aleph::LhashTableVtl< Key, Cmp >:
+ Collaboration diagram for Aleph::LhashTableVtl< Key, Cmp >:

Public Types

using Base = GenLhashTable< Key, LhashBucketVtl< Key >, Cmp >
 
using Bucket = LhashBucketVtl< Key >
 
using Hash_Fct = std::function< size_t(const Key &)>
 
using Hash_Fct_Ptr = size_t(*)(const Key &)
 
using Key_Type = Key
 
using Item_Type = Key
 

Public Member Functions

Cmp & get_compare ()
 
const Cmp & get_compare () const
 
void swap (GenLhashTable &other) noexcept
 
void empty () noexcept
 Vacía la tabla hash; libera memoria de todas las cubetas.
 
Hash_Fct get_hash_fct () const noexcept
 
void set_hash_fct (Hash_Fct fct) noexcept
 Set the internal hash function.
 
void set_hash_fct (Hash_Fct_Ptr fct) noexcept
 
float current_alpha () const noexcept
 return the current table load
 
Bucketinsert (Bucket *bucket)
 
Bucketsearch_or_insert (Bucket *bucket)
 
Bucketsearch (const Key &key) const noexcept
 
Bucketremove (Bucket *bucket) noexcept
 
size_t resize (size_t new_size)
 
Bucketsearch_next (Bucket *bucket) const noexcept
 
const size_t & capacity () const noexcept
 Retorna el tamaño de la tabla.
 
const size_t & size () const noexcept
 Retorna el número de elementos que contiene la tabla.
 
const size_t & get_num_busy_slots () const noexcept
 Retorna la cantidad de entradas del arreglo que están ocupadas.
 
bool is_empty () const noexcept
 
Stats stats () const
 
void print_stats (const Stats &stats) const
 
void set_upper_alpha (const float &__upper_alpha)
 
void set_lower_alpha (const float &__lower_alpha)
 
float get_lower_alpha () const noexcept
 
float get_upper_alpha () const noexcept
 

Protected Attributes

Hash_Fct hash_fct
 
size_t len
 
Cmp cmp
 
float lower_alpha
 
float upper_alpha
 

Detailed Description

template<typename Key, class Cmp = Aleph::equal_to<Key>>
struct Aleph::LhashTableVtl< Key, Cmp >

Tabla hash genérica con resolución de colisiones por encadenamiento separado y cubetas con destructor virtual.

El tipo LhashTableVtl implanta una tabla hash genérica con resolución de colisiones por encadenamiento separado en la cual las cubetas no tienen destructor virtual.

Parameters
Keyclave de indización de la tabla.
Cmpclase de comparación entre las claves; debe retornar true si las claves son iguales.
See also
GenLhashTable LhashTable

Member Function Documentation

◆ insert()

Bucket* Aleph::GenLhashTable< Key, LhashBucketVtl< Key > , Cmp >::insert ( Bucket bucket)
inlineinherited

Inserta en la tabla la cubeta bucket y retorna su dirección si la clave no está en la tabla; de lo contrario se retorna nullptr

◆ remove()

Bucket* Aleph::GenLhashTable< Key, LhashBucketVtl< Key > , Cmp >::remove ( Bucket bucket)
inlinenoexceptinherited

Elimina de la tabla la cubeta bucket. Retorna la dirección de la cubeta. ATENCIÓN: no se verifica que la cubeta pertenezca a la tabla.

◆ resize()

size_t Aleph::GenLhashTable< Key, LhashBucketVtl< Key > , Cmp >::resize ( size_t  new_size)
inlineinherited

Reajusta la dimensión de la tabla hash al valor new_size y reubica las claves. Dispara bad_alloc si no hay suficiente memoria para reubicar el arreglo.

◆ search()

Bucket* Aleph::GenLhashTable< Key, LhashBucketVtl< Key > , Cmp >::search ( const Key &  key) const
inlinenoexceptinherited

Busca en la tabla una cubeta con la clave key. Retorna un puntero a la cubeta si se encuentra; nullptr de lo contrario.

◆ search_next()

Bucket* Aleph::GenLhashTable< Key, LhashBucketVtl< Key > , Cmp >::search_next ( Bucket bucket) const
inlinenoexceptinherited

retorna la próxima cubeta que colisiona con bucket. Si no existe, entonces se retorna nullptr.


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

Leandro Rabindranath León