00001 #pragma ident "$Id: TypeID.cpp 3310 2012-08-28 05:25:15Z yanweignss $"
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "TypeID.hpp"
00032
00033
00034 namespace gpstk
00035 {
00036
00037 std::map< TypeID::ValueType, std::string > TypeID::tStrings;
00038
00039
00040 TypeID::Initializer TypeIDsingleton;
00041
00042
00043 bool TypeID::bUserTypeIDRegistered = false;
00044
00045
00046 std::map<std::string,TypeID> TypeID::mapUserTypeID;
00047
00048
00049
00050 TypeID::Initializer::Initializer()
00051 {
00052 tStrings[Unknown] = "UnknownType";
00053 tStrings[C1] = "C1";
00054 tStrings[C2] = "C2";
00055 tStrings[P1] = "P1";
00056 tStrings[P2] = "P2";
00057 tStrings[L1] = "L1";
00058 tStrings[L2] = "L2";
00059 tStrings[D1] = "D1";
00060 tStrings[D2] = "D2";
00061 tStrings[S1] = "S1";
00062 tStrings[S2] = "S2";
00063 tStrings[T1] = "T1";
00064 tStrings[T2] = "T2";
00065 tStrings[SSI1] = "SSI1";
00066 tStrings[LLI1] = "LLI1";
00067 tStrings[SSI2] = "SSI2";
00068 tStrings[LLI2] = "LLI2";
00069 tStrings[C5] = "C5";
00070 tStrings[L5] = "L5";
00071 tStrings[D5] = "D5";
00072 tStrings[S5] = "S5";
00073 tStrings[SSI5] = "SSI5";
00074 tStrings[LLI5] = "LLI5";
00075 tStrings[C6] = "C6";
00076 tStrings[L6] = "L6";
00077 tStrings[D6] = "D6";
00078 tStrings[S6] = "S6";
00079 tStrings[SSI6] = "SSI6";
00080 tStrings[LLI6] = "LLI6";
00081 tStrings[C7] = "C7";
00082 tStrings[L7] = "L7";
00083 tStrings[D7] = "D7";
00084 tStrings[S7] = "S7";
00085 tStrings[SSI7] = "SSI7";
00086 tStrings[LLI7] = "LLI7";
00087 tStrings[C8] = "C8";
00088 tStrings[L8] = "L8";
00089 tStrings[D8] = "D8";
00090 tStrings[S8] = "S8";
00091 tStrings[SSI8] = "SSI8";
00092 tStrings[LLI8] = "LLI8";
00093 tStrings[PC] = "PC";
00094 tStrings[LC] = "LC";
00095 tStrings[PI] = "PI";
00096 tStrings[LI] = "LI";
00097 tStrings[Pdelta] = "Pdelta";
00098 tStrings[Ldelta] = "Ldelta";
00099 tStrings[MWubbena] = "MWubbena";
00100 tStrings[GRAPHIC1] = "GRAPHIC1";
00101 tStrings[GRAPHIC2] = "GRAPHIC2";
00102 tStrings[GRAPHIC5] = "GRAPHIC5";
00103 tStrings[GRAPHIC6] = "GRAPHIC6";
00104 tStrings[GRAPHIC7] = "GRAPHIC7";
00105 tStrings[GRAPHIC8] = "GRAPHIC8";
00106 tStrings[WL] = "WL";
00107 tStrings[WL1] = "WL1";
00108 tStrings[WL2] = "WL2";
00109 tStrings[WL3] = "WL3";
00110 tStrings[WL4] = "WL4";
00111 tStrings[EWL] = "EWL";
00112 tStrings[L1dot] = "L1dot";
00113 tStrings[L1dot2] = "L1dot2";
00114 tStrings[L2dot] = "L2dot";
00115 tStrings[L2dot2] = "L2dot2";
00116 tStrings[L5dot] = "L5dot";
00117 tStrings[L5dot2] = "L5dot2";
00118 tStrings[P1dot] = "P1dot";
00119 tStrings[P1dot2] = "P1dot2";
00120 tStrings[P2dot] = "P2dot";
00121 tStrings[P2dot2] = "P2dot2";
00122 tStrings[P5dot] = "P5dot";
00123 tStrings[P5dot2] = "P5dot2";
00124 tStrings[L6dot] = "L6dot";
00125 tStrings[L6dot2] = "L6dot2";
00126 tStrings[L7dot] = "L7dot";
00127 tStrings[L7dot2] = "L7dot2";
00128 tStrings[L8dot] = "L8dot";
00129 tStrings[L8dot2] = "L8dot2";
00130 tStrings[LCdot] = "LCdot";
00131 tStrings[LCdot2] = "LCdot2";
00132 tStrings[LIdot] = "LIdot";
00133 tStrings[LIdot2] = "LIdot2";
00134 tStrings[Ldeltadot] = "Ldeltadot";
00135 tStrings[Ldeltadot2] = "Ldeltadot2";
00136 tStrings[transmit] = "transmit";
00137 tStrings[rho] = "rho";
00138 tStrings[rhodot] = "rhodot";
00139 tStrings[rhodot2] = "rhodot2";
00140 tStrings[dtSat] = "dtSat";
00141 tStrings[dtSatdot] = "dtSatdot";
00142 tStrings[dtSatdot2] = "dtSatdot2";
00143 tStrings[rel] = "rel";
00144 tStrings[gravDelay] = "gravDelay";
00145 tStrings[tropo] = "tropo";
00146 tStrings[dryTropo] = "dryTropo";
00147 tStrings[dryMap] = "dryTropoMap";
00148 tStrings[wetTropo] = "wetTropo";
00149 tStrings[wetMap] = "wetTropoMap";
00150 tStrings[tropoSlant] = "slantTropo";
00151 tStrings[iono] = "verticalIono";
00152 tStrings[ionoTEC] = "TotalElectronContent";
00153 tStrings[ionoMap] = "ionoMap";
00154 tStrings[ionoMap2] = "ionoMap2";
00155 tStrings[ionoL1] = "slantIonoL1";
00156 tStrings[ionoL2] = "slantIonoL2";
00157 tStrings[ionoL5] = "slantIonoL5";
00158 tStrings[ionoL6] = "slantIonoL6";
00159 tStrings[ionoL7] = "slantIonoL7";
00160 tStrings[ionoL8] = "slantIonoL8";
00161 tStrings[windUp] = "windup";
00162 tStrings[satPCenter] = "satPhaseCenter";
00163 tStrings[satX] = "satX";
00164 tStrings[satY] = "satY";
00165 tStrings[satZ] = "satZ";
00166 tStrings[satVX] = "satVX";
00167 tStrings[satVY] = "satVY";
00168 tStrings[satVZ] = "satVZ";
00169 tStrings[satAX] = "satAX";
00170 tStrings[satAY] = "satAY";
00171 tStrings[satAZ] = "satAZ";
00172 tStrings[satJ2kX] = "satJ2kX";
00173 tStrings[satJ2kY] = "satJ2kY";
00174 tStrings[satJ2kZ] = "satJ2kZ";
00175 tStrings[satJ2kVX] = "satJ2kVX";
00176 tStrings[satJ2kVY] = "satJ2kVY";
00177 tStrings[satJ2kVZ] = "satJ2kVZ";
00178 tStrings[satJ2kAX] = "satJ2kAX";
00179 tStrings[satJ2kAY] = "satJ2kAY";
00180 tStrings[satJ2kAZ] = "satJ2kAZ";
00181 tStrings[elevation] = "elevation";
00182 tStrings[azimuth] = "azimuth";
00183
00184 tStrings[CSL1] = "CSL1";
00185 tStrings[CSL2] = "CSL2";
00186 tStrings[CSL5] = "CSL5";
00187 tStrings[CSL6] = "CSL6";
00188 tStrings[CSL7] = "CSL7";
00189 tStrings[CSL8] = "CSL8";
00190 tStrings[satArc] = "satArc";
00191 tStrings[BL1] = "ambiguityL1";
00192 tStrings[BL2] = "ambiguityL2";
00193 tStrings[BL5] = "ambiguityL5";
00194 tStrings[BL6] = "ambiguityL6";
00195 tStrings[BL7] = "ambiguityL7";
00196 tStrings[BL8] = "ambiguityL8";
00197 tStrings[BLC] = "ambiguityLC";
00198 tStrings[BWL] = "ambiguityWL";
00199 tStrings[BWL2] = "ambiguityWL2";
00200 tStrings[BWL3] = "ambiguityWL3";
00201 tStrings[BWL4] = "ambiguityWL4";
00202 tStrings[mpC1] = "multipathC1";
00203 tStrings[mpC2] = "multipathC2";
00204 tStrings[mpC5] = "multipathC5";
00205 tStrings[mpC6] = "multipathC6";
00206 tStrings[mpC7] = "multipathC7";
00207 tStrings[mpC8] = "multipathC8";
00208 tStrings[mpL1] = "multipathL1";
00209 tStrings[mpL2] = "multipathL2";
00210 tStrings[mpL5] = "multipathL5";
00211 tStrings[mpL6] = "multipathL6";
00212 tStrings[mpL7] = "multipathL7";
00213 tStrings[mpL8] = "multipathL8";
00214 tStrings[instC1] = "instrumentalC1";
00215 tStrings[instC2] = "instrumentalC2";
00216 tStrings[instC5] = "instrumentalC5";
00217 tStrings[instC6] = "instrumentalC6";
00218 tStrings[instC7] = "instrumentalC7";
00219 tStrings[instC8] = "instrumentalC8";
00220 tStrings[instL1] = "instrumentalL1";
00221 tStrings[instL2] = "instrumentalL2";
00222 tStrings[instL5] = "instrumentalL5";
00223 tStrings[instL6] = "instrumentalL6";
00224 tStrings[instL7] = "instrumentalL7";
00225 tStrings[instL8] = "instrumentalL8";
00226
00227 tStrings[prefitP1] = "prefitResidualCodeP1";
00228 tStrings[prefitP2] = "prefitResidualCodeP2";
00229 tStrings[prefitL1] = "prefitResidualPhaseL1";
00230 tStrings[prefitL2] = "prefitResidualPhaseL2";
00231 tStrings[postfitP1] = "postfitResidualCodeP1";
00232 tStrings[postfitP2] = "postfitResidualCodeP2";
00233 tStrings[postfitL1] = "postfitResidualPhaseL1";
00234 tStrings[postfitL2] = "postfitResidualPhaseL2";
00235
00236 tStrings[prefitC5] = "prefitResidualCodeC5";
00237 tStrings[prefitL5] = "prefitResidualPhaseL5";
00238 tStrings[postfitC5] = "postfitResidualCodeC5";
00239 tStrings[postfitL5] = "postfitResidualPhaseL5";
00240
00241 tStrings[prefitGRAPHIC1] = "prefitResidualGRAPHIC1";
00242 tStrings[prefitGRAPHIC2] = "prefitResidualGRAPHIC2";
00243 tStrings[postfitGRAPHIC1] = "postfitResidualGRAPHIC1";
00244 tStrings[postfitGRAPHIC2] = "postfitResidualGRAPHIC2";
00245 tStrings[prefitMWubbena] = "prefitMWubbena";
00246 tStrings[prefitWL] = "prefitResidualWL";
00247 tStrings[prefitWL2] = "prefitResidualWL2";
00248 tStrings[prefitWL3] = "prefitResidualWL3";
00249 tStrings[prefitWL4] = "prefitResidualWL4";
00250 tStrings[postfitWL] = "postfitResidualWL";
00251 tStrings[postfitWL2] = "postfitResidualWL2";
00252 tStrings[postfitWL3] = "postfitResidualWL3";
00253 tStrings[postfitWL4] = "postfitResidualWL4";
00254 tStrings[prefitC] = "prefitResidualCode";
00255 tStrings[prefitL] = "prefitResidualPhase";
00256 tStrings[postfitC] = "posfitResidualCode";
00257 tStrings[postfitL] = "posfitResidualPhase";
00258 tStrings[dx] = "dx";
00259 tStrings[dy] = "dy";
00260 tStrings[dz] = "dz";
00261 tStrings[cdt] = "cdt";
00262 tStrings[cdtSat] = "cdtSat";
00263 tStrings[dLat] = "dLat";
00264 tStrings[dLon] = "dLon";
00265 tStrings[dH] = "dH";
00266 tStrings[dSatX] = "dSatX";
00267 tStrings[dSatY] = "dSatY";
00268 tStrings[dSatZ] = "dSatZ";
00269 tStrings[dSatR] = "dSatR";
00270 tStrings[dSatT] = "dSatT";
00271 tStrings[dSatN] = "dSatN";
00272 tStrings[weight] = "weight";
00273 tStrings[codeBias] = "codeBias";
00274
00275 tStrings[cdtC1] = "cdtC1";
00276 tStrings[cdtP1] = "cdtP1";
00277 tStrings[cdtC2] = "cdtC2";
00278 tStrings[cdtP2] = "cdtP2";
00279 tStrings[cdtC5] = "cdtC5";
00280 tStrings[cdtP5] = "cdtP5";
00281 tStrings[cdtL1] = "cdtL1";
00282 tStrings[cdtL2] = "cdtL2";
00283 tStrings[cdtL5] = "cdtL5";
00284 tStrings[cdtPC] = "cdtPC";
00285 tStrings[cdtLC] = "cdtLC";
00286 tStrings[cdtWL] = "cdtWL";
00287 tStrings[cdtWL2] = "cdtWL2";
00288 tStrings[cdtWL3] = "cdtWL3";
00289 tStrings[cdtWL4] = "cdtWL4";
00290 tStrings[cdtMW] = "cdtMW";
00291
00292 tStrings[cdtSatC1] = "cdtSatC1";
00293 tStrings[cdtSatP1] = "cdtSatP1";
00294 tStrings[cdtSatC2] = "cdtSatC2";
00295 tStrings[cdtSatP2] = "cdtSatP2";
00296 tStrings[cdtSatC5] = "cdtSatC5";
00297 tStrings[cdtSatP5] = "cdtSatP5";
00298 tStrings[cdtSatL1] = "cdtSatL1";
00299 tStrings[cdtSatL2] = "cdtSatL2";
00300 tStrings[cdtSatL5] = "cdtSatL5";
00301 tStrings[cdtSatPC] = "cdtSatPC";
00302 tStrings[cdtSatLC] = "cdtSatLC";
00303 tStrings[cdtSatWL] = "cdtSatWL";
00304 tStrings[cdtSatMW] = "cdtSatMW";
00305
00306 tStrings[recX] = "RxPositionX";
00307 tStrings[recY] = "RxPositionY";
00308 tStrings[recZ] = "RxPositionZ";
00309 tStrings[recVX] = "RxVelocityX";
00310 tStrings[recVY] = "RxVelocityY";
00311 tStrings[recVZ] = "RxVelocityZ";
00312 tStrings[recAX] = "RxAccelerationX";
00313 tStrings[recAY] = "RxAccelerationY";
00314 tStrings[recAZ] = "RxAccelerationZ";
00315 tStrings[recLat] = "RxLat";
00316 tStrings[recLon] = "RxLon";
00317 tStrings[recH] = "RxH";
00318 tStrings[recVLat] = "RxVelocityLat";
00319 tStrings[recVLon] = "RxVelocityLon";
00320 tStrings[recVH] = "RxVelocityH";
00321 tStrings[recALat] = "RxAccelerationLat";
00322 tStrings[recALon] = "RxAccelerationLon";
00323 tStrings[recAH] = "RxAccelerationH";
00324 tStrings[recJ2kX] = "RxJ2kPositionX";
00325 tStrings[recJ2kY] = "RxJ2kPositionY";
00326 tStrings[recJ2kZ] = "RxJ2kPositionZ";
00327 tStrings[recJ2kVX] = "RxJ2kVelocityX";
00328 tStrings[recJ2kVY] = "RxJ2kVelocityY";
00329 tStrings[recJ2kVZ] = "RxJ2kVelocityZ";
00330 tStrings[recJ2kAX] = "RxJ2kAccelerationX";
00331 tStrings[recJ2kAY] = "RxJ2kAccelerationY";
00332 tStrings[recJ2kAZ] = "RxJ2kAccelerationZ";
00333 tStrings[sigma] = "sigma";
00334 tStrings[iura] = "iura";
00335 tStrings[Action] = "Action";
00336 tStrings[dummy0] = "dummy0";
00337 tStrings[dummy1] = "dummy1";
00338 tStrings[dummy2] = "dummy2";
00339 tStrings[dummy3] = "dummy3";
00340 tStrings[dummy4] = "dummy4";
00341 tStrings[dummy5] = "dummy5";
00342 tStrings[dummy6] = "dummy6";
00343 tStrings[dummy7] = "dummy7";
00344 tStrings[dummy8] = "dummy8";
00345 tStrings[dummy9] = "dummy9";
00346 tStrings[Last] = "Last";
00347 tStrings[Placeholder]= "Placeholder";
00348 }
00349
00350
00351
00352 TypeID TypeID::operator=(const TypeID& right)
00353 {
00354 if ( this == &right ) return (*this);
00355 (*this).type = right.type;
00356 return *this;
00357 }
00358
00359
00360
00361 std::ostream& TypeID::dump(std::ostream& s) const
00362 {
00363 s << TypeID::tStrings[type];
00364
00365 return s;
00366 }
00367
00368
00369
00370
00371 bool TypeID::isValid() const
00372 {
00373 return !(type==Unknown);
00374 }
00375
00376
00377
00378
00379
00380 TypeID::ValueType TypeID::newValueType(const std::string& s)
00381 {
00382 ValueType newId =
00383 static_cast<ValueType>(TypeID::tStrings.rbegin()->first + 1);
00384
00385 TypeID::tStrings[newId] = s;
00386
00387 return newId;
00388 }
00389
00390
00391 namespace StringUtils
00392 {
00393
00394
00395 std::string asString(const TypeID& p)
00396 {
00397 std::ostringstream oss;
00398 p.dump(oss);
00399 return oss.str();
00400 }
00401
00402 }
00403
00404
00405
00406 std::ostream& operator<<(std::ostream& s, const TypeID& p)
00407 {
00408 p.dump(s);
00409 return s;
00410 }
00411
00412
00413 bool IsCarrierPhase(const RinexObsHeader::RinexObsType& rot)
00414 {
00415 return (rot.type[0]=='L') ? true : false;
00416 }
00417
00418
00419 int GetCarrierBand(const RinexObsHeader::RinexObsType& rot)
00420 {
00421
00422 try
00423 {
00424 return StringUtils::asInt( rot.type.substr(1,1) );
00425 }
00426 catch(...)
00427 {
00428 return -1;
00429 }
00430 }
00431
00432 int GetCarrierBand(const RinexObsID& roi)
00433 {
00434
00435 if(roi.band == ObsID::cbL1) return 1;
00436 if(roi.band == ObsID::cbG1) return 1;
00437 if(roi.band == ObsID::cbE1) return 1;
00438
00439 if(roi.band == ObsID::cbL2) return 2;
00440 if(roi.band == ObsID::cbG2) return 2;
00441 if(roi.band == ObsID::cbE2) return 2;
00442
00443 if(roi.band == ObsID::cbL5) return 5;
00444
00445 if(roi.band == ObsID::cbE6) return 6;
00446 if(roi.band == ObsID::cbC6) return 6;
00447
00448 if(roi.band == ObsID::cbE5b) return 7;
00449
00450 if(roi.band == ObsID::cbE5ab) return 8;
00451
00452 return -1;
00453 }
00454
00455 TypeID::ValueType ConvertToTypeID(const RinexObsHeader::RinexObsType& rot,
00456 const RinexSatID& sat)
00457 {
00458 if(sat.system==SatID::systemGPS)
00459 {
00460
00461
00462
00463
00464
00465 if(rot == RinexObsHeader::C1) return TypeID::C1;
00466 if(rot == RinexObsHeader::P1) return TypeID::P1;
00467 if(rot == RinexObsHeader::L1) return TypeID::L1;
00468 if(rot == RinexObsHeader::D1) return TypeID::D1;
00469 if(rot == RinexObsHeader::S1) return TypeID::S1;
00470
00471 if(rot == RinexObsHeader::C2) return TypeID::C2;
00472 if(rot == RinexObsHeader::P2) return TypeID::P2;
00473 if(rot == RinexObsHeader::L2) return TypeID::L2;
00474 if(rot == RinexObsHeader::D2) return TypeID::D2;
00475 if(rot == RinexObsHeader::S2) return TypeID::S2;
00476
00477 if(rot == RinexObsHeader::C5) return TypeID::C5;
00478 if(rot == RinexObsHeader::L5) return TypeID::L5;
00479 if(rot == RinexObsHeader::D5) return TypeID::D5;
00480 if(rot == RinexObsHeader::S5) return TypeID::S5;
00481 }
00482 else if(sat.system==SatID::systemGlonass)
00483 {
00484
00485
00486
00487
00488 if(rot == RinexObsHeader::C1) return TypeID::C1;
00489 if(rot == RinexObsHeader::P1) return TypeID::P1;
00490 if(rot == RinexObsHeader::L1) return TypeID::L1;
00491 if(rot == RinexObsHeader::D1) return TypeID::D1;
00492 if(rot == RinexObsHeader::S1) return TypeID::S1;
00493
00494 if(rot == RinexObsHeader::C2) return TypeID::C2;
00495 if(rot == RinexObsHeader::P2) return TypeID::P2;
00496 if(rot == RinexObsHeader::L2) return TypeID::L2;
00497 if(rot == RinexObsHeader::D2) return TypeID::D2;
00498 if(rot == RinexObsHeader::S2) return TypeID::S2;
00499 }
00500 else if(sat.system==SatID::systemGalileo)
00501 {
00502
00503
00504
00505
00506
00507
00508 if(rot == RinexObsHeader::C1) return TypeID::C1;
00509 if(rot == RinexObsHeader::L1) return TypeID::L1;
00510 if(rot == RinexObsHeader::D1) return TypeID::D1;
00511 if(rot == RinexObsHeader::S1) return TypeID::S1;
00512
00513 if(rot == RinexObsHeader::C5) return TypeID::C5;
00514 if(rot == RinexObsHeader::L5) return TypeID::L5;
00515 if(rot == RinexObsHeader::D5) return TypeID::D5;
00516 if(rot == RinexObsHeader::S5) return TypeID::S5;
00517
00518 if(rot == RinexObsHeader::C7) return TypeID::C7;
00519 if(rot == RinexObsHeader::L7) return TypeID::L7;
00520 if(rot == RinexObsHeader::D7) return TypeID::D7;
00521 if(rot == RinexObsHeader::S7) return TypeID::S7;
00522
00523 if(rot == RinexObsHeader::C8) return TypeID::C8;
00524 if(rot == RinexObsHeader::L8) return TypeID::L8;
00525 if(rot == RinexObsHeader::D8) return TypeID::D8;
00526 if(rot == RinexObsHeader::S8) return TypeID::S8;
00527
00528 if(rot == RinexObsHeader::C6) return TypeID::C6;
00529 if(rot == RinexObsHeader::L6) return TypeID::L6;
00530 if(rot == RinexObsHeader::D6) return TypeID::D6;
00531 if(rot == RinexObsHeader::S6) return TypeID::S6;
00532 }
00533 else if(sat.system==SatID::systemCompass)
00534 {
00535
00536
00537
00538
00539
00540 if(rot == RinexObsHeader::C2) return TypeID::C2;
00541 if(rot == RinexObsHeader::L2) return TypeID::L2;
00542 if(rot == RinexObsHeader::D2) return TypeID::D2;
00543 if(rot == RinexObsHeader::S2) return TypeID::S2;
00544
00545 if(rot == RinexObsHeader::C7) return TypeID::C7;
00546 if(rot == RinexObsHeader::L7) return TypeID::L7;
00547 if(rot == RinexObsHeader::D7) return TypeID::D7;
00548 if(rot == RinexObsHeader::S7) return TypeID::S7;
00549
00550 if(rot == RinexObsHeader::C6) return TypeID::C6;
00551 if(rot == RinexObsHeader::L6) return TypeID::L6;
00552 if(rot == RinexObsHeader::D6) return TypeID::D6;
00553 if(rot == RinexObsHeader::S6) return TypeID::S6;
00554 }
00555 else if(sat.system==SatID::systemGeosync)
00556 {
00557
00558
00559
00560
00561 if(rot == RinexObsHeader::C1) return TypeID::C1;
00562 if(rot == RinexObsHeader::L1) return TypeID::L1;
00563 if(rot == RinexObsHeader::D1) return TypeID::D1;
00564 if(rot == RinexObsHeader::S1) return TypeID::S1;
00565
00566 if(rot == RinexObsHeader::C5) return TypeID::C5;
00567 if(rot == RinexObsHeader::L5) return TypeID::L5;
00568 if(rot == RinexObsHeader::D5) return TypeID::D5;
00569 if(rot == RinexObsHeader::S5) return TypeID::S5;
00570 }
00571
00572 return TypeID::Unknown;
00573 }
00574
00575
00576 TypeID::ValueType ConvertToTypeID(const RinexObsID& roi,
00577 const RinexSatID& sat)
00578 {
00579 if(sat.system==SatID::systemGPS)
00580 {
00581
00582
00583
00584
00585
00586 if(roi.band==ObsID::cbL1)
00587 {
00588 if(roi.type == ObsID::otRange)
00589 return (roi.code == ObsID::tcCA) ? TypeID::C1 : TypeID::P1;
00590
00591 if(roi.type == ObsID::otPhase) return TypeID::L1;
00592 if(roi.type == ObsID::otDoppler) return TypeID::D1;
00593 if(roi.type == ObsID::otSNR) return TypeID::S1;
00594 }
00595
00596 else if(roi.band==ObsID::cbL2)
00597 {
00598 if(roi.type == ObsID::otRange)
00599 return (roi.code == ObsID::tcCA) ? TypeID::C2 : TypeID::P2;
00600
00601 if(roi.type == ObsID::otPhase) return TypeID::L2;
00602 if(roi.type == ObsID::otDoppler) return TypeID::D2;
00603 if(roi.type == ObsID::otSNR) return TypeID::S2;
00604 }
00605
00606 else if(roi.band==ObsID::cbL5)
00607 {
00608 if(roi.type == ObsID::otRange) return TypeID::C5;
00609 if(roi.type == ObsID::otPhase) return TypeID::L5;
00610 if(roi.type == ObsID::otDoppler) return TypeID::D5;
00611 if(roi.type == ObsID::otSNR) return TypeID::S5;
00612 }
00613 }
00614 else if(sat.system==SatID::systemGlonass)
00615 {
00616
00617
00618
00619
00620 if(roi.band == ObsID::cbG1)
00621 {
00622 if(roi.type == ObsID::otRange)
00623 return (roi.code == ObsID::tcGCA) ? TypeID::C1 : TypeID::P1;
00624
00625 if(roi.type == ObsID::otPhase) return TypeID::L1;
00626 if(roi.type == ObsID::otDoppler) return TypeID::D1;
00627 if(roi.type == ObsID::otSNR) return TypeID::S1;
00628 }
00629
00630 else if(roi.band == ObsID::cbG1)
00631 {
00632 if(roi.type == ObsID::otRange)
00633 return (roi.code == ObsID::tcGCA) ? TypeID::C2 : TypeID::P2;
00634
00635 if(roi.type == ObsID::otPhase) return TypeID::L2;
00636 if(roi.type == ObsID::otDoppler) return TypeID::D2;
00637 if(roi.type == ObsID::otSNR) return TypeID::S2;
00638 }
00639 }
00640 else if(sat.system==SatID::systemGalileo)
00641 {
00642
00643
00644
00645
00646
00647
00648 if(roi.band == ObsID::cbL1)
00649 {
00650 if(roi.type == ObsID::otRange) return TypeID::C1;
00651 if(roi.type == ObsID::otPhase) return TypeID::L1;
00652 if(roi.type == ObsID::otDoppler) return TypeID::D1;
00653 if(roi.type == ObsID::otSNR) return TypeID::S1;
00654 }
00655 else if(roi.band == ObsID::cbL5)
00656 {
00657 if(roi.type == ObsID::otRange) return TypeID::C5;
00658 if(roi.type == ObsID::otPhase) return TypeID::L5;
00659 if(roi.type == ObsID::otDoppler) return TypeID::D5;
00660 if(roi.type == ObsID::otSNR) return TypeID::S5;
00661 }
00662 else if(roi.band == ObsID::cbE5b)
00663 {
00664 if(roi.type == ObsID::otRange) return TypeID::C7;
00665 if(roi.type == ObsID::otPhase) return TypeID::L7;
00666 if(roi.type == ObsID::otDoppler) return TypeID::D7;
00667 if(roi.type == ObsID::otSNR) return TypeID::S7;
00668 }
00669 else if(roi.band == ObsID::cbE5ab)
00670 {
00671 if(roi.type == ObsID::otRange) return TypeID::C8;
00672 if(roi.type == ObsID::otPhase) return TypeID::L8;
00673 if(roi.type == ObsID::otDoppler) return TypeID::D8;
00674 if(roi.type == ObsID::otSNR) return TypeID::S8;
00675 }
00676 else if(roi.band == ObsID::cbE6)
00677 {
00678 if(roi.type == ObsID::otRange) return TypeID::C6;
00679 if(roi.type == ObsID::otPhase) return TypeID::L6;
00680 if(roi.type == ObsID::otDoppler) return TypeID::D6;
00681 if(roi.type == ObsID::otSNR) return TypeID::S6;
00682 }
00683 }
00684 else if(sat.system==SatID::systemCompass)
00685 {
00686
00687
00688
00689
00690
00691
00692 if(roi.band == ObsID::cbE2)
00693 {
00694 if(roi.type == ObsID::otRange) return TypeID::C2;
00695 if(roi.type == ObsID::otPhase) return TypeID::L2;
00696 if(roi.type == ObsID::otDoppler) return TypeID::D2;
00697 if(roi.type == ObsID::otSNR) return TypeID::S2;
00698 }
00699 else if(roi.band == ObsID::cbE5b)
00700 {
00701 if(roi.type == ObsID::otRange) return TypeID::C7;
00702 if(roi.type == ObsID::otPhase) return TypeID::L7;
00703 if(roi.type == ObsID::otDoppler) return TypeID::D7;
00704 if(roi.type == ObsID::otSNR) return TypeID::S7;
00705 }
00706 else if(roi.band == ObsID::cbE6)
00707 {
00708 if(roi.type == ObsID::otRange) return TypeID::C6;
00709 if(roi.type == ObsID::otPhase) return TypeID::L6;
00710 if(roi.type == ObsID::otDoppler) return TypeID::D6;
00711 if(roi.type == ObsID::otSNR) return TypeID::S6;
00712 }
00713 }
00714 else if(sat.system==SatID::systemGeosync)
00715 {
00716
00717
00718
00719
00720 if(roi.band == ObsID::cbL1)
00721 {
00722 if(roi.type == ObsID::otRange) return TypeID::C1;
00723 if(roi.type == ObsID::otPhase) return TypeID::L1;
00724 if(roi.type == ObsID::otDoppler) return TypeID::D1;
00725 if(roi.type == ObsID::otSNR) return TypeID::S1;
00726 }
00727 else if(roi.band == ObsID::cbL5)
00728 {
00729 if(roi.type == ObsID::otRange) return TypeID::C5;
00730 if(roi.type == ObsID::otPhase) return TypeID::L5;
00731 if(roi.type == ObsID::otDoppler) return TypeID::D5;
00732 if(roi.type == ObsID::otSNR) return TypeID::S5;
00733 }
00734 }
00735
00736 return TypeID::Unknown;
00737 }
00738
00739
00740
00741 TypeID TypeID::regByName(std::string name,std::string desc)
00742 {
00743
00744 std::map<std::string,TypeID>::iterator it = mapUserTypeID.find(name);
00745
00746 if(it != mapUserTypeID.end())
00747 {
00748 return it->second;
00749 }
00750 else
00751 {
00752 TypeID newID = TypeID::newValueType(desc);
00753
00754 mapUserTypeID.insert(std::pair<std::string,TypeID>(name, newID));
00755
00756 return newID;
00757 }
00758
00759 }
00760
00761
00762
00763
00764 void TypeID::unregByName(std::string name)
00765 {
00766 std::map<std::string,TypeID>::iterator it = mapUserTypeID.find(name);
00767
00768 if(it!=mapUserTypeID.end())
00769 {
00770 TypeID delID = it->second;
00771
00772 std::map<TypeID::ValueType,std::string>::iterator it2 = TypeID::tStrings.find(delID.type);
00773 if(it2!=TypeID::tStrings.end())
00774 {
00775 TypeID::tStrings.erase(it2);
00776 }
00777
00778 mapUserTypeID.erase(it);
00779 }
00780 else
00781 {
00782
00783
00784 }
00785
00786 }
00787
00788
00789
00790
00791 void TypeID::unregAll()
00792 {
00793 std::map<std::string,TypeID>::iterator it = mapUserTypeID.begin();
00794
00795 for(it=mapUserTypeID.begin(); it!=mapUserTypeID.end(); it++)
00796 {
00797 TypeID delID = it->second;
00798
00799 std::map<TypeID::ValueType,std::string>::iterator it2 = TypeID::tStrings.find(delID.type);
00800 if(it2!=TypeID::tStrings.end())
00801 {
00802 TypeID::tStrings.erase(it2);
00803 }
00804 }
00805 mapUserTypeID.clear();
00806
00807 bUserTypeIDRegistered = false;
00808
00809 }
00810
00811
00812 TypeID TypeID::byName(std::string name)
00813 throw(InvalidRequest)
00814 {
00815
00816
00817 std::map<std::string,TypeID>::iterator it = mapUserTypeID.find(name);
00818 if(it != mapUserTypeID.end())
00819 {
00820 return it->second;
00821 }
00822 else
00823 {
00824 InvalidRequest e("There are no registered TypeID name as '"
00825 + name + "'.");
00826 GPSTK_THROW(e);
00827 }
00828 }
00829
00830 }