TdZdd  1.1
A top-down/breadth-first decision diagram manipulation framework
Public Member Functions | List of all members
tdzdd::MyHashMap< K, V, Hash, Equal > Struct Template Reference

Closed hash map implementation. More...

#include <MyHashTable.hpp>

Collaboration diagram for tdzdd::MyHashMap< K, V, Hash, Equal >:
Collaboration graph
[legend]

Public Member Functions

 MyHashMap (Hash const &hash=Hash(), Equal const &equal=Equal())
 Default constructor.
 
 MyHashMap (size_t n, Hash const &hash=Hash(), Equal const &equal=Equal())
 Constructor. More...
 
 MyHashMap (MyHashMap const &o, size_t n=1)
 Copy constructor. More...
 
V & operator[] (K const &key)
 Move constructor. More...
 
V * getValue (K const &key) const
 Get the value that is already registered. More...
 
- Public Member Functions inherited from tdzdd::MyHashTable< MyHashMapEntry< K, V >, MyHashMapHashWrapper< K, V, Hash, Equal >, MyHashMapHashWrapper< K, V, Hash, Equal > >
 MyHashTable (MyHashMapHashWrapper< K, V, Hash, Equal > const &hash=MyHashMapHashWrapper< K, V, Hash, Equal >(), MyHashMapHashWrapper< K, V, Hash, Equal > const &equal=MyHashMapHashWrapper< K, V, Hash, Equal >())
 Default constructor.
 
 MyHashTable (size_t n, MyHashMapHashWrapper< K, V, Hash, Equal > const &hash=MyHashMapHashWrapper< K, V, Hash, Equal >(), MyHashMapHashWrapper< K, V, Hash, Equal > const &equal=MyHashMapHashWrapper< K, V, Hash, Equal >())
 Constructor. More...
 
 MyHashTable (MyHashTable const &o, size_t n=1)
 Copy constructor. More...
 
void moveAssign (MyHashTable &o)
 Move constructor. More...
 
void clear ()
 Initialize the table to be empty. More...
 
void initialize (size_t n)
 Initialize the table to be empty. More...
 
void rehash (size_t n=1)
 Resize the storage appropriately. More...
 
Entryadd (Entry const &elem)
 Insert an element if no other equivalent element is registered. More...
 
Entryget (Entry const &elem) const
 Get the element that is already registered. More...
 

Additional Inherited Members

- Protected Attributes inherited from tdzdd::MyHashTable< MyHashMapEntry< K, V >, MyHashMapHashWrapper< K, V, Hash, Equal >, MyHashMapHashWrapper< K, V, Hash, Equal > >
MyHashMapHashWrapper< K, V, Hash, Equal > const hashFunc
 Functor for getting hash codes.
 
MyHashMapHashWrapper< K, V, Hash, Equal > const eqFunc
 Functor for checking equivalence.
 
size_t tableCapacity_
 Size of the hash table storage.
 
size_t tableSize_
 Size of the hash table.
 
size_t maxSize_
 The maximum number of elements.
 
size_t size_
 The number of elements.
 
Entrytable
 Pointer to the storage.
 

Detailed Description

template<typename K, typename V, typename Hash = MyHashDefault<K>, typename Equal = MyHashDefault<K>>
struct tdzdd::MyHashMap< K, V, Hash, Equal >

Closed hash map implementation.

An entry for the default key K() cannot be added in the map.

Parameters
Ktype of keys.
Vtype of values.

Definition at line 554 of file MyHashTable.hpp.

Constructor & Destructor Documentation

◆ MyHashMap() [1/2]

template<typename K, typename V, typename Hash = MyHashDefault<K>, typename Equal = MyHashDefault<K>>
tdzdd::MyHashMap< K, V, Hash, Equal >::MyHashMap ( size_t  n,
Hash const &  hash = Hash(),
Equal const &  equal = Equal() 
)
inline

Constructor.

Parameters
ninitial table size.
hashhash function.
equalequality function.

Definition at line 575 of file MyHashTable.hpp.

◆ MyHashMap() [2/2]

template<typename K, typename V, typename Hash = MyHashDefault<K>, typename Equal = MyHashDefault<K>>
tdzdd::MyHashMap< K, V, Hash, Equal >::MyHashMap ( MyHashMap< K, V, Hash, Equal > const &  o,
size_t  n = 1 
)
inline

Copy constructor.

Parameters
othe object to be copied.
nlower bound of initial table size.

Definition at line 585 of file MyHashTable.hpp.

Member Function Documentation

◆ getValue()

template<typename K, typename V, typename Hash = MyHashDefault<K>, typename Equal = MyHashDefault<K>>
V* tdzdd::MyHashMap< K, V, Hash, Equal >::getValue ( K const &  key) const
inline

Get the value that is already registered.

Parameters
keythe key to be searched.
Returns
pointer to the value in the map or null.

Definition at line 611 of file MyHashTable.hpp.

References tdzdd::MyHashMapEntry< K, V >::value.

Referenced by tdzdd::DdStructure< ARITY >::operator==().

◆ operator[]()

template<typename K, typename V, typename Hash = MyHashDefault<K>, typename Equal = MyHashDefault<K>>
V& tdzdd::MyHashMap< K, V, Hash, Equal >::operator[] ( K const &  key)
inline

Move constructor.

Parameters
othe object to be moved.
nlower bound of initial table size. Insert an element if no other equivalent key is registered.
keykey of the element to be inserted.
Returns
reference to the value in the table.

Definition at line 602 of file MyHashTable.hpp.


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