Class eva::CountdownTimer¶
ClassList > eva > CountdownTimer
Timer that fires a specified number of times at fixed intervals.
#include <evaCountdownTimer.h>
Inherits the following classes: eva::DelayTimer
Public Functions¶
| Type | Name |
|---|---|
| DelayTimer () Constructs a CountdownTimer . |
|
| DelayTimer (IHandler * listener) Constructs a CountdownTimer . |
|
| unsigned char | getRemaining () Returns the number of remaining timer ticks. |
| CountdownTimer * | setListener (IHandler * listener) Assigns or changes the event listener. |
| void | start (unsigned short period, unsigned char count, IHandler * listener) Starts or restarts the repeating timer. |
| void | start (unsigned short period, unsigned char count) Starts or restarts the countdown timer. |
Public Functions inherited from eva::DelayTimer¶
See eva::DelayTimer
| Type | Name |
|---|---|
| DelayTimer () Constructs a DelayTimer with no listener. |
|
| DelayTimer (IHandler * listener) Constructs a DelayTimer with a listener. |
|
| bool | isRunning () Checks if the timer is currently active. |
| DelayTimer * | setListener (IHandler * listener) Assigns or changes the event listener. |
| void | start (unsigned short delay, IHandler * listener) Starts the timer. |
| void | start (unsigned short delay) Starts the timer. |
| void | stop () Stops the timer. |
Public Functions inherited from eva::Tickable¶
See eva::Tickable
| Type | Name |
|---|---|
| Tickable () |
|
| Tickable (const Tickable &) = delete |
|
| Tickable (Tickable &&) = delete |
|
| Tickable & | operator= (const Tickable &) = delete |
| Tickable & | operator= (Tickable &&) = delete |
| virtual | ~Tickable () |
Public Static Functions inherited from eva::Tickable¶
See eva::Tickable
| Type | Name |
|---|---|
| void | tac () Triggers tick on this and all linked tickables. |
Protected Attributes inherited from eva::DelayTimer¶
See eva::DelayTimer
| Type | Name |
|---|---|
| IHandler * | listener |
Protected Functions inherited from eva::DelayTimer¶
See eva::DelayTimer
| Type | Name |
|---|---|
| bool | checkTimeElapsed () |
| virtual void | tick () override |
Public Functions Documentation¶
function DelayTimer [1/2]¶
Constructs a CountdownTimer .
eva::CountdownTimer::DelayTimer ()
function DelayTimer [2/2]¶
Constructs a CountdownTimer .
eva::CountdownTimer::DelayTimer (
IHandler * listener
)
function getRemaining¶
Returns the number of remaining timer ticks.
unsigned char eva::CountdownTimer::getRemaining ()
Returns:
Number of pending executions (0 if timer is not running)
function setListener¶
Assigns or changes the event listener.
CountdownTimer * eva::CountdownTimer::setListener (
IHandler * listener
)
Parameters:
listenerPointer to IHandler implementation that will receive timer events
Returns:
Pointer to this CountdownTimer instance for method chaining
function start [1/2]¶
Starts or restarts the repeating timer.
void eva::CountdownTimer::start (
unsigned short period,
unsigned char count,
IHandler * listener
)
Parameters:
periodInterval in millisecondscountNumber of iterationslistenerHandler to invoke on each tick
function start [2/2]¶
Starts or restarts the countdown timer.
void eva::CountdownTimer::start (
unsigned short period,
unsigned char count
)
Parameters:
periodInterval in millisecondscountNumber of iterations
Listener must be assigned via constructor or setListener(). Use overloaded version with listener parameter if not pre-assigned.
The documentation for this class was generated from the following file src/evaCountdownTimer.h