|
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) |
| Time remaining until expired. | |
| TimerQueue * | getQueue (void) |
| Get the timer queue we are attached to. | |
| bool | isExpired (void) |
| Test if event has expired. | |
| void | update (void) |
| Notify timer queue that the timer has been updated. | |
| virtual | ~event () |
| Detaches from queue when destroyed. | |
Public Member Functions inherited from ucommon::LinkedList | |
| void | delist (void) |
| Remove our object from the list it is currently part of. | |
| void | enlist (OrderedIndex *index) |
| Attach our object to a linked list. | |
| void | enlistHead (OrderedIndex *index) |
| Attach our object to the start of a linked list though an ordered index. | |
| void | enlistTail (OrderedIndex *index) |
| Attach our object to the end of a linked list though an ordered index. | |
| LinkedList * | getNext (void) |
| Get next node in the list when iterating. | |
| LinkedList * | getPrev (void) |
| Get previous node in the list for reverse iteration. | |
| virtual void | insert (LinkedList *object) |
| Insert object, method in derived object. | |
| void | insertHead (LinkedList *object) |
| Insert object in front of our object. | |
| void | insertTail (LinkedList *object) |
| Insert object behind our object. | |
| bool | isHead (void) |
| Test if we are at the head of a list. | |
| bool | isTail (void) |
| Test if we are at the end of a list. | |
| void | operator*= (LinkedList *object) |
| Insert object in list with our object. | |
| void | operator+= (LinkedList *object) |
| Insert object behind our object. | |
| void | operator-= (LinkedList *object) |
| Insert object in front of our object. | |
Public Member Functions inherited from ucommon::OrderedObject | |
| void | delist (OrderedIndex *index) |
| Remove our ordered object from an existing index. | |
Public Member Functions inherited from ucommon::LinkedObject | |
| void | delist (LinkedObject **root) |
| Locate and remove ourselves from a list of objects. | |
| void | enlist (LinkedObject **root) |
| Add our object to an existing linked list through a pointer. | |
| bool | isMember (LinkedObject *list) |
| Search to see if we are a member of a specific list. | |
| virtual void | release (void) |
| Release list, mark as no longer linked. | |
| virtual void | retain (void) |
| Retain by marking as self referenced list. | |
Public Member Functions inherited from ucommon::ObjectProtocol | |
| ObjectProtocol * | copy (void) |
| Retain (increase retention of) object when copying. | |
| void | operator++ (void) |
| Increase retention operator. | |
| void | operator-- (void) |
| Decrease retention operator. | |
| virtual | ~ObjectProtocol () |
| Required virtual destructor. | |
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. | |
Protected Member Functions inherited from ucommon::Timer | |
| void | clear (void) |
| Clear pending timer, has no value. | |
| bool | isUpdated (void) |
| Check if timer has been updated since last check. | |
| operator bool () | |
| Check if timer expired for is() expression. | |
| bool | operator! () |
| Check if timer has expired. | |
| bool | operator!= (Timer &timer) |
| Compare timers if not same timeout. | |
| timeout_t | operator* () |
| Get remaining time until timer expires by reference. | |
| Timer & | operator+= (time_t expire) |
| Adjust timer expiration. | |
| Timer & | operator+= (timeout_t expire) |
| Adjust timer expiration. | |
| timeout_t | operator- (Timer &timer) |
| Compute difference between two timers. | |
| Timer & | operator-= (time_t expire) |
| Adjust timer expiration. | |
| Timer & | operator-= (timeout_t expire) |
| Adjust timer expiration. | |
| bool | operator< (Timer &timer) |
| Compare timers if earlier timeout than another timer. | |
| bool | operator<= (Timer &timer) |
| Compare timers if earlier than or equal to another timer. | |
| Timer & | operator= (time_t expire) |
| Set timer expiration. | |
| Timer & | operator= (timeout_t expire) |
| Set timer expiration. | |
| bool | operator== (Timer &timer) |
| Compare timers if same timeout. | |
| bool | operator> (Timer &timer) |
| Compare timers if later timeout than another timer. | |
| bool | operator>= (Timer &timer) |
| Compare timers if later than or equal to another timer. | |
| void | set (timeout_t expire) |
| Set the timer to expire. | |
| void | set (time_t expire) |
| Set the timer to expire. | |
| void | set (void) |
| Set (update) the timer with current time. | |
| Timer () | |
| Construct an untriggered timer set to the time of creation. | |
| Timer (timeout_t offset) | |
| Construct a triggered timer that expires at specified offset. | |
| Timer (time_t offset) | |
| Construct a triggered timer that expires at specified offset. | |
| Timer (Timer ©) | |
| Construct a timer from a copy of another timer. | |
Protected Member Functions inherited from ucommon::LinkedList | |
| LinkedList (OrderedIndex *index) | |
| Construct and add our object to an existing double linked list at end. | |
| LinkedList () | |
| Construct an unlinked object. | |
| virtual | ~LinkedList () |
| Delete linked list object. | |
Protected Member Functions inherited from ucommon::OrderedObject | |
| OrderedObject (OrderedIndex *index) | |
| Construct an ordered object aot end of a an index. | |
| OrderedObject () | |
| Construct an ordered object unattached. | |
Protected Member Functions inherited from ucommon::LinkedObject | |
| LinkedObject (LinkedObject **root) | |
| Construct base class attached to a chain of objects. | |
| LinkedObject () | |
| Construct base class unattached to anyone. | |
Friends | |
| class | TimerQueue |
Additional Inherited Members | |
Protected Types inherited from ucommon::Timer | |
| typedef uint64_t | tick_t |
Static Protected Member Functions inherited from ucommon::Timer | |
| static void | sync (Timer &timer) |
| Sleep current thread until the specified timer expires. | |
| static tick_t | ticks (void) |
| Get timer ticks since uuid epoch. | |
Protected Attributes inherited from ucommon::LinkedList | |
| LinkedList * | prev |
| OrderedIndex * | root |
Static Protected Attributes inherited from ucommon::Timer | |
| static timeout_t | inf |
| A value to use for infinite time. | |
| static time_t | reset |
| A value to use when resetting. | |
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.
|
protected |
Construct a timer event object and initially arm.
| expire | timer in specified milliseconds. |
|
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. |
|
inline |
Time remaining until expired.
Reimplemented from ucommon::Timer.
|
inline |
|
inline |
|
protectedvirtual |
Expected next timeout for the timer.
This may be overriden for strategy purposes when evaluted by timer queue's expire.
1.8.1.1