SatDataReader.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: SatDataReader.hpp 1718 2009-02-22 11:19:26Z architest $"
00002 
00008 #ifndef GPSTK_SATDATAREADER_HPP
00009 #define GPSTK_SATDATAREADER_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 ). 2007, 2009
00030 //
00031 //============================================================================
00032 
00033 
00034 
00035 
00036 #include <string>
00037 #include <map>
00038 #include "FFTextStream.hpp"
00039 #include "StringUtils.hpp"
00040 #include "DayTime.hpp"
00041 #include "SatID.hpp"
00042 
00043 
00044 using namespace std;
00045 
00046 namespace gpstk
00047 {
00050 
00086    class SatDataReader : public FFTextStream
00087    {
00088    public:
00089 
00091       SatDataReader() {}
00092 
00099       SatDataReader(const char* fn) : FFTextStream(fn, std::ios::in)
00100       { loadData(); }
00101 
00102 
00109       SatDataReader(const string& fn) : FFTextStream(fn.c_str(), std::ios::in)
00110       { loadData(); }
00111 
00112 
00114       virtual void open(const char* fn);
00115 
00116 
00118       virtual void open(const string& fn);
00119 
00120 
00122       virtual SatDataReader& clearData()
00123       { SatelliteData.clear(); return (*this); };
00124 
00125 
00135       virtual string getBlock(const SatID& sat,
00136                               const DayTime& epoch) const;
00137 
00138 
00148       virtual int getGPSNumber(const SatID& sat,
00149                                const DayTime& epoch) const;
00150 
00151 
00162       virtual DayTime getLaunchDate(const SatID& sat,
00163                                     const DayTime& epoch) const;
00164 
00165 
00176       virtual DayTime getDeactivationDate(const SatID& sat,
00177                                           const DayTime& epoch) const;
00178 
00179 
00181       virtual ~SatDataReader() {}
00182 
00183 
00184    private:
00185 
00186 
00188       struct svData
00189       {
00190             // Default constructor initializing the data in the structure
00191          svData() : launchDate(DayTime::BEGINNING_OF_TIME),
00192                     deactivationDate(DayTime::END_OF_TIME),
00193                     gpsNumber(0),
00194                     block("") {};
00195 
00196          DayTime launchDate;         
00197          DayTime deactivationDate;   
00198          int gpsNumber;              
00199          string block;               
00200       };
00201 
00202 
00204       typedef std::multimap<SatID, svData>::const_iterator satDataIt;
00205 
00206 
00208       std::multimap<SatID, svData> SatelliteData;
00209 
00210 
00215       void setData(const SatID& sat,
00216                    const svData& data)
00217       { SatelliteData.insert(pair<const SatID, svData>(sat, data)); }
00218 
00219 
00221       virtual void loadData(void)
00222          throw(FFStreamError, gpstk::StringUtils::StringException);
00223 
00224 
00225    }; // End of class 'SatDataReader'
00226 
00227 
00229 
00230 }  // End of namespace gpstk
00231 
00232 #endif  // GPSTK_SATDATAREADER_HPP

Generated on Thu Sep 9 03:30:55 2010 for GPS ToolKit Software Library by  doxygen 1.3.9.1