00001
00002
00003
00004
00005 #ifndef __TSOFTWARECLOCKMODULE_HH
00006 #define __TSOFTWARECLOCKMODULE_HH
00007
00008 #include "Tglobals.h"
00009 #include "TSoftwareModule.hh"
00010 #include "TSystemClock.hh"
00011
00012 class TDataElement;
00013 class TSystemClock;
00014
00015 class TSoftwareClockModule
00016 : public TSoftwareModule
00017 {
00018 public:
00019 enum {
00020 tStringTime,
00021 tIntegerTime,
00022 tElapsedTimeOfLastInitialize,
00023 tElapsedTimeOfLastUpdate,
00024 tYear,
00025 tMonth,
00026 tDay,
00027 tHour,
00028 tMinute,
00029 tSecond,
00030 tNumberOfChannels
00031 };
00032
00033 private:
00034 TSystemClock theSystemClock;
00035
00036 public:
00037 TSoftwareClockModule( Tint nchannel = tNumberOfChannels );
00038 TSoftwareClockModule( const TSoftwareClockModule& right );
00039 ~TSoftwareClockModule();
00040
00041 public:
00042 const TSoftwareClockModule& operator=( const TSoftwareClockModule& right );
00043 Tbool operator==( const TSoftwareClockModule& right ) const;
00044 Tbool operator!=( const TSoftwareClockModule& right ) const;
00045
00046 public:
00047 Tint Clear();
00048 Tint Update();
00049 Tint Initialize();
00050 Tvoid FillData( TDataElement& element, Tint channel );
00051
00052 public:
00053 const TSystemClock& GetSystemClock() const;
00054 TSystemClock& GetSystemClock();
00055 Tvoid SetSystemClock( const TSystemClock& clock );
00056
00057 public:
00058 Tstring GetStringTime();
00059 Tint GetIntegerTime();
00060 Tstring WhatTimeIsItNow();
00061 Tstring WhatTimeIsIt( Tint second = -1 );
00062 Tint GetElapsedTimeOfLastInitialize( const Tstring& unit = Tsec );
00063 Tint GetElapsedTimeOfLastUpdate( const Tstring& unit = Tsec );
00064 Tint GetYear();
00065 Tint GetMonth();
00066 Tint GetDay();
00067 Tint GetHour();
00068 Tint GetMinute();
00069 Tint GetSecond();
00070
00071 };
00072
00073 inline const TSystemClock& TSoftwareClockModule::GetSystemClock() const
00074 {
00075 return( theSystemClock );
00076 }
00077
00078 inline TSystemClock& TSoftwareClockModule::GetSystemClock()
00079 {
00080 return( theSystemClock );
00081 }
00082
00083 inline Tvoid TSoftwareClockModule::SetSystemClock( const TSystemClock& clock )
00084 {
00085 theSystemClock = clock;
00086 return;
00087 }
00088
00089 inline Tstring TSoftwareClockModule::GetStringTime()
00090 {
00091 return( theSystemClock.WhatTimeIsItNow() );
00092 }
00093
00094 inline Tint TSoftwareClockModule::GetIntegerTime()
00095 {
00096 theSystemClock.Update();
00097 return( theSystemClock.GetTime() );
00098 }
00099
00100 inline Tstring TSoftwareClockModule::WhatTimeIsItNow()
00101 {
00102 return( theSystemClock.WhatTimeIsItNow() );
00103 }
00104
00105 inline Tstring TSoftwareClockModule::WhatTimeIsIt( Tint second )
00106 {
00107 return( theSystemClock.WhatTimeIsIt( second ) );
00108 }
00109
00110 inline Tint TSoftwareClockModule::GetYear()
00111 {
00112 return( theSystemClock.GetYear() );
00113 }
00114
00115 inline Tint TSoftwareClockModule::GetMonth()
00116 {
00117 return( theSystemClock.GetMonth() );
00118 }
00119
00120 inline Tint TSoftwareClockModule::GetDay()
00121 {
00122 return( theSystemClock.GetDay() );
00123 }
00124
00125 inline Tint TSoftwareClockModule::GetHour()
00126 {
00127 return( theSystemClock.GetHour() );
00128 }
00129
00130 inline Tint TSoftwareClockModule::GetMinute()
00131 {
00132 return( theSystemClock.GetMinute() );
00133 }
00134
00135 inline Tint TSoftwareClockModule::GetSecond()
00136 {
00137 return( theSystemClock.GetSecond() );
00138 }
00139
00140 inline Tint TSoftwareClockModule::GetElapsedTimeOfLastInitialize( const Tstring& unit )
00141 {
00142 return( theSystemClock.GetElapsedTime( unit ) );
00143 }
00144
00145 inline Tint TSoftwareClockModule::GetElapsedTimeOfLastUpdate( const Tstring& unit )
00146 {
00147 return( theSystemClock.GetElapsedTimeOfLastUpdate( unit ) );
00148 }
00149
00150 #endif