CivilTime.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: CivilTime.hpp 3140 2012-06-18 15:03:02Z susancummins $"
00002 
00003 #ifndef GPSTK_CIVILTIME_HPP
00004 #define GPSTK_CIVILTIME_HPP
00005 
00006 //============================================================================
00007 //
00008 //  This file is part of GPSTk, the GPS Toolkit.
00009 //
00010 //  The GPSTk is free software; you can redistribute it and/or modify
00011 //  it under the terms of the GNU Lesser General Public License as published
00012 //  by the Free Software Foundation; either version 2.1 of the License, or
00013 //  any later version.
00014 //
00015 //  The GPSTk is distributed in the hope that it will be useful,
00016 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 //  GNU Lesser General Public License for more details.
00019 //
00020 //  You should have received a copy of the GNU Lesser General Public
00021 //  License along with GPSTk; if not, write to the Free Software Foundation,
00022 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00023 //  
00024 //  Copyright 2004, The University of Texas at Austin
00025 //
00026 //============================================================================
00027 
00028 //============================================================================
00029 //
00030 //This software developed by Applied Research Laboratories at the University of
00031 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00032 //Department of Defense. The U.S. Government retains all rights to use,
00033 //duplicate, distribute, disclose, or release this software. 
00034 //
00035 //Pursuant to DoD Directive 523024 
00036 //
00037 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00038 //                           release, distribution is unlimited.
00039 //
00040 //=============================================================================
00041 
00042 #include "TimeTag.hpp"
00043 #include "TimeSystem.hpp"
00044 
00045 namespace gpstk
00046 {
00052    class CivilTime : public TimeTag
00053    {
00054    public:
00055 
00065       CivilTime( int yr = 0,
00066                  int mo = 0,
00067                  int dy = 0,
00068                  int hr = 0,
00069                  int mn = 0,
00070                  double s = 0.0,
00071                  TimeSystem ts = TimeSystem::Unknown )
00072          throw()
00073             : year(yr), month(mo), day(dy), hour(hr), minute(mn), second(s)
00074       { timeSystem = ts; }
00075       
00080       CivilTime( const CivilTime& right )
00081          throw()
00082             : year( right.year ), month( right.month )  , day( right.day ),
00083               hour( right.hour ), minute( right.minute ), second( right.second )
00084       { timeSystem = right.timeSystem; }
00085       
00093       CivilTime( const TimeTag& right )
00094          throw()
00095       {
00096          convertFromCommonTime( right.convertToCommonTime() ); 
00097       }
00098      
00106       CivilTime( const CommonTime& right )
00107          throw()
00108       {
00109          convertFromCommonTime( right );
00110       }
00111 
00117       CivilTime& operator=( const CivilTime& right )
00118          throw();
00119 
00121       virtual ~CivilTime() 
00122          throw()
00123       {}
00125 
00127       static const char *MonthNames[];
00128       
00130       static const char *MonthAbbrevNames[];
00131       
00132          // The following functions are required by TimeTag.
00133       virtual CommonTime convertToCommonTime() const
00134          throw( gpstk::InvalidRequest );
00135 
00136       virtual void convertFromCommonTime( const CommonTime& ct )
00137          throw();
00138       
00141       virtual std::string printf(const std::string& fmt) const
00142          throw( gpstk::StringUtils::StringException );
00143 
00146       virtual std::string printError( const std::string& fmt) const
00147          throw( gpstk::StringUtils::StringException );
00148 
00155       virtual bool setFromInfo( const IdToValue& info )
00156          throw();
00157 
00160       virtual std::string getPrintChars() const
00161          throw()
00162       { 
00163          return "YymbBdHMSfP";
00164       }
00165 
00167       virtual std::string getDefaultFormat() const
00168          throw()
00169       {
00170          return "%02m/%02d/%04Y %02H:%02M:%02S %P";
00171       }
00172 
00173       virtual bool isValid() const
00174          throw();
00175 
00176       virtual void reset() 
00177          throw();
00178 
00187       bool operator==( const CivilTime& right ) const
00188          throw();
00189       bool operator!=( const CivilTime& right ) const
00190          throw();
00191       bool operator<( const CivilTime& right ) const
00192          throw( gpstk::InvalidRequest );
00193       bool operator>( const CivilTime& right ) const
00194          throw( gpstk::InvalidRequest );
00195       bool operator<=( const CivilTime& right ) const
00196          throw( gpstk::InvalidRequest );
00197       bool operator>=( const CivilTime& right ) const
00198          throw( gpstk::InvalidRequest );
00200 
00201       int year;
00202       int month;
00203       int day;
00204       int hour;
00205       int minute;
00206       double second;
00207 
00208    };
00209 
00210       // -----------CivilTime operator<< -----------
00211       //
00218    std::ostream& operator<<( std::ostream& s,
00219                              const gpstk::CivilTime& cit );
00220 
00221 } // namespace
00222 
00223 #endif // GPSTK_CIVILTIME_HPP

Generated on Thu May 23 03:31:04 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1