Limited ErrorPlotter buffer size

This commit is contained in:
mandlm 2015-11-16 17:27:42 +01:00
parent 0f7c617f9c
commit c5fbe764a6
2 changed files with 7 additions and 0 deletions

View file

@ -28,6 +28,11 @@ void ErrorPlotter::clear()
void ErrorPlotter::addErrorValue(double errorValue) void ErrorPlotter::addErrorValue(double errorValue)
{ {
if (m_errorValues.size() == m_bufferSize)
{
m_errorValues.pop_front();
}
m_errorValues.push_back(errorValue); m_errorValues.push_back(errorValue);
m_maxErrorValue = std::max<double>(m_maxErrorValue, errorValue); m_maxErrorValue = std::max<double>(m_maxErrorValue, errorValue);

View file

@ -11,6 +11,8 @@ private:
std::list<double> m_errorValues; std::list<double> m_errorValues;
double m_maxErrorValue; double m_maxErrorValue;
size_t m_bufferSize = 10000;
public: public:
explicit ErrorPlotter(QWidget *parent = 0); explicit ErrorPlotter(QWidget *parent = 0);