00001 // ===================================================================== 00002 // $Id: TSoftwareTimerModule.hh,v 1.3 2003/07/30 16:19:12 goiwai Exp $ 00003 // $Name: CLDAQ-1-07-00 $ 00004 // 00005 // $Log: TSoftwareTimerModule.hh,v $ 00006 // Revision 1.3 2003/07/30 16:19:12 goiwai 00007 // ファイルにコミットログをつけることにしました. 00008 // 00009 // ===================================================================== 00010 #ifndef __TSOFTWARETIMERMODULE_HH 00011 #define __TSOFTWARETIMERMODULE_HH 00012 00013 #include "Tglobals.h" 00014 #include "TSoftwareModule.hh" 00015 #include "TSystemTimer.hh" 00016 00017 class TDataElement; 00018 class TSystemTimer; 00019 00020 class TSoftwareTimerModule 00021 : public TSoftwareModule 00022 { 00023 00024 public: 00025 enum { 00026 tRealElapsedTime, 00027 tRealElapsedTimeTotal, 00028 tSystemElapsedTime, 00029 tUserElapsedTime, 00030 tUnit, 00031 tNumberOfChannels 00032 }; 00033 00034 private: 00035 TSystemTimer theSystemTimer; 00036 Tdouble theRealElapsedTimeTotal; 00037 00038 public: 00039 TSoftwareTimerModule( Tint nchannel = tNumberOfChannels, const Tstring& unit = Tmsec ); 00040 TSoftwareTimerModule( const Tstring& unit, Tint nchannel = tNumberOfChannels ); 00041 TSoftwareTimerModule( const TSoftwareTimerModule& right ); 00042 ~TSoftwareTimerModule(); 00043 00044 public: 00045 Tint Clear(); 00046 Tint Update(); 00047 Tint Initialize(); 00048 Tvoid FillData( TDataElement& element, Tint channel ); 00049 00050 public: 00051 Tvoid Start(); 00052 Tvoid Pause(); 00053 Tvoid Stop(); 00054 Tvoid Lap(); 00055 Tvoid Restart(); 00056 00057 public: 00058 const TSystemTimer& GetSystemTimer() const; 00059 TSystemTimer& GetSystemTimer(); 00060 Tvoid SetSystemTimer( const TSystemTimer& timer ); 00061 Tdouble GetRealElapsedTimeTotal() const; 00062 Tvoid SetRealElapsedTimeTotal( Tdouble time ); 00063 00064 public: 00065 const TSoftwareTimerModule& operator=( const TSoftwareTimerModule& right ); 00066 Tbool operator==( const TSoftwareTimerModule& right ) const; 00067 Tbool operator!=( const TSoftwareTimerModule& right ) const; 00068 00069 }; 00070 00071 inline const TSystemTimer& TSoftwareTimerModule::GetSystemTimer() const 00072 { 00073 return( theSystemTimer ); 00074 } 00075 00076 inline TSystemTimer& TSoftwareTimerModule::GetSystemTimer() 00077 { 00078 return( theSystemTimer ); 00079 } 00080 00081 inline Tvoid TSoftwareTimerModule::SetSystemTimer( const TSystemTimer& timer ) 00082 { 00083 theSystemTimer = timer; 00084 return; 00085 } 00086 00087 inline Tvoid TSoftwareTimerModule::Start() 00088 { 00089 theSystemTimer.Start(); 00090 return; 00091 } 00092 00093 inline Tvoid TSoftwareTimerModule::Pause() 00094 { 00095 theSystemTimer.Pause(); 00096 return; 00097 } 00098 00099 inline Tvoid TSoftwareTimerModule::Stop() 00100 { 00101 theSystemTimer.Stop(); 00102 theRealElapsedTimeTotal += theSystemTimer.GetRealElapsedTime(); 00103 return; 00104 } 00105 00106 inline Tvoid TSoftwareTimerModule::Lap() 00107 { 00108 theSystemTimer.Lap(); 00109 return; 00110 } 00111 00112 inline Tvoid TSoftwareTimerModule::Restart() 00113 { 00114 theSystemTimer.Restart(); 00115 return; 00116 } 00117 00118 inline Tdouble TSoftwareTimerModule::GetRealElapsedTimeTotal() const 00119 { 00120 return( theRealElapsedTimeTotal ); 00121 } 00122 00123 inline Tvoid TSoftwareTimerModule::SetRealElapsedTimeTotal( Tdouble time ) 00124 { 00125 theRealElapsedTimeTotal = time; 00126 return; 00127 } 00128 00129 #endif