00001 #pragma ident "$Id: EpochClockModel.hpp 3140 2012-06-18 15:03:02Z susancummins $" 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 00020 // 00021 // Copyright 2004, The University of Texas at Austin 00022 // 00023 //============================================================================ 00024 00025 //============================================================================ 00026 // 00027 //This software developed by Applied Research Laboratories at the University of 00028 //Texas at Austin, under contract to an agency or agencies within the U.S. 00029 //Department of Defense. The U.S. Government retains all rights to use, 00030 //duplicate, distribute, disclose, or release this software. 00031 // 00032 //Pursuant to DoD Directive 523024 00033 // 00034 // DISTRIBUTION STATEMENT A: This software has been approved for public 00035 // release, distribution is unlimited. 00036 // 00037 //============================================================================= 00038 00039 #ifndef EPOCHCLOCKMODEL_HPP 00040 #define EPOCHCLOCKMODEL_HPP 00041 00042 #include <map> 00043 #include "Exception.hpp" 00044 #include "gps_constants.hpp" 00045 00046 #include "ObsClockModel.hpp" 00047 #include "ORDEpoch.hpp" 00048 00055 namespace gpstk 00056 { 00057 class EpochClockModel : public ObsClockModel 00058 { 00059 public: 00060 EpochClockModel(double sigma = 2, 00061 double elmask = 0, 00062 SvMode mode = ALWAYS) 00063 : ObsClockModel(sigma, elmask, mode), valid(false), clkc(0){} 00064 00065 virtual double getOffset(const gpstk::CommonTime& t) const 00066 throw(gpstk::InvalidArgumentException) 00067 { 00068 if (t!=time) 00069 { 00070 gpstk::InvalidArgumentException e; 00071 GPSTK_THROW(e); 00072 } 00073 return clkc; 00074 }; 00075 00076 virtual bool isOffsetValid(const gpstk::CommonTime& t) const 00077 throw(gpstk::InvalidArgumentException) 00078 { 00079 if (t!=time) 00080 { 00081 gpstk::InvalidArgumentException e; 00082 GPSTK_THROW(e); 00083 } 00084 return valid; 00085 }; 00086 00087 00088 // An unchecked accessor for programs that don't need the generic 00089 // interface 00090 double getOffset() const 00091 throw() {return clkc;}; 00092 00093 bool isOffsetValid() const 00094 throw() {return valid;}; 00095 00096 virtual void addEpoch(const ORDEpoch& oe) throw(gpstk::InvalidValue) 00097 { 00098 gpstk::Stats<double> stat = simpleOrdClock(oe); 00099 clkc = stat.Average(); 00100 valid = stat.N() >= 3; 00101 time = oe.time; 00102 } 00103 00104 private: 00105 gpstk::CommonTime time; 00106 double clkc; 00107 bool valid; 00108 }; 00109 } 00110 #endif
1.3.9.1