libbf  0.1
 All Classes Functions Typedefs Friends Pages
hash.h
1 #ifndef BF_HASH_POLICY_H
2 #define BF_HASH_POLICY_H
3 
4 #include <functional>
5 #include <bf/h3.h>
6 #include <bf/object.h>
7 
8 namespace bf {
9 
11 typedef size_t digest;
12 
14 typedef std::function<digest(object const&)> hash_function;
15 
17 typedef std::function<std::vector<digest>(object const&)> hasher;
18 
20 {
21 public:
22  constexpr static size_t max_obj_size = 36;
23 
24  default_hash_function(size_t seed);
25 
26  size_t operator()(object const& o) const;
27 
28 private:
30 };
31 
34 {
35 public:
36  default_hasher(std::vector<hash_function> fns);
37 
38  std::vector<digest> operator()(object const& o) const;
39 
40 private:
41  std::vector<hash_function> fns_;
42 };
43 
47 {
48 public:
49  double_hasher(size_t k, hash_function h1, hash_function h2);
50 
51  std::vector<digest> operator()(object const& o) const;
52 
53 private:
54  size_t k_;
55  hash_function h1_;
56  hash_function h2_;
57 };
58 
72 hasher make_hasher(size_t k, size_t seed = 0, bool double_hashing = false);
73 
74 } // namespace bf
75 
76 #endif