23 std::chrono::system_clock::duration upDateTime) :
24 stepSize(static_cast<uint64_t>(observTime / upDateTime)), firstTime(true)
28 throw std::runtime_error(
29 "stepsize is 0 -- not allowed: observTime: " +
std::to_string(observTime.count()) +
32 this->recordContainer.resize(stepSize);
35 explicit recordValue(uint64_t stepSize_) : stepSize(stepSize_), firstTime(true)
39 throw std::runtime_error(
"stepsize is 0 -- not allowed!");
41 this->recordContainer.resize(stepSize);
49 this->recordContainer.push_back(rec);
52 std::fill(this->recordContainer.begin(), this->recordContainer.end(), rec);
53 this->firstTime =
false;
55 if (this->recordContainer.size() >= this->stepSize)
57 this->recordContainer.erase(this->recordContainer.begin());
64 return static_cast<T>(
65 *std::min_element(this->recordContainer.begin(), this->recordContainer.end()));
71 return static_cast<T>(
72 *std::max_element(this->recordContainer.begin(), this->recordContainer.end()));
78 return static_cast<T>(
79 std::accumulate(this->recordContainer.begin(), this->recordContainer.end(), 0.0) /
86 return recordContainer;
92 std::vector<T> recordContainer;