22 recordValue(std::chrono::system_clock::duration observTime, std::chrono::system_clock::duration upDateTime)
24 static_cast<uint64_t>(observTime / upDateTime)), firstTime(true) {
26 throw std::runtime_error(
"stepsize is 0 -- not allowed: observTime: "
31 this->recordContainer.resize(stepSize);
34 explicit recordValue(uint64_t stepSize_) : stepSize(stepSize_), firstTime(true) {
36 throw std::runtime_error(
"stepsize is 0 -- not allowed!");
38 this->recordContainer.resize(stepSize);
44 this->recordContainer.push_back(rec);
45 if (this->firstTime) {
46 std::fill(this->recordContainer.begin(), this->recordContainer.end(), rec);
47 this->firstTime =
false;
49 if (this->recordContainer.size() >= this->stepSize) {
50 this->recordContainer.erase(this->recordContainer.begin());
55 return static_cast<T>(*std::min_element(this->recordContainer.begin(), this->recordContainer.end()));
59 return static_cast<T>(*std::max_element(this->recordContainer.begin(), this->recordContainer.end()));
63 return static_cast<T>(std::accumulate(this->recordContainer.begin(), this->recordContainer.end(), 0.0) /
68 return recordContainer;
75 std::vector<T> recordContainer;