00001 #pragma ident "$Id: SourceID.hpp 1889 2009-05-11 15:47:23Z afarris $"
00002
00008 #ifndef GPSTK_SOURCEID_HPP
00009 #define GPSTK_SOURCEID_HPP
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 #include <iostream>
00035 #include <iomanip>
00036 #include <sstream>
00037 #include <string>
00038 #include <map>
00039
00040
00041
00042 namespace gpstk
00043 {
00044
00047 class SourceID
00048 {
00049 public:
00050
00052 enum SourceType
00053 {
00054 Unknown,
00055 GPS,
00056 Galileo,
00057 Glonass,
00058 Geosync,
00059 LEO,
00060 Transit,
00061 DGPS,
00062 RTK,
00063 INS,
00064 Mixed,
00065 Last,
00066 Placeholder = Last+1000
00067 };
00068
00069
00071 SourceID()
00072 : type(Unknown), sourceName("")
00073 {};
00074
00075
00077 SourceID( SourceType st,
00078 std::string name )
00079 : type(st), sourceName(name)
00080 {};
00081
00082
00084 SourceID(const SourceID& s)
00085 : type(s.type), sourceName(s.sourceName)
00086 {};
00087
00088
00090 virtual bool operator==(const SourceID& right) const;
00091
00092
00096 virtual bool operator<(const SourceID& right) const;
00097
00098
00100 bool operator!=(const SourceID& right) const
00101 { return !(operator==(right)); }
00102
00103
00105 bool operator>(const SourceID& right) const
00106 { return (!operator<(right) && !operator==(right)); }
00107
00108
00110 bool operator<=(const SourceID& right) const
00111 { return (operator<(right) || operator==(right)); }
00112
00113
00115 bool operator>=(const SourceID& right) const
00116 { return !(operator<(right)); }
00117
00118
00120 SourceID& operator=(const SourceID& right);
00121
00122
00124 virtual std::ostream& dump(std::ostream& s) const;
00125
00126
00129 virtual bool isValid() const;
00130
00131
00133 virtual ~SourceID() {};
00134
00135
00137 static SourceType newSourceType(const std::string& s);
00138
00139
00140
00141
00143 SourceType type;
00144
00145
00147 std::string sourceName;
00148
00149
00150 private:
00151
00152
00153 static std::map< SourceType, std::string > stStrings;
00154
00155
00156 public:
00157
00158 class Initializer
00159 {
00160 public:
00161 Initializer();
00162 };
00163
00164 static Initializer SourceIDsingleton;
00165
00166 };
00167
00168
00169
00170 namespace StringUtils
00171 {
00172
00174 std::string asString(const SourceID& p);
00175
00176 }
00177
00178
00179
00181 std::ostream& operator<<( std::ostream& s,
00182 const SourceID& p );
00183
00184
00185
00186 }
00187 #endif // GPSTK_SOURCEID_HPP