00001 #pragma ident "$Id: SatID.hpp 3184 2012-07-01 13:11:07Z yanweignss $"
00002
00003 #ifndef GPSTK_SATID_HPP
00004 #define GPSTK_SATID_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 <iomanip>
00044 #include <sstream>
00045 #include "gps_constants.hpp"
00046
00052 namespace gpstk
00053 {
00054
00055 class SatID;
00056
00057
00060 class SatID
00061 {
00062 public:
00064 enum SatelliteSystem
00065 {
00066 systemGPS = 1,
00067 systemGalileo,
00068 systemGlonass,
00069 systemGeosync,
00070 systemLEO,
00071 systemTransit,
00072 systemCompass,
00073 systemMixed,
00074 systemUserDefined,
00075 systemUnknown
00076 };
00077
00079 SatID() { id=-1; system=systemGPS; }
00080
00084 SatID(int p, SatelliteSystem s) { id=p; system=s; }
00085
00086
00087
00089 static std::string convertSatelliteSystemToString(SatelliteSystem s)
00090 {
00091 switch(s)
00092 {
00093 case systemGPS: return "GPS"; break;
00094 case systemGalileo: return "Galileo"; break;
00095 case systemGlonass: return "GLONASS"; break;
00096 case systemGeosync: return "Geostationary"; break;
00097 case systemLEO: return "LEO"; break;
00098 case systemTransit: return "Transit"; break;
00099 case systemCompass: return "Compass"; break;
00100 case systemMixed: return "Mixed"; break;
00101 case systemUserDefined: return "UserDefined"; break;
00102 case systemUnknown: return "Unknown"; break;
00103 default: return "??"; break;
00104 };
00105 }
00106
00108 void dump(std::ostream& s) const
00109 {
00110 s << convertSatelliteSystemToString(system) << " " << id;
00111 }
00112
00114 bool operator==(const SatID& right) const
00115 { return ((system == right.system) && (id == right.id)); }
00116
00118 bool operator!=(const SatID& right) const
00119 { return !(operator==(right)); }
00120
00122 bool operator<(const SatID& right) const
00123 {
00124 if (system==right.system)
00125 return (id<right.id);
00126 return (system<right.system);
00127 }
00128
00130 bool operator>(const SatID& right) const
00131 { return (!operator<(right) && !operator==(right)); }
00132
00134 bool operator<=(const SatID& right) const
00135 { return (operator<(right) || operator==(right)); }
00136
00138 bool operator>=(const SatID& right) const
00139 { return !(operator<(right)); }
00140
00145 bool isValid() const
00146 {
00147 switch(system)
00148 {
00149 case systemGPS: return (id > 0 && id <= MAX_PRN_GPS);
00150
00151
00152
00153
00154
00155 default: return (id > 0 && id < 100);
00156 }
00157 }
00158
00159 int id;
00160 SatelliteSystem system;
00161
00162 };
00163
00164 namespace StringUtils
00165 {
00166 inline std::string asString(const SatID& p)
00167 {
00168 std::ostringstream oss;
00169 p.dump(oss);
00170 return oss.str();
00171 }
00172 }
00173
00175 inline std::ostream& operator<<(std::ostream& s, const SatID& p)
00176 {
00177 p.dump(s);
00178 return s;
00179 }
00180
00181 }
00182
00183 #endif