OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_RAPPOR_BLOOM_FILTER_H_ | |
6 #define COMPONENTS_RAPPOR_BLOOM_FILTER_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <string> | |
11 #include <vector> | |
12 | |
13 #include "components/rappor/bytevector.h" | |
14 | |
15 namespace rappor { | |
16 | |
17 // BloomFilter is a simple bloom filter for keeping track of a set of strings. | |
18 class BloomFilter { | |
19 public: | |
20 BloomFilter(uint32_t bytes_size, uint32_t hash_count); | |
Alexei Svitkine (slow)
2013/12/19 19:47:02
Nit: Add explicit ~BloomFilter() declaration here
Steven Holte
2013/12/20 03:03:55
Done.
| |
21 void AddString(const std::string& str); | |
22 void AddStrings(const std::vector<std::string>& strings); | |
23 | |
24 // Returns the current value of the bloom filter's bit array. | |
25 const ByteVector& bytes() const; | |
26 // Returns the number of bits set for each string added to the filter. | |
27 uint32_t hash_count() const; | |
28 | |
29 private: | |
30 // Stores the bit array of the bloom filter. | |
31 ByteVector bytes_; | |
32 // The number of bits to set for each string added. | |
33 uint32_t hash_count_; | |
34 }; | |
Alexei Svitkine (slow)
2013/12/19 19:47:02
Nit: DISALLOW_COPY_AND_ASSIGN(BloomFilter);
Steven Holte
2013/12/20 03:03:55
Done.
| |
35 | |
36 } // namespace rappor | |
37 | |
38 #endif // COMPONENTS_RAPPOR_BLOOM_FILTER_H_ | |
OLD | NEW |