diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2019-02-27 20:45:17 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2019-02-27 20:45:17 -0500 |
| commit | 2b152d09881559a0330b3ff923e03e715777c6c3 (patch) | |
| tree | 385a725709198f68bb24c9bc352ee70c804a038d /histogram.h | |
| download | aspartame-2b152d09881559a0330b3ff923e03e715777c6c3.tar.gz aspartame-2b152d09881559a0330b3ff923e03e715777c6c3.tar.bz2 aspartame-2b152d09881559a0330b3ff923e03e715777c6c3.zip | |
Initial commit (by Pink!)
Diffstat (limited to 'histogram.h')
| -rw-r--r-- | histogram.h | 20 |
1 files changed, 20 insertions, 0 deletions
| diff --git a/histogram.h b/histogram.h new file mode 100644 index 0000000..76d8f1b --- /dev/null +++ b/histogram.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef HISTOGRAM_H_24094D97 | ||
| 2 | #define HISTOGRAM_H_24094D97 | ||
| 3 | |||
| 4 | #include <map> | ||
| 5 | #include <string> | ||
| 6 | |||
| 7 | template <class T> | ||
| 8 | class histogram { | ||
| 9 | public: | ||
| 10 | void add(const T& inst); | ||
| 11 | void compile(); | ||
| 12 | const T& next() const; | ||
| 13 | void print() const; | ||
| 14 | |||
| 15 | private: | ||
| 16 | std::map<T, int> freqtable; | ||
| 17 | std::map<int, T> distribution; | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif /* end of include guard: HISTOGRAM_H_24094D97 */ | ||
