From c5fbe764a6314d9b7cf0511d8ef090dfb7c96893 Mon Sep 17 00:00:00 2001 From: mandlm Date: Mon, 16 Nov 2015 17:27:42 +0100 Subject: [PATCH] Limited ErrorPlotter buffer size --- gui/NeuroUI/errorplotter.cpp | 5 +++++ gui/NeuroUI/errorplotter.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gui/NeuroUI/errorplotter.cpp b/gui/NeuroUI/errorplotter.cpp index 4e6f0b3..0bd05ed 100644 --- a/gui/NeuroUI/errorplotter.cpp +++ b/gui/NeuroUI/errorplotter.cpp @@ -28,6 +28,11 @@ void ErrorPlotter::clear() void ErrorPlotter::addErrorValue(double errorValue) { + if (m_errorValues.size() == m_bufferSize) + { + m_errorValues.pop_front(); + } + m_errorValues.push_back(errorValue); m_maxErrorValue = std::max(m_maxErrorValue, errorValue); diff --git a/gui/NeuroUI/errorplotter.h b/gui/NeuroUI/errorplotter.h index 47c5093..ac4488f 100644 --- a/gui/NeuroUI/errorplotter.h +++ b/gui/NeuroUI/errorplotter.h @@ -11,6 +11,8 @@ private: std::list m_errorValues; double m_maxErrorValue; + size_t m_bufferSize = 10000; + public: explicit ErrorPlotter(QWidget *parent = 0);