Timer class that invokes a callback on a specified interval. More...
#include <timer.h>
Public Member Functions | |
Construction | |
Timer () | |
Creates a timer object. More... | |
bool | is_repeating () const |
Returns true if the timer repeats until it is stopped. More... | |
unsigned int | get_timeout () const |
Returns the current timeout. In milliseconds. More... | |
Events | |
std::function< void()> & | func_expired () |
Callback invoked every time the timer interval occurs. More... | |
Operations | |
void | start (unsigned int timeout, bool repeat=true) |
Starts the timer. Timeout in milliseconds. More... | |
void | stop () |
Stop the timer. More... | |
Timer class that invokes a callback on a specified interval.
clan::Timer::Timer | ( | ) |
Creates a timer object.
std::function<void()>& clan::Timer::func_expired | ( | ) |
Callback invoked every time the timer interval occurs.
unsigned int clan::Timer::get_timeout | ( | ) | const |
Returns the current timeout. In milliseconds.
bool clan::Timer::is_repeating | ( | ) | const |
Returns true if the timer repeats until it is stopped.
void clan::Timer::start | ( | unsigned int | timeout, |
bool | repeat = true |
||
) |
Starts the timer. Timeout in milliseconds.
void clan::Timer::stop | ( | ) |
Stop the timer.