4#ifndef _Stroika_Foundation_Execution_IntervalTimer_h_
5#define _Stroika_Foundation_Execution_IntervalTimer_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
11#include "Stroika/Foundation/Common/Common.h"
13#include "Stroika/Foundation/Containers/KeyedCollection.h"
76 optional<Time::Duration> fFrequency;
77 optional<Time::Duration> fHysteresis;
87 struct Key_Extractor_ {
95 using RegisteredTaskCollection =
121 Manager (
const shared_ptr<IRep>& rep);
148 const optional<Time::Duration>& hysteresis = nullopt);
162 [[deprecated (
"Since Stroika v3.0d25 - use Remove, which takes a one-shot too")]] nonvirtual
void RemoveRepeating (
TimerID timer)
noexcept;
198 shared_ptr<IRep> fRep_;
206 virtual ~IRep () =
default;
213 const optional<Time::Duration>& hysteresis) = 0;
238 const optional<Time::Duration>& hysteresis)
override;
249 shared_ptr<Rep_> fHiddenRep_;
280 using RunImmediatelyFlag::eDontRunImmediately;
310 const optional<Time::Duration>& hysteresis = nullopt);
312 const optional<Time::Duration>& hysteresis = nullopt);
314 RunImmediatelyFlag runImmediately,
const optional<Time::Duration>& hysteresis = nullopt);
344#include "IntervalTimer.inl"
time_point< RealtimeClock, DurationSeconds > TimePointSeconds
TimePointSeconds is a simpler approach to chrono::time_point, which doesn't require using templates e...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
a cross between Mapping<KEY, T> and Collection<T> and Set<T>
Adder adds the given function object to the (for now default; later optionally explicit) IntervalTime...
nonvirtual Adder & operator=(Adder &&rhs) noexcept
Removes this Adder's own timer, and takes over rhs's (not adding it again: rhs, moved from,...
virtual bool Remove(TimerID timer) noexcept override
As Manager::Remove says: once it returns, the timer's callback is not running, and is not called agai...
virtual bool Remove(TimerID timer) noexcept=0
As Manager::Remove says: once it returns, the timer's callback is not running, and is not called agai...
nonvirtual bool Remove(TimerID timer) noexcept
Removes the timer: once this returns, its callback is not running, and is not called again....
Manager(const Manager &)=delete
nonvirtual TimerID AddRepeating(const TimerCallback &intervalTimer, const Time::Duration &repeatInterval, const optional< Time::Duration > &hysteresis=nullopt)
Add a timer to be called repeatedly after duration repeatInterval - named by the TimerID returned,...
nonvirtual TimerID AddOneShot(const TimerCallback &intervalTimer, const Time::Duration &when)
Add a timer to be called once after duration when - named by the TimerID returned,...
Manage interval timers - like the javascript setIntervalTimer API.
function< void()> TimerCallback
Duration is a chrono::duration<double> (=.
Having explicit activator object allows for users to control the starting/stopping of facility in a m...
nonvirtual Characters::String ToString() const