TPeriodicClass Class Reference

#include <TPeriodicClass.hxx>

Inheritance diagram for TPeriodicClass:
Inheritance graph
[legend]
Collaboration diagram for TPeriodicClass:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 14 of file TPeriodicClass.hxx.


Member Typedef Documentation

typedef void(* TPeriodicClass::TimerHandler)(void)

Definition at line 17 of file TPeriodicClass.hxx.


Constructor & Destructor Documentation

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 }

Here is the call graph for this function:

TPeriodicClass::~TPeriodicClass (  )  [inline]

Definition at line 27 of file TPeriodicClass.hxx.

00028   {
00029     TurnOff();
00030   }


Member Function Documentation

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 }

Here is the call graph for this function:


Member Data Documentation

Definition at line 20 of file TPeriodicClass.hxx.

Referenced by Notify(), and TPeriodicClass().

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().


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

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1