DiscCorr.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: DiscCorr.hpp 2293 2010-02-12 18:14:16Z btolman $"
00002 
00003 //============================================================================
00004 //
00005 //  This file is part of GPSTk, the GPS Toolkit.
00006 //
00007 //  The GPSTk is free software; you can redistribute it and/or modify
00008 //  it under the terms of the GNU Lesser General Public License as published
00009 //  by the Free Software Foundation; either version 2.1 of the License, or
00010 //  any later version.
00011 //
00012 //  The GPSTk is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU Lesser General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU Lesser General Public
00018 //  License along with GPSTk; if not, write to the Free Software Foundation,
00019 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //  
00021 //  Copyright 2004, The University of Texas at Austin
00022 //
00023 //============================================================================
00024 
00034 #ifndef GPSTK_DISCONTINUITY_CORRECTOR_INCLUDE
00035 #define GPSTK_DISCONTINUITY_CORRECTOR_INCLUDE
00036 
00037 #include "DayTime.hpp"
00038 #include "GSatID.hpp"
00039 #include "RinexObsHeader.hpp"
00040 #include "SatPass.hpp"
00041 #include "Exception.hpp"
00042 
00043 #include <iostream>
00044 #include <fstream>
00045 #include <sstream>
00046 #include <string>
00047 #include <vector>
00048 #include <map>
00049 
00050 namespace gpstk {
00051 
00054 
00057    class GDCconfiguration {
00058    public:
00060       GDCconfiguration(void) { initialize(); }
00061          // destructor
00062       ~GDCconfiguration(void) { CFG.clear(); CFGdescription.clear(); }
00063 
00067       void setParameter(std::string cmd) throw(gpstk::Exception);
00068 
00071       void setParameter(std::string label, double value) throw(gpstk::Exception);
00072 
00074       double getParameter(std::string label) throw() { return CFG[label]; }
00075 
00077       void setDebugStream(std::ostream& os) { p_oflog = &os; }
00078 
00082       void DisplayParameterUsage(std::ostream& os, bool advanced=false)
00083          throw(gpstk::Exception);
00084 
00086       std::string Version() throw() { return GDCVersion; }
00087 
00088    protected:
00089 
00091       std::map <std::string,double> CFG;
00092 
00094       std::map <std::string,std::string> CFGdescription;
00095 
00097       std::ostream *p_oflog;
00098 
00099       void initialize(void);
00100 
00101       static std::string GDCVersion;
00102 
00103    }; // end class GDCconfiguration
00104 
00109    class GDCreturn {
00110    public:
00112       explicit GDCreturn(std::string msg) {
00113          passN = -1;
00114          nGFslips = nWLslips = 0;
00115          nGFslipGross = nWLslipGross = 0;
00116          nGFslipSmall = nWLslipSmall = 0;
00117          WLsig = GFsig = 0.0;
00118 
00119          std::string::size_type pos;
00120          std::string word,line;
00121          std::vector<std::string> lines,words;
00122          if(msg.empty()) return;
00123          // split into lines
00124          while(1) {
00125             pos = msg.find_first_not_of("\n");
00126             if(pos > 0) msg.erase(0,pos);
00127             if(msg.empty()) break;
00128             pos = msg.find_first_of("\n");
00129             if(pos > 0) {
00130                word = msg.substr(0,pos);
00131                msg.erase(0,pos);
00132             }
00133             else {
00134                word = msg;
00135                msg.clear();
00136             }
00137             lines.push_back(word);
00138          }
00139 
00140          for(int i=0; i<lines.size(); i++) {
00141             line = lines[i];
00142             if(line.empty()) continue;
00143             // split line into words
00144             words.clear();
00145             while(1) {
00146                pos = line.find_first_not_of(" \t\n");
00147                if(pos != 0 && pos != std::string::npos) line.erase(0,pos);
00148                if(line.empty()) break;
00149                pos = line.find_first_of(" \t\n");
00150                if(pos == std::string::npos) word = line;
00151                else word = line.substr(0,pos);
00152                if(!word.empty()) {
00153                   words.push_back(word);
00154                   line.erase(0,word.length()+1);
00155                }
00156             }
00157 
00158             //std::cout << "Line " << i << ":";
00159             //for(int j=0; j<words.size(); j++) std::cout << " /" << words[j] << "/";
00160             //std::cout << std::endl;
00161 
00162             line = lines[i];
00163             //std::cout << line << std::endl;
00164             if(line.find("insufficient data",0) != std::string::npos)
00165                passN = strtol(words[1].c_str(),0,10);
00166             if(line.find("list of Segments",0) != std::string::npos)
00167                passN = strtol(words[1].c_str(),0,10);
00168             if(line.find("WL slip gross",0) != std::string::npos)
00169                nWLslipGross = strtol(words[3].c_str(),0,10);
00170             if(line.find("WL slip small",0) != std::string::npos)
00171                nWLslipSmall = strtol(words[3].c_str(),0,10);
00172             if(line.find("GF slip gross",0) != std::string::npos)
00173                nGFslipGross = strtol(words[3].c_str(),0,10);
00174             if(line.find("GF slip small",0) != std::string::npos)
00175                nGFslipSmall = strtol(words[3].c_str(),0,10);
00176             if(line.find("sigma GF variation",0) != std::string::npos)
00177                GFsig = strtod(words[3].c_str(),0);
00178             if(line.find("WL sigma in cycles",0) != std::string::npos)
00179                WLsig = strtod(words[3].c_str(),0);
00180          }
00181          nWLslips = nWLslipGross + nWLslipSmall;
00182          nGFslips = nGFslipGross + nGFslipSmall;
00183       }  // end constructor/parser
00184 
00185       int passN,nGFslips,nWLslips,nGFslipGross,nGFslipSmall,nWLslipGross,nWLslipSmall;
00186       double WLsig,GFsig;
00187    }; // end class GDCreturn
00188 
00210    int DiscontinuityCorrector(SatPass& SP,
00211                               GDCconfiguration& config,
00212                               std::vector<std::string>& EditCmds,
00213                               std::string& retMsg)
00214       throw(Exception);
00215 
00217 
00218 }  // end namespace gpstk
00219 
00220 //------------------------------------------------------------------------------------
00221 #endif

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