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

TSoftwareTimerModule.hh

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

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