aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::HashTableBucket< Key, Val > Class Template Reference

A recipient for a pair of key value in a gum::HashTableList. More...

#include <agrum/base/core/hashTable.h>

Public Types

enum class  Emplace { EMPLACE }
 A dummy type for the emplace constructor. More...

Public Member Functions

 HashTableBucket ()
 Class constructor.
 HashTableBucket (const HashTableBucket< Key, Val > &from)
 Copy constructor.
 HashTableBucket (const Key &k, const Val &v)
 Constructor.
 HashTableBucket (Key &&k, Val &&v)
 Constructor.
 HashTableBucket (const std::pair< const Key, Val > &p)
 Constructor.
 HashTableBucket (std::pair< const Key, Val > &&p)
 Constructor.
template<typename... Args>
 HashTableBucket (Emplace e, Args &&... args)
 The emplace constructor.
 ~HashTableBucket ()
 Class destructor.
std::pair< const Key, Val > & elt ()
 Returns the pair stored in this bucket.
Key & key ()
 Returns the key part of the pair.
Val & val ()
 Returns the value part of the pair.

Public Attributes

std::pair< const Key, Val > pair
 The pair stored in this bucket.
HashTableBucket< Key, Val > * prev {nullptr}
 A pointer toward the previous bucket in the gum::HashTableList.
HashTableBucket< Key, Val > * next {nullptr}
 A pointer toward the next bucket in the gum::HashTableList.

Detailed Description

template<typename Key, typename Val>
class gum::HashTableBucket< Key, Val >

A recipient for a pair of key value in a gum::HashTableList.

In aGrUM, hashtables are vectors of chained lists. Each list corresponds to the pairs (key,val) the keys of which have the same hashed value. Each box of the list is called a bucket. Lists are doubly linked so as to enable efficient begin/end iterators and efficient insert/erase operations.

Template Parameters
KeyThe type for keys in a gum::HashTable.
ValThe type for values in a gum::HashTable.

Definition at line 215 of file hashTable.h.

Member Enumeration Documentation

◆ Emplace

template<typename Key, typename Val>
enum class gum::HashTableBucket::Emplace
strong

A dummy type for the emplace constructor.

This type is used to prevent the Bucket emplace (int,...) to compile.

Enumerator
EMPLACE 

Definition at line 229 of file hashTable.h.

229{ EMPLACE };

Constructor & Destructor Documentation

◆ HashTableBucket() [1/7]

template<typename Key, typename Val>
gum::HashTableBucket< Key, Val >::HashTableBucket ( )
inline

Class constructor.

Definition at line 234 of file hashTable.h.

234{}

Referenced by HashTableBucket().

Here is the caller graph for this function:

◆ HashTableBucket() [2/7]

template<typename Key, typename Val>
gum::HashTableBucket< Key, Val >::HashTableBucket ( const HashTableBucket< Key, Val > & from)
inline

Copy constructor.

Parameters
fromThe gum::HashTableBucket to copy.

Definition at line 240 of file hashTable.h.

240: pair{from.pair} {}
A recipient for a pair of key value in a gum::HashTableList.
Definition hashTable.h:215
std::pair< const Key, Val > pair
The pair stored in this bucket.
Definition hashTable.h:217

References HashTableBucket(), and pair.

Here is the call graph for this function:

◆ HashTableBucket() [3/7]

template<typename Key, typename Val>
gum::HashTableBucket< Key, Val >::HashTableBucket ( const Key & k,
const Val & v )
inline

Constructor.

Parameters
kThe key part of the pair.
vThe value part of the pair.

Definition at line 247 of file hashTable.h.

247: pair{k, v} {}

References pair.

◆ HashTableBucket() [4/7]

template<typename Key, typename Val>
gum::HashTableBucket< Key, Val >::HashTableBucket ( Key && k,
Val && v )
inline

Constructor.

Parameters
kThe key part of the pair.
vThe value part of the pair.

Definition at line 254 of file hashTable.h.

254: pair{std::move(k), std::move(v)} {}

References pair.

◆ HashTableBucket() [5/7]

template<typename Key, typename Val>
gum::HashTableBucket< Key, Val >::HashTableBucket ( const std::pair< const Key, Val > & p)
inline

Constructor.

Parameters
pThe pair to store.

Definition at line 260 of file hashTable.h.

260: pair(p) {}

References pair.

◆ HashTableBucket() [6/7]

template<typename Key, typename Val>
gum::HashTableBucket< Key, Val >::HashTableBucket ( std::pair< const Key, Val > && p)
inline

Constructor.

Parameters
pThe pair to store.

Definition at line 266 of file hashTable.h.

266: pair(std::move(p)) {}

References pair.

◆ HashTableBucket() [7/7]

template<typename Key, typename Val>
template<typename... Args>
gum::HashTableBucket< Key, Val >::HashTableBucket ( Emplace e,
Args &&... args )
inline

The emplace constructor.

Parameters
eThe emplace.
argsA construction list.
Template Parameters
argsThe types in the construction list.

Definition at line 275 of file hashTable.h.

275 :
276 // emplace (universal) constructor

References pair.

◆ ~HashTableBucket()

template<typename Key, typename Val>
gum::HashTableBucket< Key, Val >::~HashTableBucket ( )
inline

Class destructor.

Definition at line 282 of file hashTable.h.

282{}

Member Function Documentation

◆ elt()

template<typename Key, typename Val>
std::pair< const Key, Val > & gum::HashTableBucket< Key, Val >::elt ( )
inline

Returns the pair stored in this bucket.

Returns
Returns the pair stored in this bucket.

Definition at line 288 of file hashTable.h.

288{ return pair; }

References pair.

Referenced by gum::HashTableList< Key, Val >::at(), and gum::HashTableList< Key, Val >::at().

Here is the caller graph for this function:

◆ key()

template<typename Key, typename Val>
Key & gum::HashTableBucket< Key, Val >::key ( )
inline

Returns the key part of the pair.

Returns
Returns the key part of the pair.

Definition at line 294 of file hashTable.h.

294{ return const_cast< Key& >(pair.first); }

References pair.

Referenced by gum::HashTable< Key, Val >::_insert_(), gum::HashTable< Key, Val >::key(), and gum::HashTable< Key, Val >::resize().

Here is the caller graph for this function:

◆ val()

template<typename Key, typename Val>
Val & gum::HashTableBucket< Key, Val >::val ( )
inline

Returns the value part of the pair.

Returns
Returns value key part of the pair.

Definition at line 300 of file hashTable.h.

300{ return pair.second; }

References pair.

Referenced by gum::HashTable< Key, Val >::getWithDefault(), gum::HashTable< Key, Val >::getWithDefault(), and gum::HashTable< Key, Val >::set().

Here is the caller graph for this function:

Member Data Documentation

◆ next

◆ pair

template<typename Key, typename Val>
std::pair< const Key, Val > gum::HashTableBucket< Key, Val >::pair

The pair stored in this bucket.

Definition at line 217 of file hashTable.h.

Referenced by HashTableBucket(), HashTableBucket(), HashTableBucket(), HashTableBucket(), HashTableBucket(), HashTableBucket(), elt(), key(), and val().

◆ prev

template<typename Key, typename Val>
HashTableBucket< Key, Val >* gum::HashTableBucket< Key, Val >::prev {nullptr}

A pointer toward the previous bucket in the gum::HashTableList.

Definition at line 220 of file hashTable.h.

220{nullptr};

Referenced by gum::HashTableList< Key, Val >::erase().


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