UCommon
|
A timer event object that lives on a timer queue. More...
#include <timers.h>
Public Member Functions | |
void | arm (timeout_t timeout) |
Arm event to trigger at specified timeout. | |
void | attach (TimerQueue *queue) |
Attach event to a timer queue. | |
void | detach (void) |
Detach event from a timer queue. | |
void | disarm (void) |
Disarm event. | |
timeout_t | get (void) const |
Time remaining until expired. | |
TimerQueue * | list (void) const |
Get the timer queue we are attached to. | |
void | update (void) |
Notify timer queue that the timer has been updated. | |
virtual | ~event () |
Detaches from queue when destroyed. | |
Protected Member Functions | |
event (timeout_t expire) | |
Construct a timer event object and initially arm. | |
event (TimerQueue *queue, timeout_t expire) | |
Construct an armed timer event object and attach to queue. | |
virtual void | expired (void)=0 |
Event method to call in derived class when timer expires. | |
virtual timeout_t | timeout (void) |
Expected next timeout for the timer. | |
Friends | |
class | TimerQueue |
A timer event object that lives on a timer queue.
Timer events are triggered through the timer queue's expire method. Timer events also modify the queue when they are changed, particularly to force re-evaluation of the expiration period. This class is not used by itself but rather as a base class for a timer event object.
ucommon::TimerQueue::event::event | ( | timeout_t | expire | ) | [protected] |
Construct a timer event object and initially arm.
expire | timer in specified milliseconds. |
ucommon::TimerQueue::event::event | ( | TimerQueue * | queue, |
timeout_t | expire | ||
) | [protected] |
Construct an armed timer event object and attach to queue.
queue | to add event to. |
expire | timer in specified milliseconds. |
void ucommon::TimerQueue::event::arm | ( | timeout_t | timeout | ) |
Arm event to trigger at specified timeout.
timeout | to expire and trigger. |
void ucommon::TimerQueue::event::attach | ( | TimerQueue * | queue | ) |
Attach event to a timer queue.
Detaches from previous list if already attached elsewhere.
queue | to attach to. |
timeout_t ucommon::TimerQueue::event::get | ( | void | ) | const [inline] |
Time remaining until expired.
Reimplemented from ucommon::Timer.
Definition at line 345 of file timers.h.
TimerQueue* ucommon::TimerQueue::event::list | ( | void | ) | const [inline] |
virtual timeout_t ucommon::TimerQueue::event::timeout | ( | void | ) | [protected, virtual] |
Expected next timeout for the timer.
This may be overriden for strategy purposes when evaluted by timer queue's expire.