2012-05-23 14:56:01 +01:00
|
|
|
#ifndef HORUS_HISTOGRAM_H
|
|
|
|
#define HORUS_HISTOGRAM_H
|
|
|
|
|
|
|
|
#include <vector>
|
2012-12-27 12:54:58 +00:00
|
|
|
|
2012-05-23 14:56:01 +01:00
|
|
|
#include <ostream>
|
|
|
|
|
2012-12-27 22:25:45 +00:00
|
|
|
#include "Horus.h"
|
|
|
|
|
2012-05-23 14:56:01 +01:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
typedef vector<unsigned> Histogram;
|
|
|
|
|
|
|
|
class HistogramSet
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
HistogramSet (unsigned, unsigned);
|
2012-12-17 18:39:42 +00:00
|
|
|
|
2012-05-23 14:56:01 +01:00
|
|
|
void nextHistogram (void);
|
|
|
|
|
2012-05-24 22:55:20 +01:00
|
|
|
unsigned operator[] (size_t idx) const;
|
2012-12-17 18:39:42 +00:00
|
|
|
|
2012-05-23 14:56:01 +01:00
|
|
|
unsigned nrHistograms (void) const;
|
|
|
|
|
|
|
|
void reset (void);
|
|
|
|
|
2012-12-27 22:29:20 +00:00
|
|
|
static vector<Histogram> getHistograms (unsigned, unsigned);
|
2012-12-17 18:39:42 +00:00
|
|
|
|
2012-05-23 14:56:01 +01:00
|
|
|
static unsigned nrHistograms (unsigned, unsigned);
|
|
|
|
|
2012-05-24 22:55:20 +01:00
|
|
|
static size_t findIndex (
|
2012-05-23 14:56:01 +01:00
|
|
|
const Histogram&, const vector<Histogram>&);
|
|
|
|
|
|
|
|
static vector<double> getNumAssigns (unsigned, unsigned);
|
|
|
|
|
|
|
|
friend std::ostream& operator<< (ostream &os, const HistogramSet& hs);
|
2012-12-17 18:39:42 +00:00
|
|
|
|
2012-05-23 14:56:01 +01:00
|
|
|
private:
|
2012-05-24 22:55:20 +01:00
|
|
|
unsigned maxCount (size_t) const;
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-05-24 22:55:20 +01:00
|
|
|
void clearAfter (size_t);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-17 18:39:42 +00:00
|
|
|
unsigned size_;
|
|
|
|
Histogram hist_;
|
2012-12-27 22:25:45 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN (HistogramSet);
|
2012-05-23 14:56:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // HORUS_HISTOGRAM_H
|
|
|
|
|