summaryrefslogtreecommitdiff
path: root/utils/perfect_hash.h
blob: 8ac11f187550da33a92d78fb9795fb61dfb31266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef _PERFECT_HASH_MAP_H_
#define _PERFECT_HASH_MAP_H_

#include "config.h"

#ifndef HAVE_CMPH
#error libcmph is required to use PerfectHashFunction
#endif

#include <vector>
#include <boost/utility.hpp>
#include "cmph.h"

class PerfectHashFunction : boost::noncopyable {
 public:
  explicit PerfectHashFunction(const std::string& fname);
  ~PerfectHashFunction();
  size_t operator()(const std::string& key) const;
  size_t number_of_keys() const;
 private:
  cmph_t *mphf_;
};

#endif