diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-05-09 16:38:36 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-05-09 16:38:36 +0100 |
| commit | 6a11232620e0006f6a2b1e8d2b56e56d84229d5c (patch) | |
| tree | 5ea8d25d95aac54dbf7e45fa72c50215ff5fc437 /src/lib/event_history.h | |
| parent | 837a54744277a5252a1a69b0690305e9a669124d (diff) | |
Basic GUI for export.
Diffstat (limited to 'src/lib/event_history.h')
| -rw-r--r-- | src/lib/event_history.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/lib/event_history.h b/src/lib/event_history.h new file mode 100644 index 000000000..5b0f9a6a3 --- /dev/null +++ b/src/lib/event_history.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2017 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic 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; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include <boost/thread/mutex.hpp> +#include <list> + +class EventHistory +{ +public: + EventHistory (int size); + + float rate () const; + void event (); + +private: + /** Mutex for _history */ + mutable boost::mutex _mutex; + /** List of the times of the last _history_size events + first is the most recently completed. + */ + std::list<struct timeval> _history; + /** Number of events that we should keep history for */ + int const _size; +}; |
