メインページ   モジュール   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TSoftwareTimerModule.hh

解説を見る。
00001 // =====================================================================
00021 // =====================================================================
00022 #ifndef __TSOFTWARETIMERMODULE_HH
00023 #define __TSOFTWARETIMERMODULE_HH
00024 
00025 #include "Tglobals.h"
00026 #include "TSoftwareModule.hh"
00027 #include "TSystemTimer.hh"
00028 
00029 class TDataElement;
00030 class TSystemTimer;
00031 
00032 
00052 class TSoftwareTimerModule
00053   : public TSoftwareModule
00054 {
00055 
00056   public:
00057     enum { 
00058       tRealElapsedTime,
00059       tRealElapsedTimeTotal,
00060       tSystemElapsedTime,
00061       tUserElapsedTime,
00062       tUnit,
00063       tNumberOfChannels
00064     };
00065 
00066   private:
00067     TSystemTimer theSystemTimer;
00068     Tdouble theRealElapsedTimeTotal;
00069 
00070   public:
00071     TSoftwareTimerModule( Tint nchannel = tNumberOfChannels, const Tstring& unit = Tmsec );
00072     TSoftwareTimerModule( const Tstring& unit, Tint nchannel = tNumberOfChannels );
00073     TSoftwareTimerModule( const TSoftwareTimerModule& right );
00074     ~TSoftwareTimerModule();
00075 
00076   public:
00077     Tint Clear();
00078     Tint Update();
00079     Tint Initialize();
00080     Tvoid FillData( TDataElement& element, Tint channel );
00081 
00082   public:
00083     Tvoid Start();
00084     Tvoid Pause();
00085     Tvoid Stop();
00086     Tvoid Lap();
00087     Tvoid Restart();
00088 
00089   public:
00090     const TSystemTimer& GetSystemTimer() const;
00091     TSystemTimer& GetSystemTimer();
00092     Tvoid SetSystemTimer( const TSystemTimer& timer );
00093     Tdouble GetRealElapsedTimeTotal() const;
00094     Tvoid SetRealElapsedTimeTotal( Tdouble time );
00095 
00096   public:
00097     const TSoftwareTimerModule& operator=( const TSoftwareTimerModule& right );
00098     Tbool operator==( const TSoftwareTimerModule& right ) const;
00099     Tbool operator!=( const TSoftwareTimerModule& right ) const;
00100 
00101 };
00102 
00103 inline const TSystemTimer& TSoftwareTimerModule::GetSystemTimer() const
00104 {
00105   return theSystemTimer;
00106 }
00107 
00108 inline TSystemTimer& TSoftwareTimerModule::GetSystemTimer()
00109 {
00110   return theSystemTimer;
00111 }
00112 
00113 inline Tvoid TSoftwareTimerModule::SetSystemTimer( const TSystemTimer& timer )
00114 {
00115   theSystemTimer = timer;
00116   return;
00117 }
00118 
00119 inline Tvoid TSoftwareTimerModule::Start()
00120 {
00121   theSystemTimer.Start();
00122   return;
00123 }
00124 
00125 inline Tvoid TSoftwareTimerModule::Pause()
00126 {
00127   theSystemTimer.Pause();
00128   return;
00129 }
00130 
00131 inline Tvoid TSoftwareTimerModule::Stop()
00132 {
00133   theSystemTimer.Stop();
00134   theRealElapsedTimeTotal += theSystemTimer.GetRealElapsedTime();
00135   return;
00136 }
00137 
00138 inline Tvoid TSoftwareTimerModule::Lap()
00139 {
00140   theSystemTimer.Lap();
00141   return;
00142 }
00143 
00144 inline Tvoid TSoftwareTimerModule::Restart()
00145 {
00146   theSystemTimer.Restart();
00147   return;
00148 }
00149 
00150 inline Tdouble TSoftwareTimerModule::GetRealElapsedTimeTotal() const
00151 {
00152   return theRealElapsedTimeTotal;
00153 }
00154 
00155 inline Tvoid TSoftwareTimerModule::SetRealElapsedTimeTotal( Tdouble time )
00156 {
00157   theRealElapsedTimeTotal = time;
00158   return;
00159 }
00160 
00161 #endif

CLDAQ - a Class Library for Data AcQuisition (Version 1.11.0)
Go IWAI <goiwai@users.sourceforge.jp>