Sux
Public Member Functions | Friends | List of all members
sux::function::RecSplit< LEAF_SIZE, AT > Class Template Reference

#include <RecSplit.hpp>

Public Member Functions

 RecSplit ()
 
 RecSplit (const vector< string > &keys, const size_t bucket_size)
 
 RecSplit (vector< hash128_t > &keys, const size_t bucket_size)
 
 RecSplit (ifstream &input, const size_t bucket_size)
 
size_t operator() (const hash128_t &hash)
 
size_t operator() (const string &key)
 
size_t size ()
 

Friends

ostream & operator<< (ostream &os, const RecSplit< LEAF_SIZE, AT > &rs)
 
istream & operator>> (istream &is, RecSplit< LEAF_SIZE, AT > &rs)
 

Detailed Description

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
class sux::function::RecSplit< LEAF_SIZE, AT >

A class for storing minimal perfect hash functions. The template parameter decides how large a leaf will be. Larger leaves imply slower construction, but less space and faster evaluation.

Template Parameters
LEAF_SIZEthe size of a leaf; typicals value range from 6 to 8 for fast, small maps, or up to 16 for very compact functions.
ATa type of memory allocation out of sux::util::AllocType.

Constructor & Destructor Documentation

◆ RecSplit() [1/4]

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
sux::function::RecSplit< LEAF_SIZE, AT >::RecSplit ( )
inline

◆ RecSplit() [2/4]

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
sux::function::RecSplit< LEAF_SIZE, AT >::RecSplit ( const vector< string > &  keys,
const size_t  bucket_size 
)
inline

Builds a RecSplit instance using a given list of keys and bucket size.

Warning: duplicate keys will cause this method to never return.

Parameters
keysa vector of strings.
bucket_sizethe desired bucket size; typical sizes go from 100 to 2000, with smaller buckets giving slightly larger but faster functions.

◆ RecSplit() [3/4]

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
sux::function::RecSplit< LEAF_SIZE, AT >::RecSplit ( vector< hash128_t > &  keys,
const size_t  bucket_size 
)
inline

Builds a RecSplit instance using a given list of 128-bit hashes and bucket size.

Warning: duplicate keys will cause this method to never return.

Note that this constructor is mainly useful for benchmarking.

Parameters
keysa vector of 128-bit hashes.
bucket_sizethe desired bucket size; typical sizes go from 100 to 2000, with smaller buckets giving slightly larger but faster functions.

◆ RecSplit() [4/4]

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
sux::function::RecSplit< LEAF_SIZE, AT >::RecSplit ( ifstream &  input,
const size_t  bucket_size 
)
inline

Builds a RecSplit instance using a list of keys returned by a stream and bucket size.

Warning: duplicate keys will cause this method to never return.

Parameters
inputan open input stream returning a list of keys, one per line.
bucket_sizethe desired bucket size.

Member Function Documentation

◆ operator()() [1/2]

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
size_t sux::function::RecSplit< LEAF_SIZE, AT >::operator() ( const hash128_t hash)
inline

Returns the value associated with the given 128-bit hash.

Note that this method is mainly useful for benchmarking.

Parameters
hasha 128-bit hash.
Returns
the associated value.
Here is the call graph for this function:

◆ operator()() [2/2]

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
size_t sux::function::RecSplit< LEAF_SIZE, AT >::operator() ( const string &  key)
inline

Returns the value associated with the given key.

Parameters
keya key.
Returns
the associated value.
Here is the call graph for this function:

◆ size()

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
size_t sux::function::RecSplit< LEAF_SIZE, AT >::size ( )
inline

Returns the number of keys used to build this RecSplit instance.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
ostream& operator<< ( ostream &  os,
const RecSplit< LEAF_SIZE, AT > &  rs 
)
friend

◆ operator>>

template<size_t LEAF_SIZE, util::AllocType AT = util::AllocType::MALLOC>
istream& operator>> ( istream &  is,
RecSplit< LEAF_SIZE, AT > &  rs 
)
friend

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