#include <TPeriodicClass.hxx>
Public Types | |
typedef void(* | TimerHandler )(void) |
Public Member Functions | |
TPeriodicClass (int period_msec, TimerHandler handler) | |
Bool_t | Notify () |
~TPeriodicClass () | |
Public Attributes | |
int | fPeriod_msec |
TimerHandler | fHandler |
double | fLastTime |
Definition at line 14 of file TPeriodicClass.hxx.
typedef void(* TPeriodicClass::TimerHandler)(void) |
Definition at line 17 of file TPeriodicClass.hxx.
TPeriodicClass::TPeriodicClass | ( | int | period_msec, | |
TimerHandler | handler | |||
) |
Definition at line 13 of file TPeriodicClass.cxx.
References fHandler, fLastTime, fPeriod_msec, and GetTimeSec().
00014 { 00015 assert(handler != NULL); 00016 fPeriod_msec = period_msec; 00017 fHandler = handler; 00018 fLastTime = GetTimeSec(); 00019 Start(period_msec,kTRUE); 00020 }
TPeriodicClass::~TPeriodicClass | ( | ) | [inline] |
Definition at line 27 of file TPeriodicClass.hxx.
Bool_t TPeriodicClass::Notify | ( | ) |
Definition at line 22 of file TPeriodicClass.cxx.
References fHandler, fLastTime, fPeriod_msec, and GetTimeSec().
00023 { 00024 double t = GetTimeSec(); 00025 //printf("timer notify, period %f should be %f!\n",t-fLastTime,fPeriod_msec*0.001); 00026 00027 if (t - fLastTime >= 0.9*fPeriod_msec*0.001) 00028 { 00029 //printf("timer: call handler %p\n",fHandler); 00030 if (fHandler) 00031 (*fHandler)(); 00032 00033 fLastTime = t; 00034 } 00035 00036 Reset(); 00037 return kTRUE; 00038 }
Definition at line 20 of file TPeriodicClass.hxx.
Referenced by Notify(), and TPeriodicClass().
double TPeriodicClass::fLastTime |
Definition at line 21 of file TPeriodicClass.hxx.
Referenced by Notify(), and TPeriodicClass().
Definition at line 19 of file TPeriodicClass.hxx.
Referenced by Notify(), and TPeriodicClass().