00001
00028
00029 #ifndef CLDAQ__TSOFTWARECLOCKMODULE_HH
00030 #define CLDAQ__TSOFTWARECLOCKMODULE_HH
00031
00032 #include "Tglobals.h"
00033 #include "TSoftwareModule.hh"
00034 #include "TSystemClock.hh"
00035
00036 class TDataElement;
00037 class TSystemClock;
00038
00039
00059 class TSoftwareClockModule
00060 : public TSoftwareModule
00061 {
00062 public:
00063 enum {
00064 tStringTime,
00065 tIntegerTime,
00066 tElapsedTimeOfLastInitialize,
00067 tElapsedTimeOfLastUpdate,
00068 tYear,
00069 tMonth,
00070 tDay,
00071 tHour,
00072 tMinute,
00073 tSecond,
00074 tNumberOfChannels
00075 };
00076
00077 private:
00078 TSystemClock theSystemClock;
00079
00080 public:
00081 TSoftwareClockModule( Tint nchannel = tNumberOfChannels );
00082 TSoftwareClockModule( const TSoftwareClockModule& right );
00083 ~TSoftwareClockModule();
00084
00085 public:
00086 const TSoftwareClockModule& operator=( const TSoftwareClockModule& right );
00087 Tbool operator==( const TSoftwareClockModule& right ) const;
00088 Tbool operator!=( const TSoftwareClockModule& right ) const;
00089
00090 public:
00091 Tint Clear();
00092 Tint Update();
00093 Tint Initialize();
00094 Tvoid FillData( TDataElement& element, Tint channel );
00095
00096 public:
00097 const TSystemClock& GetSystemClock() const;
00098 TSystemClock& GetSystemClock();
00099 Tvoid SetSystemClock( const TSystemClock& clock );
00100
00101 public:
00102 Tstring GetStringTime();
00103 Tint GetIntegerTime();
00104 Tstring WhatTimeIsItNow();
00105 Tstring WhatTimeIsIt( Tint second = -1 );
00106 Tint GetElapsedTimeOfLastInitialize( const Tstring& unit = Tsec );
00107 Tint GetElapsedTimeOfLastUpdate( const Tstring& unit = Tsec );
00108 Tint GetYear();
00109 Tint GetMonth();
00110 Tint GetDay();
00111 Tint GetHour();
00112 Tint GetMinute();
00113 Tint GetSecond();
00114
00115 #ifdef __CLDAQ_ROOT_DLL
00116 ClassDef(TSoftwareClockModule,0)
00117 #endif
00118
00119 };
00120
00121 inline const TSystemClock& TSoftwareClockModule::GetSystemClock() const
00122 {
00123 return theSystemClock;
00124 }
00125
00126 inline TSystemClock& TSoftwareClockModule::GetSystemClock()
00127 {
00128 return theSystemClock;
00129 }
00130
00131 inline Tvoid TSoftwareClockModule::SetSystemClock( const TSystemClock& clock )
00132 {
00133 theSystemClock = clock;
00134 return;
00135 }
00136
00137 inline Tstring TSoftwareClockModule::GetStringTime()
00138 {
00139 return theSystemClock.WhatTimeIsItNow();
00140 }
00141
00142 inline Tint TSoftwareClockModule::GetIntegerTime()
00143 {
00144 theSystemClock.Update();
00145 return theSystemClock.GetTime();
00146 }
00147
00148 inline Tstring TSoftwareClockModule::WhatTimeIsItNow()
00149 {
00150 return theSystemClock.WhatTimeIsItNow();
00151 }
00152
00153 inline Tstring TSoftwareClockModule::WhatTimeIsIt( Tint second )
00154 {
00155 return theSystemClock.WhatTimeIsIt( second );
00156 }
00157
00158 inline Tint TSoftwareClockModule::GetYear()
00159 {
00160 return theSystemClock.GetYear();
00161 }
00162
00163 inline Tint TSoftwareClockModule::GetMonth()
00164 {
00165 return theSystemClock.GetMonth();
00166 }
00167
00168 inline Tint TSoftwareClockModule::GetDay()
00169 {
00170 return theSystemClock.GetDay();
00171 }
00172
00173 inline Tint TSoftwareClockModule::GetHour()
00174 {
00175 return theSystemClock.GetHour();
00176 }
00177
00178 inline Tint TSoftwareClockModule::GetMinute()
00179 {
00180 return theSystemClock.GetMinute();
00181 }
00182
00183 inline Tint TSoftwareClockModule::GetSecond()
00184 {
00185 return theSystemClock.GetSecond();
00186 }
00187
00188 inline Tint TSoftwareClockModule::GetElapsedTimeOfLastInitialize( const Tstring& unit )
00189 {
00190 return theSystemClock.GetElapsedTime( unit );
00191 }
00192
00193 inline Tint TSoftwareClockModule::GetElapsedTimeOfLastUpdate( const Tstring& unit )
00194 {
00195 return theSystemClock.GetElapsedTimeOfLastUpdate( unit );
00196 }
00197
00198 #endif