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