| @@ -2,12 +2,11 @@ | |||
| // Copyright (C) 2006 - 2009 MicroNeil Research Corporation | |||
| // Class to capture a histogram of events using a <set> | |||
| #ifndef mn_histogram_included | |||
| #define mn_histogram_included | |||
| #pragma once | |||
| #include <set> | |||
| using namespace std; | |||
| namespace codedweller { | |||
| /** The Histogram class is managed set of HistogramRecords. | |||
| *** We play some naughty tricks with pointers to break the rules and | |||
| @@ -21,7 +20,7 @@ using namespace std; | |||
| class HistogramRecord { // A record to assocate a key and count. | |||
| public: | |||
| int Key; // Here is the key. | |||
| int Count; // Here is the count. | |||
| mutable int Count; // Here is the count. | |||
| HistogramRecord(const int NewKey) : // We must have a key to make one. | |||
| Key(NewKey), Count(0) {} // and a new one starts at count 0. | |||
| @@ -30,7 +29,7 @@ class HistogramRecord { | |||
| } | |||
| }; | |||
| class Histogram : public set<HistogramRecord> { // A Histogram is a set of HistogramRecords | |||
| class Histogram : public std::set<HistogramRecord> { // A Histogram is a set of HistogramRecords | |||
| private: // and a private hit counter... | |||
| int HitCount; | |||
| public: | |||
| @@ -56,5 +55,5 @@ class Histogram : public set<HistogramRecord> { | |||
| } | |||
| }; | |||
| #endif | |||
| } // End namespace codedweller | |||