|
#include <Timer.h>
Classes | |
| class | EventData |
| struct | EventId |
Public Types | |
| using | Event = std::shared_ptr< EventData > |
Public Member Functions | |
| Timer ()=default | |
| Timer (const Timer &other)=delete | |
| virtual | ~Timer () |
| Event | fireAt (const DateTime ×tamp, const EventData::Callback &eventCallback) |
| Event | repeat (std::chrono::milliseconds interval, const EventData::Callback &eventCallback, int repeatCount=-1) |
| void | cancel (const Event &event) |
| void | cancel () |
Protected Member Functions | |
| void | unlink (const Event &event) |
| Remove event from this timer. | |
Generic timer class. Can fire one time off and repeatable events
| using sptk::Timer::Event = std::shared_ptr<EventData> |
Type definition for timer event
|
default |
Constructor
|
delete |
Copy constructor
| other | Timer to copy from |
|
virtual |
Destructor. Cancel all events scheduled by this timer.
| void sptk::Timer::cancel | ( | ) |
Cancel all events
| void sptk::Timer::cancel | ( | const Event & | event | ) |
Cancel event
| event | Event handle, returned by event scheduling method. |
| Event sptk::Timer::fireAt | ( | const DateTime & | timestamp, |
| const EventData::Callback & | eventCallback | ||
| ) |
Schedule single event.
| timestamp | Fire at timestamp |
| eventCallback | Event callback. |
| Event sptk::Timer::repeat | ( | std::chrono::milliseconds | interval, |
| const EventData::Callback & | eventCallback, | ||
| int | repeatCount = -1 |
||
| ) |
Schedule repeatable event. The first event is scheduled at current time + interval.
| interval | Event repeat interval. |
| eventCallback | Event callback. |
| repeatCount | Repeat count, -1 means no limit |