00001 #pragma ident "$Id: CivilTime.hpp 1162 2008-03-27 21:18:13Z snelsen $"
00002
00003
00004
00005 #ifndef GPSTK_CIVILTIME_HPP
00006 #define GPSTK_CIVILTIME_HPP
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "TimeTag.hpp"
00031
00032 namespace gpstk
00033 {
00039 class CivilTime : public TimeTag
00040 {
00041 public:
00051 CivilTime( int yr = 0,
00052 int mo = 0,
00053 int dy = 0,
00054 int hr = 0,
00055 int mn = 0,
00056 double s = 0.0 )
00057 throw()
00058 : year(yr), month(mo), day(dy), hour(hr), minute(mn), second(s)
00059 {}
00060
00065 CivilTime( const CivilTime& right )
00066 throw()
00067 : year( right.year ), month( right.month ), day( right.day ),
00068 hour( right.hour ), minute( right.minute ),
00069 second( right.second )
00070 {}
00071
00079 CivilTime( const TimeTag& right )
00080 throw( InvalidRequest )
00081 {
00082 convertFromCommonTime( right.convertToCommonTime() );
00083 }
00084
00092 CivilTime( const CommonTime& right )
00093 throw()
00094 {
00095 convertFromCommonTime( right );
00096 }
00097
00103 CivilTime& operator=( const CivilTime& right )
00104 throw();
00105
00107 virtual ~CivilTime()
00108 throw()
00109 {}
00111
00113 static const char *MonthNames[];
00114
00116 static const char *MonthAbbrevNames[];
00117
00118
00119 virtual CommonTime convertToCommonTime() const
00120 throw( InvalidRequest );
00121
00122 virtual void convertFromCommonTime( const CommonTime& ct )
00123 throw();
00124
00127 virtual std::string printf(const std::string& fmt) const
00128 throw( gpstk::StringUtils::StringException );
00129
00132 virtual std::string printError( const std::string& fmt) const
00133 throw( gpstk::StringUtils::StringException );
00134
00141 virtual bool setFromInfo( const IdToValue& info )
00142 throw();
00143
00146 virtual std::string getPrintChars() const
00147 throw()
00148 {
00149 return "YymbBdHMSf";
00150 }
00151
00153 virtual std::string getDefaultFormat() const
00154 throw()
00155 {
00156 return "%02m/%02d/%04Y %02H:%02M:%02S";
00157 }
00158
00159 virtual bool isValid() const
00160 throw();
00161
00162 virtual void reset()
00163 throw();
00164
00173 bool operator==( const CivilTime& right ) const
00174 throw();
00175 bool operator!=( const CivilTime& right ) const
00176 throw();
00177 bool operator<( const CivilTime& right ) const
00178 throw();
00179 bool operator>( const CivilTime& right ) const
00180 throw();
00181 bool operator<=( const CivilTime& right ) const
00182 throw();
00183 bool operator>=( const CivilTime& right ) const
00184 throw();
00186
00187 int year;
00188 int month;
00189 int day;
00190 int hour;
00191 int minute;
00192 double second;
00193
00194 };
00195
00196 }
00197
00198 #endif