gatb.core-API-0.0.0
BooPHF< Key, Adaptator, Progress > Class Template Reference

Minimal Perfect Hash Function. More...

#include <BooPHF.hpp>

Inheritance diagram for BooPHF< Key, Adaptator, Progress >:
Inheritance graph

Public Types

typedef u_int64_t Code
 

Public Member Functions

 BooPHF ()
 
void build (tools::collections::Iterable< Key > *iterable, int nbThreads=1, tools::dp::IteratorListener *progress=0)
 
Code operator() (const Key &key)
 
size_t size () const
 
size_t load (tools::storage::impl::Group &group, const std::string &name)
 
size_t save (tools::storage::impl::Group &group, const std::string &name)
 
- 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 ()
 

Detailed Description

template<typename Key, typename Adaptator = AdaptatorDefault<Key>, class Progress = tools::misc::impl::ProgressNone>
class gatb::core::tools::collections::impl::BooPHF< Key, Adaptator, Progress >

Minimal Perfect Hash Function.

This is a specialization of the MPHF<Key,Adaptor,exist> class for exist=true. It uses BooPHF for the implementation and is most a wrapper between BooPHF and GATB-CORE concepts.Perfect minimal hash function for a given kind of key

This class provides an interface for getting hash codes for some key type T, which can be done through the operator() method

This class is not a classic hash feature because it hashes only a given set of T items (provided as a T iterator) through its 'build' method. Once building is done, hash code can be accessed through the operator()

We propose here a default implementation that doesn't do much. The idea behind is that we can specialize the class for the 'exist' template argument in order to provide a true implementation (through EMPHF library for instance). If such an implementation exists, the constant 'enabled' will be true, which allows to test it in the code (it is a little bit better than using compilation flag).

Member Typedef Documentation

typedef u_int64_t Code

Definition of a hash value.

Constructor & Destructor Documentation

BooPHF ( )
inline

Constructor.

Member Function Documentation

void build ( tools::collections::Iterable< Key > *  iterable,
int  nbThreads = 1,
tools::dp::IteratorListener progress = 0 
)
inline

Build the hash function from a set of items.

Parameters
[in]iterable: keys iterator
[in]progress: object that listens to the event of the algorithm
size_t load ( tools::storage::impl::Group group,
const std::string &  name 
)
inline

Load hash function from a collection

Code operator() ( const Key &  key)
inline

Returns the hash code for the given key. WARNING : default implementation here will throw an exception.

Parameters
[in]key: the key to be hashed
Returns
the hash value.
size_t save ( tools::storage::impl::Group group,
const std::string &  name 
)
inline

Save hash function to a collection

Returns
the number of bytes of the saved data.
size_t size ( ) const
inline

Returns the number of keys.

Returns
keys number

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