Concrete timer that notifies listeners repeatedly at a set interval of time. More...
#include <timer.h>
Public Member Functions | |
template<typename Duration > | |
monotonous_timer (const Duration &interval) | |
virtual void | stop () |
Stop the timer. | |
virtual void | operator() () |
Implementation of timer::operator()(). | |
Public Member Functions inherited from flow::timer | |
virtual bool | stopped () const |
Returns true if the timer is stopped. | |
virtual size_t | listen (const std::function< void()> &listener) |
Adds a listener to this timer. | |
virtual void | ignore (const size_t token) |
Removes a previously added listener. | |
Additional Inherited Members | |
Protected Types inherited from flow::timer | |
typedef std::map< size_t, const std::function< void()> > | listeners_t |
Convenience typedef. | |
Protected Attributes inherited from flow::timer | |
listeners_t | d_listeners |
Listeners of this timer. | |
size_t | d_next_index |
The token tat maps to a listener. | |
std::mutex | d_listeners_m |
Mutex to protect modifications to d_listeners. | |
Concrete timer that notifies listeners repeatedly at a set interval of time.
|
inline |
interval | The time to wait between notifications. Must be a duration typedef from <chrono>. |