nux-0.9.48

nux::TimerHandler Class Reference

#include <Nux/TimerProc.h>

Public Types

enum  { TIMERTYPE_UNKNONW = 0L, TIMERTYPE_PERIODIC, TIMERTYPE_DURATION, TIMERTYPE_ITERATION }

Public Member Functions

 TimerHandler ()
 ~TimerHandler ()
TimerHandle AddTimerHandler (unsigned int Period, TimerFunctor *Callback, void *Data, WindowThread *window_thread=NULL)
 Add a timer callback.
TimerHandle AddPeriodicTimerHandler (unsigned int Period, int Duration, TimerFunctor *Callback, void *Data)
 Add a periodic timer callback.
TimerHandle AddCountIterationTimerHandler (unsigned int Period, int NumberOfIteration, TimerFunctor *Callback, void *Data)
 Add a timer callback to be called a finite number of time.
bool FindTimerHandle (TimerHandle &handle)
 Search for a timer handle.
bool RemoveTimerHandler (TimerHandle &handle)
 Remove a timer;.
int DelayUntilNextTimerExpires ()
 Return the delay until the next timer expires.
int ExecTimerHandler ()
void StartEarlyTimerObjects ()
 Start the timers that were sett before the system was fully initialized.

Member Enumeration Documentation

anonymous enum
Enumerator:
TIMERTYPE_UNKNONW 
TIMERTYPE_PERIODIC 
TIMERTYPE_DURATION 
TIMERTYPE_ITERATION 

Constructor & Destructor Documentation

nux::TimerHandler::TimerHandler ( )
nux::TimerHandler::~TimerHandler ( )

Member Function Documentation

TimerHandle nux::TimerHandler::AddCountIterationTimerHandler ( unsigned int  Period,
int  NumberOfIteration,
TimerFunctor Callback,
void *  Data 
)

Add a timer callback to be called a finite number of time.

Add a timer callback to the timer manager. The timer callback will be call N times exactly. Every time the timer expires, the callback function is executed. The returned TimerHandle should not be deleted by the caller.

Parameters:
MillisecondsPeriod delay before the callback is executed.
NumberOfIterationThe number of time to repeat the the wait period.
CallbackThe callback to execute when the timer expires.
DataThe callback data
Returns:
A handle to the timer.
TimerHandle nux::TimerHandler::AddPeriodicTimerHandler ( unsigned int  Period,
int  Duration,
TimerFunctor Callback,
void *  Data 
)

Add a periodic timer callback.

Add a timer callback to the timer manager. Every time the timer expires, the callback function is executed. The returned TimerHandle should not be deleted by the caller.

Parameters:
MillisecondsPeriod delay before the callback is executed.
DurationThe duration over which the timer is repeated.
CallbackThe callback to execute when the timer expires.
DataThe callback data
Returns:
A handle to the timer.
TimerHandle nux::TimerHandler::AddTimerHandler ( unsigned int  Period,
TimerFunctor Callback,
void *  Data,
WindowThread window_thread = NULL 
)

Add a timer callback.

Add a timer callback to the timer manager. When the timer expires, the callback function is executed. The returned TimerObject should not be deleted by the caller.

Parameters:
MillisecondsPeriod delay before the callback is executed.
CallbackThe callback to execute when the timer expires.
DataThe callback data
window_threadThread safety mesure. Pass the WindowThread associated to this TimerHandler if it is called from a diferent thread than the one where the main thread was created.
Returns:
A handle to the timer.
int nux::TimerHandler::DelayUntilNextTimerExpires ( )

Return the delay until the next timer expires.

Returns:
Delay to next timer expiration in milliseconds.
int nux::TimerHandler::ExecTimerHandler ( )
bool nux::TimerHandler::FindTimerHandle ( TimerHandle handle)

Search for a timer handle.

Search for a timer handle in the timer handle queue. Return true if the timer is found.

Parameters:
handleTimer handle to search.
Returns:
Return true if the timer is found; false otherwise.
bool nux::TimerHandler::RemoveTimerHandler ( TimerHandle handle)

Remove a timer;.

Parameters:
handleTimer handle to search.
Returns:
Return True if the timer is found.
void nux::TimerHandler::StartEarlyTimerObjects ( )

Start the timers that were sett before the system was fully initialized.


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