SourceID.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: SourceID.hpp 1889 2009-05-11 15:47:23Z afarris $"
00002 
00008 #ifndef GPSTK_SOURCEID_HPP
00009 #define GPSTK_SOURCEID_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 ). 2006, 2007, 2008
00030 //
00031 //============================================================================
00032 
00033 
00034 #include <iostream>
00035 #include <iomanip>
00036 #include <sstream>
00037 #include <string>
00038 #include <map>
00039 
00040 
00041 
00042 namespace gpstk
00043 {
00044 
00047    class SourceID
00048    {
00049    public:
00050 
00052       enum SourceType
00053       {
00054          Unknown,
00055          GPS,     
00056          Galileo, 
00057          Glonass, 
00058          Geosync, 
00059          LEO,     
00060          Transit, 
00061          DGPS,    
00062          RTK,     
00063          INS,     
00064          Mixed,   
00065          Last,    
00066          Placeholder = Last+1000
00067       };
00068 
00069 
00071       SourceID()
00072          : type(Unknown), sourceName("")
00073       {};
00074 
00075 
00077       SourceID( SourceType st,
00078                 std::string name )
00079          : type(st), sourceName(name)
00080       {};
00081 
00082 
00084       SourceID(const SourceID& s)
00085          : type(s.type), sourceName(s.sourceName)
00086       {};
00087 
00088 
00090       virtual bool operator==(const SourceID& right) const;
00091 
00092 
00096       virtual bool operator<(const SourceID& right) const;
00097 
00098 
00100       bool operator!=(const SourceID& right) const
00101       { return !(operator==(right)); }
00102 
00103 
00105       bool operator>(const SourceID& right) const
00106       {  return (!operator<(right) && !operator==(right)); }
00107 
00108 
00110       bool operator<=(const SourceID& right) const
00111       { return (operator<(right) || operator==(right)); }
00112 
00113 
00115       bool operator>=(const SourceID& right) const
00116       { return !(operator<(right)); }
00117 
00118 
00120       SourceID& operator=(const SourceID& right);
00121 
00122 
00124       virtual std::ostream& dump(std::ostream& s) const;
00125 
00126 
00129       virtual bool isValid() const;
00130 
00131 
00133       virtual ~SourceID() {};
00134 
00135 
00137       static SourceType newSourceType(const std::string& s);
00138 
00139 
00140          // Fields
00141 
00143       SourceType  type;
00144 
00145 
00147       std::string sourceName;
00148 
00149 
00150    private:
00151 
00152 
00153       static std::map< SourceType, std::string > stStrings;
00154 
00155 
00156    public:
00157 
00158       class Initializer
00159       {
00160       public:
00161          Initializer();
00162       };
00163 
00164       static Initializer SourceIDsingleton;
00165 
00166    }; // End of class 'SourceID'
00167 
00168 
00169 
00170    namespace StringUtils
00171    {
00172 
00174       std::string asString(const SourceID& p);
00175 
00176    }
00177 
00178 
00179 
00181    std::ostream& operator<<( std::ostream& s,
00182                              const SourceID& p );
00183 
00184 
00185 
00186 }  // End of namespace gpstk
00187 #endif   // GPSTK_SOURCEID_HPP

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