SVExclusionList.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: SVExclusionList.hpp 81 2006-08-10 16:45:12Z ehagen $"
00002 
00003 
00004 
00005 //============================================================================
00006 //
00007 //  This file is part of GPSTk, the GPS Toolkit.
00008 //
00009 //  The GPSTk is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU Lesser General Public License as published
00011 //  by the Free Software Foundation; either version 2.1 of the License, or
00012 //  any later version.
00013 //
00014 //  The GPSTk is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with GPSTk; if not, write to the Free Software Foundation,
00021 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 
00028 
00029 
00057 #ifndef GPSTK_SVEXCLUSIONLIST_HPP
00058 #define GPSTK_SVEXCLUSIONLIST_HPP
00059 
00060 //
00061 #include <stdio.h>
00062 #include <fstream>
00063 #include <iostream>
00064 
00065 // std library
00066 #include <map>
00067 
00068 // gpstk
00069 #include "DayTime.hpp"
00070 #include "Exception.hpp"
00071 #include "gps_constants.hpp"
00072 
00073 namespace gpstk
00074 {
00075    class SVExclusion
00076    {
00077       public:
00078          SVExclusion( const gpstk::DayTime begin,
00079                       const gpstk::DayTime end, 
00080                       const int PRNID, 
00081                       const std::string commentArg );
00082          bool isApplicable( const int PRNID, const gpstk::DayTime dt ) const;
00083          std::string getComment() const;
00084          int getPRNID() const;
00085          gpstk::DayTime getBeginTime() const;
00086          gpstk::DayTime getEndTime() const;
00087          
00088       protected:
00089          int PRN_IDENTIFIER;
00090          gpstk::DayTime begExclude;
00091          gpstk::DayTime endExclude;
00092          std::string comment;
00093    };
00094 
00095       // For this first implementation, there will be a multimap 
00096       // organized by PRN.
00097       
00098    typedef std::multimap< int, SVExclusion >::const_iterator SVXListCI;
00099    typedef std::pair<SVXListCI,SVXListCI> SVXListPair;
00100       
00101    class SVExclusionList 
00102    {
00103       public:
00104          NEW_EXCEPTION_CLASS( NoSVExclusionFound , gpstk::Exception);
00105          NEW_EXCEPTION_CLASS( SVExclusionFileNotFound , gpstk::Exception);
00106          
00107          SVExclusionList( );
00108          SVExclusionList( std::string filename )
00109            throw(SVExclusionFileNotFound);
00110          void addFile( const std::string filename )
00111             throw(SVExclusionFileNotFound);
00112          bool isExcluded( const int PRN, const gpstk::DayTime dt ) const;
00113          void addExclusion( const SVExclusion );
00114          gpstk::DayTime getEarliestTime() const;
00115          gpstk::DayTime getLatestTime() const;
00116          int getNumberOfExclusions() const;
00117          const SVExclusion& getApplicableExclusion(
00118                             const int PRN, const gpstk::DayTime dt) 
00119                             const throw(NoSVExclusionFound);
00120          int numberOfReadFailures() const;
00121          void listOfReadFailures() const;       // List goes to cerr
00122          void listOfReadFailures( FILE* fpout ) const;
00123          void listOfReadFailures( std::ofstream fsout ) const;
00124          void dumpList( FILE* fp ) const;
00125          
00126       protected:
00127          gpstk::DayTime earliestTime;
00128          gpstk::DayTime latestTime;
00129          std::multimap< int, SVExclusion > exclusionMap;
00130          
00131          std::string timeSpecString;
00132          int readFailCount;
00133          std::list<std::string> readFailList;
00134 
00135          std::string buildFailString(const std::string s,
00136                      const int lineCount, const std::string filename );
00137    };
00138    
00139    inline gpstk::DayTime SVExclusionList::getEarliestTime() const
00140       { return(earliestTime); }
00141    inline gpstk::DayTime SVExclusionList::getLatestTime() const 
00142       { return(latestTime); }
00143    inline int SVExclusionList::getNumberOfExclusions() const
00144       { return(exclusionMap.size()); } 
00145    inline int SVExclusionList::numberOfReadFailures() const
00146       { return(readFailCount); }
00147       
00148    inline std::string SVExclusion::getComment() const {return(comment); }
00149    inline int SVExclusion::getPRNID() const { return(PRN_IDENTIFIER); }
00150    inline gpstk::DayTime SVExclusion::getBeginTime() const { return(begExclude); }
00151    inline gpstk::DayTime SVExclusion::getEndTime() const { return(endExclude); }
00152    
00153 }   
00154 #endif      

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