CivilTime.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: CivilTime.hpp 1162 2008-03-27 21:18:13Z snelsen $"
00002 
00003 
00004 
00005 #ifndef GPSTK_CIVILTIME_HPP
00006 #define GPSTK_CIVILTIME_HPP
00007 
00008 //============================================================================
00009 //
00010 //  This file is part of GPSTk, the GPS Toolkit.
00011 //
00012 //  The GPSTk is free software; you can redistribute it and/or modify
00013 //  it under the terms of the GNU Lesser General Public License as published
00014 //  by the Free Software Foundation; either version 2.1 of the License, or
00015 //  any later version.
00016 //
00017 //  The GPSTk is distributed in the hope that it will be useful,
00018 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //  GNU Lesser General Public License for more details.
00021 //
00022 //  You should have received a copy of the GNU Lesser General Public
00023 //  License along with GPSTk; if not, write to the Free Software Foundation,
00024 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 //  
00026 //  Copyright 2004, The University of Texas at Austin
00027 //
00028 //============================================================================
00029 
00030 #include "TimeTag.hpp"
00031 
00032 namespace gpstk
00033 {
00039    class CivilTime : public TimeTag
00040    {
00041    public:
00051       CivilTime( int yr = 0,
00052                  int mo = 0,
00053                  int dy = 0,
00054                  int hr = 0,
00055                  int mn = 0,
00056                  double s = 0.0 )
00057          throw()
00058             : year(yr), month(mo), day(dy), hour(hr), minute(mn), second(s) 
00059       {}
00060       
00065       CivilTime( const CivilTime& right )
00066          throw()
00067             : year( right.year ), month( right.month ), day( right.day ),
00068               hour( right.hour ), minute( right.minute ), 
00069               second( right.second )
00070       {}
00071       
00079       CivilTime( const TimeTag& right )
00080          throw( InvalidRequest )
00081       {
00082          convertFromCommonTime( right.convertToCommonTime() ); 
00083       }
00084      
00092       CivilTime( const CommonTime& right )
00093          throw()
00094       {
00095          convertFromCommonTime( right );
00096       }
00097 
00103       CivilTime& operator=( const CivilTime& right )
00104          throw();
00105 
00107       virtual ~CivilTime() 
00108          throw()
00109       {}
00111 
00113       static const char *MonthNames[];
00114       
00116       static const char *MonthAbbrevNames[];
00117       
00118          // The following functions are required by TimeTag.
00119       virtual CommonTime convertToCommonTime() const
00120          throw( InvalidRequest );
00121 
00122       virtual void convertFromCommonTime( const CommonTime& ct )
00123          throw();
00124       
00127       virtual std::string printf(const std::string& fmt) const
00128          throw( gpstk::StringUtils::StringException );
00129 
00132       virtual std::string printError( const std::string& fmt) const
00133          throw( gpstk::StringUtils::StringException );
00134 
00141       virtual bool setFromInfo( const IdToValue& info )
00142          throw();
00143 
00146       virtual std::string getPrintChars() const
00147          throw()
00148       { 
00149          return "YymbBdHMSf";
00150       }
00151 
00153       virtual std::string getDefaultFormat() const
00154          throw()
00155       {
00156          return "%02m/%02d/%04Y %02H:%02M:%02S";
00157       }
00158 
00159       virtual bool isValid() const
00160          throw();
00161 
00162       virtual void reset() 
00163          throw();
00164 
00173       bool operator==( const CivilTime& right ) const
00174          throw();
00175       bool operator!=( const CivilTime& right ) const
00176          throw();
00177       bool operator<( const CivilTime& right ) const
00178          throw();
00179       bool operator>( const CivilTime& right ) const
00180          throw();
00181       bool operator<=( const CivilTime& right ) const
00182          throw();
00183       bool operator>=( const CivilTime& right ) const
00184          throw();
00186 
00187       int year;
00188       int month;
00189       int day;
00190       int hour;
00191       int minute;
00192       double second;
00193 
00194    };
00195 
00196 } // namespace
00197 
00198 #endif // GPSTK_CIVILTIME_HPP

Generated on Wed Feb 8 03:30:57 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1