00001 #pragma ident "$Id: RinexObsHeader.hpp 2458 2010-09-03 14:19:23Z btolman $"
00002
00003
00004
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
00044 #ifndef GPSTK_RINEXOBSHEADER_HPP
00045 #define GPSTK_RINEXOBSHEADER_HPP
00046
00047 #include <vector>
00048 #include <list>
00049 #include <map>
00050 #include <iostream>
00051 #include <iomanip>
00052
00053 #include "DayTime.hpp"
00054 #include "FFStream.hpp"
00055 #include "RinexObsBase.hpp"
00056 #include "Triple.hpp"
00057 #include "RinexSatID.hpp"
00058
00059 namespace gpstk
00060 {
00063
00069 class RinexObsHeader : public RinexObsBase
00070 {
00071 public:
00072
00074 RinexObsHeader() : version(2.1), valid()
00075 {}
00076
00078 inline void clear()
00079 {
00080 version = 2.11;
00081 valid = 0;
00082 commentList.clear();
00083 wavelengthFactor[0] = wavelengthFactor[1] = 1;
00084 extraWaveFactList.clear();
00085 obsTypeList.clear();
00086 numObsForSat.clear();
00087 numObs = 0;
00088 lastPRN.id = -1;
00089 }
00090
00096 static const std::string versionString;
00097 static const std::string runByString;
00098 static const std::string commentString;
00099 static const std::string markerNameString;
00100 static const std::string markerNumberString;
00101 static const std::string observerString;
00102 static const std::string receiverString;
00103 static const std::string antennaTypeString;
00104 static const std::string antennaPositionString;
00105 static const std::string antennaOffsetString;
00106 static const std::string waveFactString;
00107 static const std::string numObsString;
00108 static const std::string intervalString;
00109 static const std::string firstTimeString;
00110 static const std::string lastTimeString;
00111 static const std::string receiverOffsetString;
00112 static const std::string leapSecondsString;
00113 static const std::string numSatsString;
00114 static const std::string prnObsString;
00115 static const std::string endOfHeader;
00116
00117
00119 enum validBits
00120 {
00121 versionValid = 0x01,
00122 runByValid = 0x02,
00123 commentValid = 0x04,
00124 markerNameValid = 0x08,
00125 markerNumberValid = 0x010,
00126 observerValid = 0x020,
00127 receiverValid = 0x040,
00128 antennaTypeValid = 0x080,
00129 antennaPositionValid = 0x0100,
00130 antennaOffsetValid = 0x0200,
00131 waveFactValid = 0x0400,
00132 obsTypeValid = 0x0800,
00133 intervalValid = 0x01000,
00134 firstTimeValid = 0x02000,
00135 lastTimeValid = 0x04000,
00136 receiverOffsetValid = 0x08000,
00137 leapSecondsValid = 0x0100000,
00138 numSatsValid = 0x0200000,
00139 prnObsValid = 0x0400000,
00140
00141 endValid = 0x080000000,
00142
00144 allValid20 = 0x080002FEB,
00146 allValid21 = 0x080002FEB,
00148 allValid211 = 0x080002FEB
00149 };
00150
00152 struct RinexObsType
00153 {
00154 std::string type;
00155 std::string description;
00156 std::string units;
00157 unsigned int depend;
00158 RinexObsType() : type(std::string("UN")),description(std::string("Unknown or Invalid")),
00159 units(std::string("")),depend(0) {}
00160 RinexObsType(std::string t, std::string d, std::string u, unsigned int dep=0) :
00161 type(t),description(d),units(u),depend(dep) {}
00162 static const unsigned int C1depend;
00163 static const unsigned int L1depend;
00164 static const unsigned int L2depend;
00165 static const unsigned int P1depend;
00166 static const unsigned int P2depend;
00167 static const unsigned int EPdepend;
00168 static const unsigned int PSdepend;
00169 };
00170
00174 static const RinexObsType UN;
00175 static const RinexObsType L1;
00176 static const RinexObsType L2;
00177 static const RinexObsType C1;
00178 static const RinexObsType C2;
00179 static const RinexObsType P1;
00180 static const RinexObsType P2;
00181 static const RinexObsType D1;
00182 static const RinexObsType D2;
00183 static const RinexObsType S1;
00184 static const RinexObsType S2;
00185 static const RinexObsType T1;
00186 static const RinexObsType T2;
00187 static const RinexObsType C5;
00188 static const RinexObsType L5;
00189 static const RinexObsType D5;
00190 static const RinexObsType S5;
00191
00192 static const RinexObsType C6;
00193 static const RinexObsType L6;
00194 static const RinexObsType D6;
00195 static const RinexObsType S6;
00196 static const RinexObsType C7;
00197 static const RinexObsType L7;
00198 static const RinexObsType D7;
00199 static const RinexObsType S7;
00200 static const RinexObsType C8;
00201 static const RinexObsType L8;
00202 static const RinexObsType D8;
00203 static const RinexObsType S8;
00204
00206
00207 static const std::vector<RinexObsType> StandardRinexObsTypes;
00208 static std::vector<RinexObsType> RegisteredRinexObsTypes;
00209
00211 struct ExtraWaveFact
00212 {
00214 std::vector<SatID> satList;
00216 short wavelengthFactor[2];
00217 };
00218
00222 double version;
00223 std::string fileType;
00224
00225 SatID system;
00226 std::string fileProgram,
00227 fileAgency,
00228 date;
00229 std::vector<std::string> commentList;
00230 std::string markerName,
00231 markerNumber;
00232 std::string observer,
00233 agency;
00234 std::string recNo,
00235 recType,
00236 recVers;
00237 std::string antNo,
00238 antType;
00239 gpstk::Triple antennaPosition;
00240 gpstk::Triple antennaOffset;
00241 short wavelengthFactor[2];
00242 std::vector<ExtraWaveFact> extraWaveFactList;
00243 std::vector<RinexObsType> obsTypeList;
00244 double interval;
00245 DayTime firstObs ;
00246 RinexSatID firstSystem;
00247 DayTime lastObs ;
00248 RinexSatID lastSystem;
00249 int receiverOffset;
00250 int leapSeconds;
00251 short numSVs;
00252 std::map<SatID, std::vector<int> > numObsForSat;
00253 unsigned long valid;
00254 int numObs;
00255 RinexSatID lastPRN;
00256
00257
00259 virtual ~RinexObsHeader() {}
00260
00261
00263 virtual bool isHeader() const {return true;}
00264
00270 virtual void dump(std::ostream& s) const;
00271
00275 static RinexObsType convertObsType(const std::string& oneObs)
00276 throw(FFStreamError);
00277
00281 static std::string convertObsType(const RinexObsType& oneObs)
00282 throw(FFStreamError);
00283
00288 void ParseHeaderRecord(std::string& line)
00289 throw(FFStreamError);
00290
00292 int NumberHeaderRecordsToBeWritten(void) const throw();
00293
00298 void WriteHeaderRecords(FFStream& s) const
00299 throw(FFStreamError, gpstk::StringUtils::StringException);
00300
00302 bool isValid() const { return ((valid & allValid20) == allValid20); }
00303
00304 protected:
00308 virtual void reallyPutRecord(FFStream& s) const
00309 throw(std::exception, FFStreamError,
00310 gpstk::StringUtils::StringException);
00311
00321 virtual void reallyGetRecord(FFStream& s)
00322 throw(std::exception, FFStreamError,
00323 gpstk::StringUtils::StringException);
00324
00325 friend class RinexObsData;
00326
00327 private:
00330 std::string writeTime(const DayTime& dt) const;
00331
00336 DayTime parseTime(const std::string& line) const;
00337
00338 };
00339
00341 inline bool operator==(const RinexObsHeader::RinexObsType& x,
00342 const RinexObsHeader::RinexObsType& y) { return (x.type == y.type); }
00343
00345 inline bool operator<(const RinexObsHeader::RinexObsType& x,
00346 const RinexObsHeader::RinexObsType& y) { return (x.type < y.type); }
00347
00349 inline std::ostream& operator<<(std::ostream& s,
00350 const RinexObsHeader::RinexObsType rot)
00351 {
00352 return s << "Type=" << rot.type
00353 << ", Description=" << rot.description
00354 << ", Units=" << rot.units;
00355 }
00356
00358 int RegisterExtendedRinexObsType(std::string t,
00359 std::string d=std::string("(undefined)"),
00360 std::string u=std::string("undefined"),
00361 unsigned int dep=0);
00362
00364 void DisplayStandardRinexObsTypes(std::ostream& s);
00365
00367 void DisplayExtendedRinexObsTypes(std::ostream& s);
00368
00370
00371 }
00372
00373 #endif