AntexReader.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: AntexReader.hpp 2649 2011-06-09 17:21:12Z architest $"
00002 
00008 #ifndef GPSTK_ANTEXREADER_HPP
00009 #define GPSTK_ANTEXREADER_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 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2009, 2011
00030 //
00031 //============================================================================
00032 
00033 
00034 #include <string>
00035 #include <map>
00036 
00037 #include "Exception.hpp"
00038 #include "FFTextStream.hpp"
00039 #include "StringUtils.hpp"
00040 #include "DayTime.hpp"
00041 #include "SatID.hpp"
00042 #include "Antenna.hpp"
00043 
00044 
00045 using namespace std;
00046 
00047 namespace gpstk
00048 {
00049 
00052    NEW_EXCEPTION_CLASS(InvalidAntex, gpstk::Exception);
00053 
00054 
00057 
00119    class AntexReader : public FFTextStream
00120    {
00121    public:
00122 
00123 
00129       static const std::string versionString;      
00130       static const std::string pcvTypeString;      
00131       static const std::string commentString;      
00132       static const std::string endOfHeader;        
00133 
00134       static const std::string startOfAntenna;     
00135       static const std::string typeSerial;         
00136       static const std::string calibrationMethod;  
00137       static const std::string incrementAzimuth;   
00138       static const std::string zenithGrid;         
00139       static const std::string numberFreq;         
00140       static const std::string validFrom;          
00141       static const std::string validUntil;         
00142       static const std::string sinexCode;          
00143       static const std::string startOfFreq;        
00144       static const std::string antennaEcc;         
00145       static const std::string endOfFreq;          
00146       static const std::string startOfFreqRMS;     
00147       static const std::string antennaEccRMS;      
00148       static const std::string endOfFreqRMS;       
00149       static const std::string endOfAntenna;       
00150 
00151 
00152 
00154       enum pcvType
00155       {
00156          absolute = 1,           
00157          relative,               
00158          Unknown                 
00159       };
00160 
00161 
00163       AntexReader()
00164          : fileName(""), version(1.3), valid(false)
00165       {};
00166 
00167 
00174       AntexReader(const char* fn)
00175          : FFTextStream( fn, std::ios::in )
00176       { fileName = fn; loadHeader(); };
00177 
00178 
00185       AntexReader(const string& fn)
00186          : FFTextStream( fn.c_str(), std::ios::in )
00187       { fileName = fn; loadHeader(); };
00188 
00189 
00191       virtual void open(const char* fn);
00192 
00193 
00195       virtual void open(const string& fn);
00196 
00197 
00208       virtual Antenna getAntennaNoRadome(const string& model)
00209          throw(ObjectNotFound);
00210 
00211 
00226       virtual Antenna getAntenna(const string& model)
00227          throw(ObjectNotFound);
00228 
00229 
00242       virtual Antenna getAntenna( const string& model,
00243                                   const string& serial )
00244          throw(ObjectNotFound);
00245 
00246 
00261       virtual Antenna getAntenna( const string& model,
00262                                   const string& serial,
00263                                   const DayTime& epoch )
00264          throw(ObjectNotFound);
00265 
00266 
00280       virtual Antenna getAntenna( const string& serial,
00281                                   const DayTime& epoch )
00282          throw(ObjectNotFound);
00283 
00284 
00286       bool isValid() const
00287       { return valid; };
00288 
00289 
00291       double getVersion() const
00292       { return version; };
00293 
00294 
00296       bool isAbsolute() const;
00297 
00298 
00300       virtual void dump(std::ostream& s) const;
00301 
00302 
00304       virtual ~AntexReader() {};
00305 
00306 
00307    private:
00308 
00309 
00310          // Handy antenna data types
00311 
00312          // Validity:Antennas
00313       typedef std::map< DayTime, Antenna > ValAntMap;
00314 
00315          // Calibration:Validity:Antennas
00316       typedef std::map< string, ValAntMap > CalValAntMap;
00317 
00318          // Serial:Calibration:Validity:Antennas
00319       typedef std::map< string, CalValAntMap > SerCalValAntMap;
00320 
00321          // Radome:Serial:Calibration:Validity:Antennas
00322       typedef std::map< string, SerCalValAntMap > RSCalValAntMap;
00323 
00324          // Model:Radome:Serial:Calibration:Validity:Antennas
00325       typedef std::map< string, RSCalValAntMap > AntennaDataMap;
00326 
00327 
00329       AntennaDataMap antennaMap;
00330 
00331 
00333       string fileName;
00334 
00336       double version;
00337 
00339       SatID::SatelliteSystem system;
00340 
00342       pcvType type;
00343 
00345       std::string refAntena;
00346 
00348       std::string refAntenaSerial;
00349 
00351       std::vector<std::string> commentList;
00352 
00354       bool valid;
00355 
00356 
00358       string parseHeaderLine( const std::string& line )
00359          throw(InvalidAntex);
00360 
00361 
00363       Antenna fillAntennaData( const std::string& firstLine );
00364 
00365 
00367       virtual void loadHeader(void)
00368          throw( InvalidAntex,
00369                 FFStreamError,
00370                 gpstk::StringUtils::StringException );
00371 
00372 
00373    }; // End of class 'AntexReader'
00374 
00375 
00377    inline std::ostream& operator<<( std::ostream& s,
00378                                     const AntexReader& antread )
00379    {
00380 
00381          // Call dump() method
00382       antread.dump(s);
00383 
00384       return s;
00385 
00386    }  // End of operator '<<'
00387 
00389 
00390 }  // End of namespace gpstk
00391 
00392 #endif  // GPSTK_ANTEXREADER_HPP

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