ucc::TimerQueue::event Class Reference

A timer event object that lives on a timer queue. More...

#include <timers.h>

Inheritance diagram for ucc::TimerQueue::event:

Inheritance graph
[legend]
Collaboration diagram for ucc::TimerQueue::event:

Collaboration graph
[legend]

Public Member Functions

virtual ~event ()
 Detaches from queue when destroyed.
void attach (TimerQueue *queue)
 Attach event to a timer queue.
void detach (void)
 Detach event from a timer queue.
void arm (timeout_t timeout)
 Arm event to trigger at specified timeout.
void disarm (void)
 Disarm event.
bool isExpired (void)
 Test if event has expired.
timeout_t get (void)
 Time remaining until expired.
void update (void)
 Notify timer queue that the timer has been updated.
TimerQueue * getQueue (void)
 Get the timer queue we are attached to.

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

Detailed Description

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.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 201 of file timers.h.


Constructor & Destructor Documentation

ucc::TimerQueue::event::event ( timeout_t  expire  )  [protected]

Construct a timer event object and initially arm.

Parameters:
expire timer in specified milliseconds.

ucc::TimerQueue::event::event ( TimerQueue *  queue,
timeout_t  expire 
) [protected]

Construct an armed timer event object and attach to queue.

Parameters:
queue to add event to.
expire timer in specified milliseconds.


Member Function Documentation

void ucc::TimerQueue::event::arm ( timeout_t  timeout  ) 

Arm event to trigger at specified timeout.

Parameters:
timeout to expire and trigger.

void ucc::TimerQueue::event::attach ( TimerQueue *  queue  ) 

Attach event to a timer queue.

Detaches from previous list if already attached elsewhere.

Parameters:
queue to attach to.

timeout_t ucc::TimerQueue::event::get ( void   )  [inline]

Time remaining until expired.

Returns:
milliseconds until timer expires.

Reimplemented from ucc::Timer.

Definition at line 271 of file timers.h.

TimerQueue* ucc::TimerQueue::event::getQueue ( void   )  [inline]

Get the timer queue we are attached to.

Returns:
timer queue or NULL if not attached.

Definition at line 283 of file timers.h.

bool ucc::TimerQueue::event::isExpired ( void   )  [inline]

Test if event has expired.

Returns:
true if expired.

Reimplemented from ucc::Timer.

Definition at line 264 of file timers.h.

virtual timeout_t ucc::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.

Returns:
milliseconds until timer next triggers.


The documentation for this class was generated from the following file:

Generated on Mon Jul 27 21:11:24 2009 for UCommon by  doxygen 1.5.9