Index: components/rappor/bloom_filter.h |
diff --git a/components/rappor/bloom_filter.h b/components/rappor/bloom_filter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5386fa6f69290d75604f110540379f98983abd33 |
--- /dev/null |
+++ b/components/rappor/bloom_filter.h |
@@ -0,0 +1,33 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_RAPPOR_BLOOM_FILTER_H_ |
+#define CHROME_BROWSER_RAPPOR_BLOOM_FILTER_H_ |
+ |
+#include <stdint.h> |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "components/rappor/bytevector.h" |
+ |
+namespace rappor { |
+ |
+// BloomFilter is a simple bloom filter for keeping track of a set of strings. |
+class BloomFilter { |
+ public: |
+ BloomFilter(uint32_t bytes_size, uint32_t hash_count); |
+ void Add(const std::string& str); |
+ void Add(const std::vector<std::string>& strings); |
jwd
2013/12/16 17:04:03
Overloaded functions are usually frowned upon in c
Steven Holte
2013/12/16 23:02:16
Done.
|
+ const ByteVector& bytes() const; |
jwd
2013/12/16 17:04:03
Can you give a comment for this function and for h
Steven Holte
2013/12/16 23:02:16
Done.
|
+ uint32_t hash_count() const; |
+ |
+ private: |
+ ByteVector bytes_; |
+ uint32_t hash_count_; |
jwd
2013/12/16 17:04:03
Maybe a short comment here too.
Steven Holte
2013/12/16 23:02:16
Done.
|
+}; |
+ |
+} // namespace rappor |
+ |
+#endif // CHROME_BROWSER_RAPPOR_BLOOM_FILTER_H_ |