Sux
|
#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) |
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.
LEAF_SIZE | the size of a leaf; typicals value range from 6 to 8 for fast, small maps, or up to 16 for very compact functions. |
AT | a type of memory allocation out of sux::util::AllocType. |
|
inline |
|
inline |
Builds a RecSplit instance using a given list of keys and bucket size.
Warning: duplicate keys will cause this method to never return.
keys | a vector of strings. |
bucket_size | the desired bucket size; typical sizes go from 100 to 2000, with smaller buckets giving slightly larger but faster functions. |
|
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.
keys | a vector of 128-bit hashes. |
bucket_size | the desired bucket size; typical sizes go from 100 to 2000, with smaller buckets giving slightly larger but faster functions. |
|
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.
input | an open input stream returning a list of keys, one per line. |
bucket_size | the desired bucket size. |
|
inline |
Returns the value associated with the given 128-bit hash.
Note that this method is mainly useful for benchmarking.
hash | a 128-bit hash. |
|
inline |
Returns the value associated with the given key.
key | a key. |
|
inline |
Returns the number of keys used to build this RecSplit instance.
|
friend |
|
friend |