|
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. More... | |
| void | attach (TimerQueue *queue) |
| Attach event to a timer queue. More... | |
| void | detach (void) |
| Detach event from a timer queue. | |
| void | disarm (void) |
| Disarm event. | |
| timeout_t | get (void) const |
| Time remaining until expired. More... | |
| TimerQueue * | list (void) |
| Get the timer queue we are attached to. More... | |
| 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. More... | |
| void | enlistHead (OrderedIndex *index) |
| Attach our object to the start of a linked list though an ordered index. More... | |
| void | enlistTail (OrderedIndex *index) |
| Attach our object to the end of a linked list though an ordered index. More... | |
| LinkedList * | getNext (void) const |
| Get next node in the list when iterating. More... | |
| LinkedList * | getPrev (void) const |
| Get previous node in the list for reverse iteration. More... | |
| virtual void | insert (LinkedList *object) |
| Insert object, method in derived object. More... | |
| void | insertHead (LinkedList *object) |
| Insert object in front of our object. More... | |
| void | insertTail (LinkedList *object) |
| Insert object behind our object. More... | |
| bool | is_head (void) const |
| Test if we are at the head of a list. More... | |
| bool | is_tail (void) const |
| Test if we are at the end of a list. More... | |
| void | operator*= (LinkedList *object) |
| Insert object in list with our object. More... | |
| void | operator+= (LinkedList *object) |
| Insert object behind our object. More... | |
| void | operator-= (LinkedList *object) |
| Insert object in front of our object. More... | |
Public Member Functions inherited from ucommon::OrderedObject | |
| void | delist (OrderedIndex *index) |
| Remove our ordered object from an existing index. More... | |
| void | enlistHead (OrderedIndex *index) |
| List our ordered object at start of a linked list on an index. More... | |
| void | enlistTail (OrderedIndex *index) |
| List our ordered object at end of a linked list on an index. More... | |
| OrderedObject * | getNext (void) const |
| Get next ordered member when iterating. More... | |
Public Member Functions inherited from ucommon::LinkedObject | |
| void | delist (LinkedObject **root) |
| Locate and remove ourselves from a list of objects. More... | |
| void | enlist (LinkedObject **root) |
| Add our object to an existing linked list through a pointer. More... | |
| LinkedObject * | getNext (void) const |
| Get next effective object when iterating. More... | |
| bool | is_member (LinkedObject *list) const |
| Search to see if we are a member of a specific list. More... | |
| virtual void | release (void) |
| Release list, mark as no longer linked. More... | |
| virtual void | retain (void) |
| Retain by marking as self referenced list. More... | |
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. More... | |
| event (TimerQueue *queue, timeout_t expire) | |
| Construct an armed timer event object and attach to queue. More... | |
| 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. More... | |
Protected Member Functions inherited from ucommon::Timer | |
| bool | is_active (void) |
| Check if timer active. More... | |
| bool | update (void) |
| Check if timer has been updated since last check. More... | |
| void | clear (void) |
| Clear pending timer, has no value. | |
| timeout_t | get (void) const |
| Get remaining time until the timer expires. More... | |
| operator bool () const | |
| Check if timer expired for is() expression. More... | |
| bool | operator! () const |
| Check if timer has expired. More... | |
| bool | operator!= (const Timer &timer) const |
| Compare timers if not same timeout. More... | |
| timeout_t | operator* () const |
| Get remaining time until timer expires by reference. More... | |
| Timer & | operator+= (time_t expire) |
| Adjust timer expiration. More... | |
| Timer & | operator+= (timeout_t expire) |
| Adjust timer expiration. More... | |
| timeout_t | operator- (const Timer &timer) |
| Compute difference between two timers. More... | |
| Timer & | operator-= (time_t expire) |
| Adjust timer expiration. More... | |
| Timer & | operator-= (timeout_t expire) |
| Adjust timer expiration. More... | |
| bool | operator< (const Timer &timer) const |
| Compare timers if earlier timeout than another timer. More... | |
| bool | operator<= (const Timer &timer) const |
| Compare timers if earlier than or equal to another timer. More... | |
| Timer & | operator= (time_t expire) |
| Set timer expiration. More... | |
| Timer & | operator= (timeout_t expire) |
| Set timer expiration. More... | |
| bool | operator== (const Timer &timer) const |
| Compare timers if same timeout. More... | |
| bool | operator> (const Timer &timer) const |
| Compare timers if later timeout than another timer. More... | |
| bool | operator>= (const Timer &timer) const |
| Compare timers if later than or equal to another timer. More... | |
| void | set (timeout_t expire) |
| Set the timer to expire. More... | |
| void | set (time_t expire) |
| Set the timer to expire. More... | |
| 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. More... | |
| Timer (time_t offset) | |
| Construct a triggered timer that expires at specified offset. More... | |
| Timer (const Timer ©) | |
| Construct a timer from a copy of another timer. More... | |
Protected Member Functions inherited from ucommon::LinkedList | |
| LinkedList (OrderedIndex *index) | |
| Construct and add our object to an existing double linked list at end. More... | |
| LinkedList () | |
| Construct an unlinked object. | |
| virtual | ~LinkedList () |
| Delete linked list object. More... | |
| 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. More... | |
| void | enlistHead (OrderedIndex *index) |
| Attach our object to the start of a linked list though an ordered index. More... | |
| void | enlistTail (OrderedIndex *index) |
| Attach our object to the end of a linked list though an ordered index. More... | |
| LinkedList * | getNext (void) const |
| Get next node in the list when iterating. More... | |
| LinkedList * | getPrev (void) const |
| Get previous node in the list for reverse iteration. More... | |
| virtual void | insert (LinkedList *object) |
| Insert object, method in derived object. More... | |
| void | insertHead (LinkedList *object) |
| Insert object in front of our object. More... | |
| void | insertTail (LinkedList *object) |
| Insert object behind our object. More... | |
| bool | is_head (void) const |
| Test if we are at the head of a list. More... | |
| bool | is_tail (void) const |
| Test if we are at the end of a list. More... | |
| void | operator*= (LinkedList *object) |
| Insert object in list with our object. More... | |
| void | operator+= (LinkedList *object) |
| Insert object behind our object. More... | |
| void | operator-= (LinkedList *object) |
| Insert object in front of our object. More... | |
Protected Member Functions inherited from ucommon::OrderedObject | |
| OrderedObject (OrderedIndex *index) | |
| Construct an ordered object aot end of a an index. More... | |
| OrderedObject () | |
| Construct an ordered object unattached. | |
| void | delist (OrderedIndex *index) |
| Remove our ordered object from an existing index. More... | |
| void | enlistHead (OrderedIndex *index) |
| List our ordered object at start of a linked list on an index. More... | |
| void | enlistTail (OrderedIndex *index) |
| List our ordered object at end of a linked list on an index. More... | |
| OrderedObject * | getNext (void) const |
| Get next ordered member when iterating. More... | |
Protected Member Functions inherited from ucommon::LinkedObject | |
| LinkedObject (LinkedObject **root) | |
| Construct base class attached to a chain of objects. More... | |
| LinkedObject () | |
| Construct base class unattached to anyone. More... | |
| void | delist (LinkedObject **root) |
| Locate and remove ourselves from a list of objects. More... | |
| void | enlist (LinkedObject **root) |
| Add our object to an existing linked list through a pointer. More... | |
| LinkedObject * | getNext (void) const |
| Get next effective object when iterating. More... | |
| bool | is_member (LinkedObject *list) const |
| Search to see if we are a member of a specific list. More... | |
| virtual void | release (void) |
| Release list, mark as no longer linked. More... | |
| virtual void | retain (void) |
| Retain by marking as self referenced list. More... | |
Protected 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. | |
Friends | |
| class | TimerQueue |
Additional Inherited Members | |
Static Public Member Functions inherited from ucommon::LinkedObject | |
| static unsigned | count (const LinkedObject *root) |
| Count the number of linked objects in a list. More... | |
| static LinkedObject * | getIndexed (LinkedObject *root, unsigned index) |
| Get member by index. More... | |
| static void | purge (LinkedObject *root) |
| Release all objects from a list. More... | |
Static Public Attributes inherited from ucommon::LinkedObject | |
| static const LinkedObject * | inv |
| Marker for invalid list pointer. | |
| static const LinkedObject * | nil |
| Marker for end of linked list. More... | |
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. More... | |
| static tick_t | ticks (void) |
| Get timer ticks since uuid epoch. More... | |
Static Protected Member Functions inherited from ucommon::LinkedObject | |
| static unsigned | count (const LinkedObject *root) |
| Count the number of linked objects in a list. More... | |
| static LinkedObject * | getIndexed (LinkedObject *root, unsigned index) |
| Get member by index. More... | |
| static void | purge (LinkedObject *root) |
| Release all objects from a list. More... | |
Protected Attributes inherited from ucommon::LinkedList | |
| LinkedList * | Prev |
| OrderedIndex * | Root |
Protected Attributes inherited from ucommon::LinkedObject | |
| LinkedObject * | Next |
Static Protected Attributes inherited from ucommon::Timer | |
| static const timeout_t | inf |
| A value to use for infinite time. | |
| static const time_t | reset |
| A value to use when resetting. | |
Static Protected Attributes inherited from ucommon::LinkedObject | |
| static const LinkedObject * | inv |
| Marker for invalid list pointer. | |
| static const LinkedObject * | nil |
| Marker for end of linked list. More... | |
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 |
|
inline |
|
protectedvirtual |
Expected next timeout for the timer.
This may be overriden for strategy purposes when evaluted by timer queue's expire.
1.8.6