summaryrefslogtreecommitdiff
path: root/utils/perfect_hash.cc
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2015-04-02 00:50:04 -0400
committerChris Dyer <redpony@gmail.com>2015-04-02 00:50:04 -0400
commit5ee02ce1602f2fce6d5af5db93c2278fe6c9ede5 (patch)
tree7ebad8dd99e38d190c579f425c3eb959363e96e5 /utils/perfect_hash.cc
parente7d77de8a9b9929b22fc6562f88f3668900f9662 (diff)
parent737ed7a7f932b1a7e40d2755bcdee6bc0aa2de63 (diff)
Merge pull request #70 from redpony/cmake
Cmake
Diffstat (limited to 'utils/perfect_hash.cc')
-rw-r--r--utils/perfect_hash.cc37
1 files changed, 0 insertions, 37 deletions
diff --git a/utils/perfect_hash.cc b/utils/perfect_hash.cc
deleted file mode 100644
index 706e2741..00000000
--- a/utils/perfect_hash.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "config.h"
-
-#ifdef HAVE_CMPH
-
-#include "perfect_hash.h"
-
-#include <cstdio>
-#include <iostream>
-
-using namespace std;
-
-PerfectHashFunction::~PerfectHashFunction() {
- cmph_destroy(mphf_);
-}
-
-PerfectHashFunction::PerfectHashFunction(const string& fname) {
- FILE* f = fopen(fname.c_str(), "r");
- if (!f) {
- cerr << "Failed to open file " << fname << " for reading: cannot load hash function.\n";
- abort();
- }
- mphf_ = cmph_load(f);
- if (!mphf_) {
- cerr << "cmph_load failed on " << fname << "!\n";
- abort();
- }
-}
-
-size_t PerfectHashFunction::operator()(const string& key) const {
- return cmph_search(mphf_, &key[0], key.size());
-}
-
-size_t PerfectHashFunction::number_of_keys() const {
- return cmph_size(mphf_);
-}
-
-#endif