E-MailRelay
|
An interface used by GNet::TimerList to keep track of pending timeouts and to deliver timeout events. More...
#include <gtimer.h>
Public Member Functions | |
virtual | ~TimerBase () |
Destructor. More... | |
void | startTimer (unsigned int interval_s, unsigned int interval_us=0U) |
Starts or restarts the timer so that it expires after the given interval. More... | |
void | startTimer (const G::TimeInterval &) |
Starts or restarts the timer so that it expires after the given interval. More... | |
void | cancelTimer () |
Cancels the timer. Does nothing if not running. More... | |
bool | active () const noexcept |
Returns true if the timer is started and not cancelled. More... | |
bool | immediate () const |
Used by TimerList. More... | |
void | doTimeout () |
Used by TimerList to execute the onTimeout() callback. More... | |
G::TimerTime | t () const |
Used by TimerList to get the expiry epoch time. More... | |
const G::TimerTime & | tref () const noexcept |
An inline noexcept alternative to t(). More... | |
void | adjust (unsigned long) |
Used by TimerList to set the order of immedate() timer expiry. More... | |
bool | expired (G::TimerTime &) const |
Used by TimerList. More... | |
TimerBase (const TimerBase &)=delete | |
TimerBase (TimerBase &&)=delete | |
TimerBase & | operator= (const TimerBase &)=delete |
TimerBase & | operator= (TimerBase &&)=delete |
Protected Member Functions | |
TimerBase (EventState es) | |
Constructor. More... | |
virtual void | onTimeout ()=0 |
Called when the timer expires (or soon after). | |
An interface used by GNet::TimerList to keep track of pending timeouts and to deliver timeout events.
The public methods to start and cancel the timer are normally used via GNet::Timer<>.
|
explicitprotected |
Constructor.
The EventState receives an onException() call if the onTimeout() implementation throws.
Definition at line 29 of file gtimer.cpp.
|
virtual |
Destructor.
Definition at line 35 of file gtimer.cpp.
|
inlinenoexcept |
void GNet::TimerBase::adjust | ( | unsigned long | order | ) |
Used by TimerList to set the order of immedate() timer expiry.
Definition at line 90 of file gtimer.cpp.
void GNet::TimerBase::cancelTimer | ( | ) |
Cancels the timer. Does nothing if not running.
Definition at line 96 of file gtimer.cpp.
void GNet::TimerBase::doTimeout | ( | ) |
Used by TimerList to execute the onTimeout() callback.
Definition at line 105 of file gtimer.cpp.
bool GNet::TimerBase::expired | ( | G::TimerTime & | now | ) | const |
Used by TimerList.
Returns true if expired when compared to the given epoch time. If the given epoch time is TimerTime::zero() then it is initialised with TimerTime::now().
Definition at line 47 of file gtimer.cpp.
bool GNet::TimerBase::immediate | ( | ) | const |
Used by TimerList.
Returns true if the timer is active() and zero-length.
Definition at line 85 of file gtimer.cpp.
void GNet::TimerBase::startTimer | ( | const G::TimeInterval & | i | ) |
Starts or restarts the timer so that it expires after the given interval.
Definition at line 77 of file gtimer.cpp.
void GNet::TimerBase::startTimer | ( | unsigned int | interval_s, |
unsigned int | interval_us = 0U |
||
) |
Starts or restarts the timer so that it expires after the given interval.
Definition at line 69 of file gtimer.cpp.
G::TimerTime GNet::TimerBase::t | ( | ) | const |
Used by TimerList to get the expiry epoch time.
Zero-length timers return TimerTime::zero() plus any adjust()ment, ~guaranteed to be less than the t() of any non-immediate timer.
Definition at line 112 of file gtimer.cpp.
|
inlinenoexcept |