/*
- Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#define DCPOMATIC_EVENT_HISTORY_H
#include <boost/thread/mutex.hpp>
+#include <boost/optional.hpp>
#include <list>
class EventHistory
public:
explicit EventHistory (int size);
- float rate () const;
- void event ();
+ boost::optional<float> rate () const;
+ void event (int count = 1);
private:
/** Mutex for _history */
/** 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 */
+ std::list<std::pair<struct timeval, int> > _history;
+ /** Maximum size of _history */
int const _size;
};