123 this->dataPtr->sum += _val;
126 ++this->dataPtr->valIter;
127 if (this->dataPtr->valIter == this->dataPtr->valHistory.end())
130 this->dataPtr->valIter = this->dataPtr->valHistory.begin();
134 ++this->dataPtr->samples;
136 if (this->dataPtr->samples > this->dataPtr->valWindowSize)
139 this->dataPtr->sum -= (*this->dataPtr->valIter);
141 (*this->dataPtr->valIter) = _val;
143 --this->dataPtr->samples;
148 (*this->dataPtr->valIter) = _val;
156 this->dataPtr->valWindowSize = _n;
157 this->dataPtr->valHistory.clear();
158 this->dataPtr->valHistory.resize(this->dataPtr->valWindowSize);
159 this->dataPtr->valIter = this->dataPtr->valHistory.begin();
160 this->dataPtr->sum = T();
161 this->dataPtr->samples = 0;