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