IonexHeader.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: IonexHeader.hpp 1398 2008-09-11 14:30:26Z coandrei $"
00002 
00008 #ifndef GPSTK_IONEXHEADER_HPP
00009 #define GPSTK_IONEXHEADER_HPP
00010 
00011 //============================================================================
00012 //
00013 //  This file is part of GPSTk, the GPS Toolkit.
00014 //
00015 //  The GPSTk is free software; you can redistribute it and/or modify
00016 //  it under the terms of the GNU Lesser General Public License as published
00017 //  by the Free Software Foundation; either version 2.1 of the License, or
00018 //  any later version.
00019 //
00020 //  The GPSTk is distributed in the hope that it will be useful,
00021 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //  GNU Lesser General Public License for more details.
00024 //
00025 //  You should have received a copy of the GNU Lesser General Public
00026 //  License along with GPSTk; if not, write to the Free Software Foundation,
00027 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //
00029 //  Octavian Andrei - FGI ( http://www.fgi.fi ). 2008
00030 //
00031 //============================================================================
00032 
00033 
00034 #include <string>
00035 #include <vector>
00036 #include <map>
00037 
00038 #include "DayTime.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          // Differential Code Bias structure
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                // update with the system char
00142             line[3] = system;
00143 
00144                // convert the prn into 2-digit string
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                // append bias and rms
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          }  // End of method 'DCB::toString()'
00165 
00166       }; // End of 'DCB' data structure
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       DayTime firstEpoch;           
00185       DayTime 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          // IonexHeader is a "header" so this function always returns true.
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          // Not sure how it helps (seen in SP3Header and RinexObsHeader)
00288       friend class IonexData;
00289 
00290 
00291 
00292    private:
00296       std::string writeTime(const DayTime& dt) const;
00297 
00298 
00303       DayTime parseTime(const std::string& line) const;
00304 
00305 
00306 
00307    }; // End of class 'IonexHeader'
00308 
00309 
00311 
00312 
00313 }  // End of namespace gpstk
00314 #endif   // GPSTK_IONEXHEADER_HPP

Generated on Tue May 22 03:30:58 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1