//------------------------------------------------------------------------------ // Author: Vitali Adamenka // Description: Header for UserGUI // Copyright (c) 2015 EPAM Systems. All Rights Reserved. //------------------------------------------------------------------------------ /* This file is part of Nfstrace. Nfstrace is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License. Nfstrace is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Nfstrace. If not, see . */ //------------------------------------------------------------------------------ #ifndef USERGUI_H #define USERGUI_H //------------------------------------------------------------------------------ #include #include #include #include #include #include #include "protocols/abstract_protocol.h" //------------------------------------------------------------------------------ class UserGUI { public: using ProtocolStatistic = std::vector; using StatisticsContainers = std::unordered_map; UserGUI() = delete; UserGUI(const char*, std::vector&); ~UserGUI(); /*! Update Protocol's data. */ void update(AbstractProtocol*, std::vector&); /*! Enable screen full update. Use for resize main window. */ void enableUpdate(); private: void run(); timeval getTimeval() const; unsigned long _refresh_delta; // in microseconds std::atomic _shouldResize; std::mutex _statisticsDeltaMutex; std::atomic_flag _running; StatisticsContainers _statisticsContainers; AbstractProtocol* _activeProtocol; std::thread _guiThread; std::vector _allProtocols; }; //------------------------------------------------------------------------------ #endif //USERGUI_H //------------------------------------------------------------------------------