gtime.h

Go to the documentation of this file.
00001 #ifndef gTIME_X_H
00002 #define gTIME_X_H
00003 
00004 #include "gstorage.h"
00005 ////////////////////////////////////////////////////////////
00006 struct sTimeSeconds {
00007     sTimeSeconds ()
00008         : sec( 0 ),
00009           microSec( 0 ) {
00010     }
00011     t_uint32 sec, microSec;
00012 
00013     void ToDefault () {
00014         sec = microSec = 0;
00015     }
00016     double GetMiliSecs () {
00017         return (double)sec*1000.0 + (double)microSec/1000.0;
00018     }
00019 
00020     void Copy (sTimeSeconds& copy) {
00021         sec = copy.sec;
00022         microSec = copy.microSec;
00023     }
00024 
00025     // Operators,empty
00026     sTimeSeconds (sTimeSeconds& ) ; //empty
00027     sTimeSeconds& operator= (sTimeSeconds& ) ; //empty
00028 };
00029 ////////////////////////////////////////////////////////////
00030 class gTimer : public gUInt {
00031 public:
00032     // Public enums
00033     enum eTimerPrec {
00034         e_PrecTic
00035     };
00036 
00037     gTimer (eTimerPrec aPrecision) ;
00038     virtual ~gTimer () ;
00039 
00040     // Public data-members
00041     double tic;
00042 
00043     // Get methods
00044     // .
00045 
00046     // Specific methods
00047     virtual double GetSecondsFromTics (t_gTicElapsed aElapsed) ;
00048     virtual double GetMilisecsFromTics (t_gTicElapsed aElapsed) {
00049         return GetSecondsFromTics( aElapsed )*1000.0;
00050     }
00051 
00052     // Set methods
00053     virtual void Start () ;
00054 
00055 protected:
00056     t_gTicElapsed ticStart, ticLast;
00057 
00058 private:
00059     // Operators,empty
00060     gTimer (gTimer& ) ; //empty
00061     gTimer& operator= (gTimer& ) ; //empty
00062 };
00063 ////////////////////////////////////////////////////////////
00064 class gTimerTic : public gTimer {
00065 public:
00066     gTimerTic () ;
00067     virtual ~gTimerTic () ;
00068 
00069     // Get methods
00070     virtual t_gTicElapsed CpuTics () ;
00071     virtual double GetElapsedMilisec () ;
00072     virtual t_uint32 GetMilisec () ;
00073     // .
00074 
00075     // Set methods
00076     virtual void Reset () ;
00077 
00078     // Specific methods
00079     void GetTimeNow (sTimeSeconds& aTime) {
00080         thisGetTime( aTime );
00081     }
00082     double GetMilisecsDiff (sTimeSeconds& aTime1, sTimeSeconds& aTime0) ;
00083 
00084 protected:
00085     t_gTicElapsed ticDiff;
00086     sTimeSeconds timeStart, timeEnd;
00087 
00088     int thisGetTime (sTimeSeconds& aTime) ;
00089 
00090 private:
00091     // Operators,empty
00092     gTimerTic (gTimerTic& ) ; //empty
00093     gTimerTic& operator= (gTimerTic& ) ; //empty
00094 };
00095 ////////////////////////////////////////////////////////////
00096 #endif //gTIME_X_H
00097 

Generated on Sat Aug 18 02:40:59 2007 for xpfweb_v2x lib by  doxygen 1.4.2