00001 #pragma ident "$Id: TimeSystem.hpp 3272 2012-08-11 01:53:21Z yanweignss $"
00002
00003 #ifndef GPSTK_TIMESYSTEM_HPP
00004 #define GPSTK_TIMESYSTEM_HPP
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <iostream>
00043 #include <string>
00044
00045 namespace gpstk
00046 {
00049 class TimeSystem
00050 {
00051 public:
00052
00054 enum Systems
00055 {
00056
00057
00058
00059
00060 Unknown = 0,
00061 Any,
00062 GPS,
00063 GLO,
00064 GAL,
00065 COM,
00066 UTC,
00067 UT1,
00068 TAI,
00069 TT,
00070
00071
00072 count
00073 };
00074
00076 TimeSystem(Systems sys = Unknown) throw()
00077 {
00078 if(sys < 0 || sys >= count)
00079 system = Unknown;
00080 else
00081 system = sys;
00082 }
00083
00085 TimeSystem(int i) throw()
00086 {
00087 if(i < 0 || i >= count)
00088 system = Unknown;
00089 else
00090 system = static_cast<Systems>(i);
00091 }
00092
00093
00094
00096 void setTimeSystem(const Systems& sys) throw();
00097
00099 Systems getTimeSystem() const throw()
00100 { return system; }
00101
00104 std::string asString() const throw()
00105 { return Strings[system]; }
00106
00109 void fromString(const std::string str) throw();
00110
00112 bool operator==(const TimeSystem& right) const throw()
00113 { return system == right.system; }
00114
00116 bool operator<(const TimeSystem& right) const throw()
00117 { return system < right.system; }
00118
00119
00121 bool operator!=(const TimeSystem& right) const throw()
00122 { return !operator==(right); }
00123
00125 bool operator>=(const TimeSystem& right) const throw()
00126 { return !operator<(right); }
00127
00129 bool operator<=(const TimeSystem& right) const throw()
00130 { return (operator<(right) || operator==(right)); }
00131
00133 bool operator>(const TimeSystem& right) const throw()
00134 { return (!operator<(right) && !operator==(right)); }
00135
00136 private:
00137
00139 Systems system;
00140
00142 static const std::string Strings[];
00143
00144 };
00145
00150 std::ostream& operator<<(std::ostream& os, const TimeSystem& ts);
00151
00152 }
00153
00154 #endif // GPSTK_TIMESYSTEM_HPP