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

TSoftwareTimerModule.hh

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

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