|
|||
|
|||
|
#include <timer.h>
Inheritance diagram for Timer:


Public Member Functions | |
| Timer (long secs_from_now, time_t now, bool repeating=false) | |
| Default constructor, initializes the triggering time. | |
| virtual | ~Timer () |
| Default destructor, does nothing. | |
| virtual time_t | GetTimer () |
| Retrieve the current triggering time. | |
| virtual void | SetTimer (time_t t) |
| Sets the trigger timeout to a new value. | |
| virtual void | Tick (time_t TIME)=0 |
| Called when the timer ticks. | |
| bool | GetRepeat () |
| Returns true if this timer is set to repeat. | |
| long | GetSecs () |
| Returns the interval (number of seconds between ticks) of this timer object. | |
| void | CancelRepeat () |
| Cancels the repeat state of a repeating timer. | |
Private Attributes | |
| time_t | trigger |
| The triggering time. | |
| long | secs |
| Number of seconds between triggers. | |
| bool | repeat |
| True if this is a repeating timer. | |
The timer can be made to trigger at any time up to a one-second resolution. To use Timer, inherit a class from Timer, then insert your inherited class into the queue using Server::AddTimer(). The Tick() method of your object (which you should override) will be called at the given time.
Definition at line 29 of file timer.h.
|
||||||||||||||||
|
Default constructor, initializes the triggering time.
|
|
|
Default destructor, does nothing.
|
|
|
Cancels the repeat state of a repeating timer. If you call this method, then the next time your timer ticks, it will be removed immediately after. You should use this method call to remove a recurring timer if you wish to do so within the timer's Tick event, as calling TimerManager::DelTimer() from within the Timer::Tick() method is dangerous and may cause a segmentation fault. Calling CancelRepeat() is safe in this case. |
|
|
Returns true if this timer is set to repeat.
Definition at line 80 of file timer.h. Referenced by TimerManager::TickTimers(). |
|
|
Returns the interval (number of seconds between ticks) of this timer object.
Definition at line 88 of file timer.h. Referenced by TimerManager::TickTimers(). |
|
|
Retrieve the current triggering time.
Definition at line 60 of file timer.h. Referenced by TimerManager::TimerComparison(). |
|
|
Sets the trigger timeout to a new value.
Definition at line 67 of file timer.h. Referenced by TimerManager::TickTimers(). |
|
|
Called when the timer ticks. You should override this method with some useful code to handle the tick event. Implemented in CacheTimer, RequestTimeout, ReconnectTimer, CacheRefreshTimer, HandshakeTimer, WhoWasMaintainTimer, and SocketTimeout. Referenced by TimerManager::TickTimers(). |
|
|
True if this is a repeating timer.
|
|
|
Number of seconds between triggers.
|
|
|
The triggering time.
|