ObsID.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: ObsID.hpp 1901 2009-05-20 12:47:43Z ocibu $"
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 
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 
00049 #ifndef OBSID_HPP
00050 #define OBSID_HPP
00051 
00052 #include <iostream>
00053 #include <iomanip>
00054 #include <sstream>
00055 #include <string>
00056 #include <map>
00057 
00058 #include "Exception.hpp"
00059 #include "SatID.hpp"
00060 
00061 namespace gpstk
00062 {
00063    class ObsID;
00064    namespace StringUtils
00065    {
00067       std::string asString(const ObsID& id);
00068       std::string asRinex3ID(const ObsID& id);
00069    }
00070 
00071 
00073    std::ostream& operator<<(std::ostream& s, const ObsID& p);
00074 
00075 
00076    class ObsID
00077    {
00078    public:
00080       enum ObservationType
00081       {
00082          otUnknown,
00083          otAny,       
00084          otRange,     
00085          otPhase,     
00086          otDoppler,   
00087          otSNR,       
00088          otChannel,   
00089          otIono,      
00090          otSSI,       
00091          otLLI,       
00092          otTrackLen,  
00093          otUndefined,
00094          otLast       
00095       };
00096 
00097 
00099       enum CarrierBand
00100       {
00101          cbUnknown,
00102          cbAny,  
00103          cbZero, 
00104          cbL1,   
00105          cbL2,   
00106          cbL5,   
00107          cbG1,   
00108          cbG2,   
00109          cbE5b,  
00110          cbE5ab, 
00111          cbE6,   
00112          cbL1L2, 
00113          cbUndefined,
00114          cbLast  
00115       };
00116 
00117 
00125       enum TrackingCode
00126       {
00127          tcUnknown,
00128          tcAny,     
00129          tcCA,      
00130          tcP,       
00131          tcY,       
00132          tcW,       
00133          tcN,       
00134          tcD,       
00135          tcM,       
00136          tcC2M,     
00137          tcC2L,     
00138          tcC2LM,    
00139          tcI5,      
00140          tcQ5,      
00141          tcIQ5,     
00142 
00143          tcGCA,     
00144          tcGP,      
00145 
00146          tcA,       
00147          tcB,       
00148          tcC,       
00149          tcBC,      
00150          tcABC,     
00151          tcIE5,     
00152          tcQE5,     
00153          tcIQE5,    
00154          tcUndefined,
00155          tcLast     
00156       };
00157 
00159       ObsID()
00160          : type(otUnknown), band(cbUnknown), code(tcUnknown) {};
00161 
00163       ObsID(ObservationType ot, CarrierBand cb, TrackingCode tc)
00164          : type(ot), band(cb), code(tc) {};
00165 
00172       ObsID(const std::string& id) throw(InvalidParameter);
00173       ObsID(const char* id) throw(InvalidParameter)
00174       { *this=ObsID(std::string(id));};
00175 
00177       virtual bool operator==(const ObsID& right) const;
00178 
00186       virtual bool operator<(const ObsID& right) const;
00187 
00188       bool operator!=(const ObsID& right) const
00189       { return !(operator==(right)); };
00190 
00191       bool operator>(const ObsID& right) const
00192       {  return (!operator<(right) && !operator==(right)); };
00193 
00194       bool operator<=(const ObsID& right) const
00195       { return (operator<(right) || operator==(right)); };
00196 
00197       bool operator>=(const ObsID& right) const
00198       { return !(operator<(right)); };
00199 
00204       std::string asRinex3ID() const;
00205 
00207       virtual std::ostream& dump(std::ostream& s) const;
00208 
00210       virtual ~ObsID() {};
00211 
00213       static ObservationType newObservationType(const std::string& s);
00214       static CarrierBand newCarrierBand(const std::string& s);
00215       static TrackingCode newTrackingCode(const std::string& s);
00216 
00217       // Extend the standard identifiers with a new Rinex 3 style identifier. If
00218       // the specified id is already defined, an exception is thrown and the
00219       // existing definitions are not touched. If not then each character of the
00220       // specification is examined and the new ones are created. The returned
00221       // ObsID can then be examined for the assigned values.
00222       static ObsID newID(const std::string& id,
00223                          const std::string& desc="") throw(InvalidParameter);
00224 
00225       // Note that these are the only data members of objects of this class.
00226       ObservationType  type;
00227       CarrierBand      band;
00228       TrackingCode     code;
00229 
00231       static std::map< TrackingCode,    std::string > tcDesc;
00232       static std::map< CarrierBand,     std::string > cbDesc;
00233       static std::map< ObservationType, std::string > otDesc;
00234 
00237       static std::map< char, ObservationType> rinex2ot;
00238       static std::map< char, CarrierBand> rinex2cb;
00239       static std::map< char, TrackingCode> rinex2tc;
00240       static std::map< ObservationType, char > ot2Rinex;
00241       static std::map< CarrierBand, char > cb2Rinex;
00242       static std::map< TrackingCode, char> tc2Rinex;
00243 
00244       class Initializer
00245       {
00246       public:
00247          Initializer();
00248       };
00249       
00250       static Initializer singleton;
00251 
00252    private:
00253       static ObsID idCreator(const std::string& id, const std::string& desc="");
00254 
00255    }; // class ObsID
00256 
00257 } // namespace gpstk
00258 #endif   // OBSID_HPP

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