33 template <
typename T>
class Timer ;
52 void startTimer(
unsigned int interval_s ,
unsigned int interval_us = 0U ) ;
63 bool active()
const noexcept ;
82 void adjust(
unsigned long ) ;
106 bool m_active {
false} ;
107 bool m_immediate {
false} ;
143 using method_type = void (T::*)() ;
148 void startTimer(
unsigned int interval_s ,
unsigned int interval_us = 0U ) ;
163 ~
Timer() override = default ;
166 Timer<T> & operator=( const
Timer<T> & ) = delete ;
167 Timer<T> & operator=(
Timer<T> && ) = delete ;
170 void onTimeout() override ;
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
An interface used by GNet::TimerList to keep track of pending timeouts and to deliver timeout events.
void doTimeout()
Used by TimerList to execute the onTimeout() callback.
void adjust(unsigned long)
Used by TimerList to set the order of immedate() timer expiry.
bool immediate() const
Used by TimerList.
void cancelTimer()
Cancels the timer. Does nothing if not running.
virtual void onTimeout()=0
Called when the timer expires (or soon after).
void startTimer(unsigned int interval_s, unsigned int interval_us=0U)
Starts or restarts the timer so that it expires after the given interval.
bool expired(G::TimerTime &) const
Used by TimerList.
const G::TimerTime & tref() const noexcept
An inline noexcept alternative to t().
TimerBase(EventState es)
Constructor.
bool active() const noexcept
Returns true if the timer is started and not cancelled.
G::TimerTime t() const
Used by TimerList to get the expiry epoch time.
virtual ~TimerBase()
Destructor.
A timer class template in which the timeout is delivered to the specified method.
void startTimer(unsigned int interval_s, unsigned int interval_us=0U)
Starts or restarts the timer so that it expires after the given interval.
void startTimer(const G::TimeInterval &)
Starts or restarts the timer so that it expires after the given interval.
void cancelTimer()
Cancels the timer. Does nothing if not running.
Timer(T &t, method_type m, EventState)
Constructor.
bool active() const noexcept
Returns true if the timer is running.
An interval between two G::SystemTime values or two G::TimerTime values.
A monotonically increasing subsecond-resolution timestamp, notionally unrelated to time_t.