RinexMetHeader.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: RinexMetHeader.hpp 438 2007-03-21 17:22:21Z btolman $"
00002 
00003 
00004 
00010 #ifndef GPSTK_RINEXMETHEADER_HPP
00011 #define GPSTK_RINEXMETHEADER_HPP
00012 
00013 //============================================================================
00014 //
00015 //  This file is part of GPSTk, the GPS Toolkit.
00016 //
00017 //  The GPSTk is free software; you can redistribute it and/or modify
00018 //  it under the terms of the GNU Lesser General Public License as published
00019 //  by the Free Software Foundation; either version 2.1 of the License, or
00020 //  any later version.
00021 //
00022 //  The GPSTk is distributed in the hope that it will be useful,
00023 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025 //  GNU Lesser General Public License for more details.
00026 //
00027 //  You should have received a copy of the GNU Lesser General Public
00028 //  License along with GPSTk; if not, write to the Free Software Foundation,
00029 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00030 //  
00031 //  Copyright 2004, The University of Texas at Austin
00032 //
00033 //============================================================================
00034 
00035 //============================================================================
00036 //
00037 //This software developed by Applied Research Laboratories at the University of
00038 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00039 //Department of Defense. The U.S. Government retains all rights to use,
00040 //duplicate, distribute, disclose, or release this software. 
00041 //
00042 //Pursuant to DoD Directive 523024 
00043 //
00044 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00045 //                           release, distribution is unlimited.
00046 //
00047 //=============================================================================
00048 
00049 
00050 
00051 
00052 
00053 
00054 #include "StringUtils.hpp"
00055 #include "FFStream.hpp"
00056 #include "RinexMetBase.hpp"
00057 
00058 #include "Triple.hpp"
00059 
00060 namespace gpstk
00061 {
00064 
00075    class RinexMetHeader : public RinexMetBase
00076    {
00077    public:
00079       enum RinexMetType 
00080       {
00081          PR,        
00082          TD,        
00083          HR,        
00084          ZW,        
00085          ZD,        
00086          ZT,        
00087          WD,        
00088          WS,        
00089          RI,        
00090          HI         
00091       };
00092 
00094       RinexMetHeader() : valid(0), version(2.1) {}
00095 
00097       virtual ~RinexMetHeader() {}
00098 
00099          // The next four lines is our common interface
00101       virtual bool isHeader(void) const {return true;}
00102 
00104       virtual void dump(std::ostream& s) const;
00105 
00107       static RinexMetType convertObsType(const std::string& oneObs) 
00108          throw(FFStreamError);
00109       
00111       static std::string convertObsType(const RinexMetType& oneObs)
00112          throw(FFStreamError);
00113    
00115       unsigned long valid;
00116 
00118       enum validBits
00119       {
00120          versionValid = 0x01,        
00121          runByValid = 0x02,          
00122          commentValid = 0x04,        
00123          markerNameValid = 0x08,     
00124          markerNumberValid = 0x010,  
00125          obsTypeValid = 0x020,        
00126          sensorTypeValid = 0x040,    
00127          sensorPosValid = 0x080,     
00128 
00129 
00130          endValid = 0x080000000,          
00131 
00134          allValid20 = 0x0800000EB,
00137          allValid21 = 0x0800000EB
00138       };
00139 
00140 
00141       static inline std::string bitsAsString(validBits b)
00142       {
00143          switch (b)
00144          {
00145             case versionValid:
00146                return versionString;
00147             case runByValid:
00148                return runByString;
00149             case commentValid:
00150                return commentString;
00151             case markerNameValid:
00152                return markerNameString;
00153             case markerNumberValid:
00154                return markerNumberString;
00155             case obsTypeValid:
00156                return obsTypeString;
00157             case sensorTypeValid:
00158                return sensorTypeString;
00159             case sensorPosValid:
00160                return sensorPosString;
00161             case endValid:
00162                return endOfHeader;
00163          }
00164 
00165          return "*UNKNOWN/INVALID BITS*";
00166       }
00167 
00168          /* @return a string composed the RINEX header strings
00169           * represented by the validBits set in vb, surrounded by the
00170           * quote character, separated by sep.
00171           * @param vb bit field with valid bits set
00172           * @param quote quote character to use around RINEX header strings.
00173           * @param sep separator used between rinex header strings.
00174           */
00175       static std::string bitString(unsigned long vb, char quote='\"',
00176                                    std::string sep=", ");
00177 
00178 
00180       struct sensorType
00181       {
00182          std::string model;         
00183          std::string type;          
00184          double accuracy;      
00185          RinexMetType obsType; 
00186       };
00187 
00189       struct sensorPosType
00190       {
00195          gpstk::Triple position;   
00196          double height;
00198          RinexMetType obsType;
00199       };
00200 
00204       double version;           
00205 
00206       std::string fileType;                      
00207       std::string fileProgram;                   
00208       std::string fileAgency;                    
00209       std::string date;                          
00210       std::vector<std::string> commentList;           
00211       std::string markerName;                    
00212       std::string markerNumber;                  
00213 
00220       std::vector<RinexMetType> obsTypeList;
00221       std::vector<sensorType> sensorTypeList;    
00222       std::vector<sensorPosType> sensorPosList;  
00223 
00225 
00226       static const int maxObsPerLine;       
00227 
00231       static const std::string versionString;       
00232       static const std::string runByString;         
00233       static const std::string commentString;       
00234       static const std::string markerNameString;    
00235       static const std::string markerNumberString;  
00236       static const std::string obsTypeString;       
00237       static const std::string sensorTypeString;    
00238       static const std::string sensorPosString;     
00239       static const std::string endOfHeader;         
00240 
00241 
00242    protected:
00244       virtual void reallyPutRecord(FFStream& s) const 
00245          throw(std::exception, FFStreamError,
00246                gpstk::StringUtils::StringException);
00247 
00257       virtual void reallyGetRecord(FFStream& s) 
00258          throw(std::exception, FFStreamError,
00259                gpstk::StringUtils::StringException);
00260 
00261 
00262    }; // class RinexMetHeader
00263 
00265 
00266 } // namespace
00267 
00268 #endif

Generated on Wed Feb 8 03:31:02 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1