gatb.core-API-0.0.0
|
hash table implementation More...
#include <MapMPHF.hpp>
Public Types | |
typedef BooPHF< Key, Adaptator > | Hash |
Public Member Functions | |
MapMPHF () | |
void | build (tools::collections::Iterable< Key > &keys, int nbThreads=1, tools::dp::IteratorListener *progress=0) |
size_t | save (tools::storage::impl::Group &group, const std::string &name) |
void | load (tools::storage::impl::Group &group, const std::string &name) |
Value & | operator[] (const Key &key) |
Value & | at (typename Hash::Code code) |
Hash::Code | getCode (const Key &key) |
size_t | size () const |
Public Member Functions inherited from SmartPointer | |
void | use () |
void | forget () |
Public Member Functions inherited from ISmartPointer | |
virtual | ~ISmartPointer () |
Additional Inherited Members | |
Protected Member Functions inherited from SmartPointer | |
SmartPointer () | |
virtual | ~SmartPointer () |
hash table implementation
This hash table implementation uses a minimal perfect hash function (MPHF) for identifying the keys with a unique number in [0..N-1] where N is the number of items.
Using BooPHF, the memory usage is about 3-4 bits per key.
The values can be stored in a simple vector. The keys are not stored in memory, only the mphf is needed.
Note that such an implementation can't afford to add items into the map (it's static).
|
inline |
Default constructor.
|
inline |
Get the value for a given index
[in] | code | : the key |
|
inline |
Build the hash function from a set of items.
[in] | keys | : iterable over the keys of the hash table |
[in] | progress | : listener called during the building of the MPHF |
|
inline |
Get the hash code of the given key.
|
inline |
Load hash function from a Group
[in] | group | : group where to load the MPHF from |
[in] | name | : name of the MPHF |
|
inline |
Get the value for a given key
[in] | key | : the key |
|
inline |
Save the hash function into a Group object.
[out] | group | : group where to save the MPHF |
[in] | name | : name of the saved MPHF |
|
inline |
Get the number of keys.