class utils::CallbackTimer
Overview
#include <CallbackTimer.h> class CallbackTimer { public: // construction CallbackTimer(); ~CallbackTimer(); // methods template <typename DurationType> void Start(DurationType interval, std::function<bool(void)> callback); void Stop(); bool IsRunning() const; };
Detailed Documentation
Construction
CallbackTimer()
Initialize without execution.
~CallbackTimer()
Stop execution on destruction.
Methods
template <typename DurationType> void Start(DurationType interval, std::function<bool(void)> callback)
Start the provided callback.
Runs each timer tick until it either returns false or the timer is stopped.
Parameters:
interval |
Timer interval of the type std::chrono::duration. Passed by value since it is a primitive. /params callback A callback function to be executed every tick. Returns bool to signal stopping. |
void Stop()
Manually stop execution.
bool IsRunning() const
Check whether there is a callback being executed.