Chromium Code Reviews| Index: components/rappor/rappor.h |
| diff --git a/components/rappor/rappor.h b/components/rappor/rappor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..531f9b8d1e5975f7fea30bdaec2d86d6a4122e41 |
| --- /dev/null |
| +++ b/components/rappor/rappor.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright (c) 2012 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 COMPONENTS_RAPPOR_RAPPOR_H_ |
| +#define COMPONENTS_RAPPOR_RAPPOR_H_ |
| + |
| +#include <assert.h> |
| +#include <limits.h> |
| +#include <math.h> |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "components/rappor/bloom_filter.h" |
| + |
| +// A Rappor is an object for collecting privacy preserving randomized reports. |
| +// Samples are added to named metrics through the use of the RAPPOR_SAMPLE |
| +// macro. Samples can be either individual strings, or a vector of strings. |
| + |
| +namespace rappor { |
| + |
| +class Rappor { |
| + public: |
| + Rappor(const std::string& name, |
| + const uint32_t bytes_size, |
| + const uint32_t hash_count, |
| + const int fake_prob_index, |
| + const int fake_one_prob_index, |
| + const int one_honesty_prob_index, |
| + const int zero_honesty_prob_index); |
| + |
| + void AddSamples(const std::vector<std::string>& strings); |
| + |
| + void AddSample(const std::string& str); |
| + |
| + const ByteVector& GetBytes() const; |
| + |
| + const std::string& rappor_name() const; |
| + |
| + int fake_prob_index() const { return fake_prob_index_; } |
| + |
| + int fake_one_prob_index() const { return fake_one_prob_index_; } |
| + |
| + int one_honesty_prob_index() const { return one_honesty_prob_index_; } |
| + |
| + int zero_honesty_prob_index() const { return zero_honesty_prob_index_; } |
| + |
| + private: |
| + const std::string rappor_name_; |
| + BloomFilter bloom_; |
| + |
| + const int fake_prob_index_; |
| + const int fake_one_prob_index_; |
| + const int one_honesty_prob_index_; |
| + const int zero_honesty_prob_index_; |
|
jwd
2013/12/17 23:00:25
This needs to be documented more.
Steven Holte
2013/12/18 02:06:12
Extracted to RapporParameters, and added comments.
|
| +}; |
| + |
| +} // namespace rappor |
| + |
| +#endif // COMPONENTS_RAPPOR_RAPPOR_H_ |