11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
18PROMEKI_NAMESPACE_BEGIN
45class PeriodicCallback {
48 using Function = promeki::Function<void()>;
51 PeriodicCallback() =
default;
58 PeriodicCallback(
double intervalSeconds, Function func);
79 void setInterval(
double seconds) { _intervalSeconds = seconds; }
82 double interval()
const {
return _intervalSeconds; }
85 void setCallback(Function func) { _func = std::move(func); }
88 bool isValid()
const {
return _func && _intervalSeconds > 0.0; }
92 double _intervalSeconds = 0.0;
94 bool _started =
false;