Created
July 13, 2013 00:15
-
-
Save garethlewin/5988789 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class values_t> | |
class DurationBasedStatsContainer | |
{ | |
public: | |
typedef std::list<std::pair<std::chrono::high_resolution_clock::time_point, typename values_t>> valueList_t; | |
typedef std::chrono::milliseconds freq_t; | |
DurationBasedStatsContainer(freq_t maxDuration); | |
void push(values_t&& value); | |
values_t max(); | |
values_t min(); | |
values_t average(); | |
valueList_t::iterator begin() { return mValues.begin(); } | |
valueList_t::iterator end() { return mValues.end(); } | |
valueList_t::iterator cbegin() const { return mValues.cbegin(); } | |
valueList_t::iterator cend() const { return mValues.cend(); } | |
private: | |
freq_t mMaxDuration; | |
valueList_t mValues; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment