00001 #pragma ident "$Id: IonexHeader.hpp 3140 2012-06-18 15:03:02Z susancummins $"
00002
00008 #ifndef GPSTK_IONEXHEADER_HPP
00009 #define GPSTK_IONEXHEADER_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 <string>
00035 #include <vector>
00036 #include <map>
00037
00038 #include "CommonTime.hpp"
00039 #include "SatID.hpp"
00040 #include "IonexBase.hpp"
00041
00042 namespace gpstk
00043 {
00044
00045
00048
00049
00056 class IonexHeader : public IonexBase
00057 {
00058 public:
00059
00061 IonexHeader() : version(1.0), exponent(-1), valid(false) {}
00062
00063
00065 void clear(void);
00066
00067
00073 static const std::string versionString;
00074 static const std::string runByString;
00075 static const std::string descriptionString;
00076 static const std::string commentString;
00077 static const std::string firstTimeString;
00078 static const std::string lastTimeString;
00079 static const std::string intervalString;
00080 static const std::string numMapsString;
00081 static const std::string mappingFunctionString;
00082 static const std::string elevationString;
00083 static const std::string observablesUsedString;
00084 static const std::string numStationsString;
00085 static const std::string numSatsString;
00086 static const std::string baseRadiusString;
00087 static const std::string mapDimensionString;
00088 static const std::string hgtGridString;
00089 static const std::string latGridString;
00090 static const std::string lonGridString;
00091 static const std::string exponentString;
00092 static const std::string startAuxDataString;
00093 static const std::string endAuxDataString;
00094 static const std::string endOfHeader;
00095
00096
00097
00098 struct DCB
00099 {
00100
00101 char system;
00102
00103
00104 int prn;
00105 double bias;
00106 double rms;
00107
00108
00110 DCB() : system('U'), prn(-1), bias(0), rms(0.0) {};
00111
00112
00121 DCB(char s, int p, double b, double r)
00122 : system(s), prn(p), bias(b), rms(r)
00123 {};
00124
00125
00131 static const std::string svsAuxDataString;
00132 static const std::string stationsAuxDataString;
00133
00134
00136 std::string toString() const throw()
00137 {
00138 std::string line(3, ' ');
00139 line += std::string(3, '0');
00140
00141
00142 line[3] = system;
00143
00144
00145 std::string s = StringUtils::asString(prn);
00146 if (prn < 10)
00147 {
00148 line[5] = s[0];
00149 }
00150 else
00151 {
00152 line[4] = s[0];
00153 line[5] = s[1];
00154 }
00155
00156
00157 line += StringUtils::rightJustify(
00158 StringUtils::asString(bias,3), 10 );
00159 line += StringUtils::rightJustify(
00160 StringUtils::asString(rms, 3), 10 );
00161
00162 return line;
00163
00164 }
00165
00166 };
00167
00168
00173 double version;
00174
00175 std::string fileType;
00176 std::string system;
00177 std::string fileProgram;
00178 std::string fileAgency;
00179 std::string date;
00180
00181 std::vector<std::string> descriptionList;
00182 std::vector<std::string> commentList;
00183
00184 CommonTime firstEpoch;
00185 CommonTime lastEpoch;
00186
00187 int interval;
00188 size_t numMaps;
00189 std::string mappingFunction;
00190 double elevation;
00191 std::string observablesUsed;
00192
00193 size_t numStations;
00194 size_t numSVs;
00195
00196 double baseRadius;
00197 size_t mapDims;
00198
00199 double hgt[3];
00200
00201
00202 double lat[3];
00203
00204 double lon[3];
00205
00206
00207 int exponent;
00208 std::string auxData;
00209
00211 typedef std::map<SatID,DCB> SatDCBMap;
00212
00213 SatDCBMap svsmap;
00214 bool auxDataFlag;
00215
00217 bool valid;
00219
00221 virtual ~IonexHeader() {};
00222
00223
00224
00225 virtual bool isHeader() const
00226 { return true; };
00227
00228
00234 virtual void dump(std::ostream& s = std::cout) const;
00235
00236
00241 void ParseDcbRecord(std::string &line)
00242 throw (FFStreamError);
00243
00244
00249 void ParseHeaderRecord(std::string& line)
00250 throw(FFStreamError);
00251
00252
00257 void WriteHeaderRecords(FFStream& s) const
00258 throw(FFStreamError, gpstk::StringUtils::StringException);
00259
00260
00261
00262 protected:
00263
00264
00269 virtual void reallyPutRecord(FFStream& s) const
00270 throw( std::exception, FFStreamError, StringUtils::StringException );
00271
00272
00283 virtual void reallyGetRecord(FFStream& s)
00284 throw( std::exception, FFStreamError, StringUtils::StringException);
00285
00286
00287
00288 friend class IonexData;
00289
00290
00291
00292 private:
00296 std::string writeTime(const CommonTime& dt) const;
00297
00298
00303 CommonTime parseTime(const std::string& line) const;
00304
00305
00306
00307 };
00308
00309
00311
00312
00313 }
00314 #endif // GPSTK_IONEXHEADER_HPP