00001 #pragma ident "$Id: GPSZcount.hpp 500 2007-04-27 12:02:53Z ocibu $"
00002
00003
00004
00010 #ifndef GPSTK_GPSZCOUNT_HPP
00011 #define GPSTK_GPSZCOUNT_HPP
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #include <ostream>
00051
00052
00053 #include "Exception.hpp"
00054
00055 namespace gpstk
00056 {
00059
00076 class GPSZcount
00077 {
00078 public:
00080 static const long ZCOUNT_MINUTE;
00082 static const long ZCOUNT_HOUR;
00084 static const long ZCOUNT_DAY;
00086 static const long ZCOUNT_WEEK;
00087
00094 GPSZcount(short inWeek,
00095 long inZcount)
00096 throw(gpstk::InvalidParameter) ;
00097
00104 GPSZcount(long inFullZcount = 0)
00105 throw(gpstk::InvalidParameter) ;
00106
00108 ~GPSZcount() throw() {}
00109
00113 GPSZcount(const GPSZcount& right)
00114 throw() ;
00115
00117 short getWeek() const throw()
00118 { return week ; }
00119
00121 long getZcount() const throw()
00122 { return zcount ; }
00123
00129 long getFullZcount() const
00130 throw()
00131 { return (long(getWeek() & 0x3FF) << 19) + getZcount() ; }
00132
00136 double getTotalZcounts() const
00137 throw()
00138 { return double(getWeek()) * ZCOUNT_WEEK + getZcount() ; }
00139
00146 GPSZcount& setWeek(short inWeek)
00147 throw(gpstk::InvalidParameter) ;
00148
00155 GPSZcount& setZcount(long inZcount)
00156 throw(gpstk::InvalidParameter) ;
00157
00164 GPSZcount& setFullZcount(long inZcount)
00165 throw(gpstk::InvalidParameter) ;
00166
00173 GPSZcount& addWeeks(short inWeeks)
00174 throw(gpstk::InvalidRequest) ;
00175
00185 GPSZcount& addZcounts(long inZcounts)
00186 throw(gpstk::InvalidRequest) ;
00187
00195 GPSZcount operator++(int)
00196 throw(gpstk::InvalidRequest) ;
00197
00204 GPSZcount& operator++()
00205 throw(gpstk::InvalidRequest) ;
00206
00214 GPSZcount operator--(int)
00215 throw(gpstk::InvalidRequest) ;
00216
00223 GPSZcount& operator--()
00224 throw(gpstk::InvalidRequest) ;
00225
00235 GPSZcount operator+(long inZcounts) const
00236 throw(gpstk::InvalidRequest) ;
00237
00247 GPSZcount operator-(long inZcounts) const
00248 throw(gpstk::InvalidRequest) ;
00249
00256 double operator-(const GPSZcount& right) const
00257 throw() ;
00258
00263 long operator%(const long right) const
00264 throw() ;
00265
00275 GPSZcount& operator+=(long inZcounts)
00276 throw(gpstk::InvalidRequest) ;
00277
00287 GPSZcount& operator-=(long inZcounts)
00288 throw(gpstk::InvalidRequest) ;
00289
00291 GPSZcount& operator=(const GPSZcount& right)
00292 throw();
00293
00295 bool operator<(const GPSZcount& right) const
00296 throw();
00298 bool operator>(const GPSZcount& right) const
00299 throw();
00301 bool operator==(const GPSZcount& right) const
00302 throw();
00304 bool operator!=(const GPSZcount& right) const
00305 throw();
00307 bool operator<=(const GPSZcount& right) const
00308 throw();
00310 bool operator>=(const GPSZcount& right) const
00311 throw();
00312
00314 operator std::string() const
00315 throw() ;
00316
00337 bool inSameTimeBlock(const GPSZcount& other,
00338 unsigned long inZcountBlock,
00339 unsigned long inZcountOffset = 0)
00340 throw();
00341
00346 void dump(std::ostream& out,
00347 short level = 0) const
00348 throw() ;
00349
00350 protected:
00351 short week;
00352 long zcount;
00353
00359 static long validZcount(long z)
00360 throw();
00361
00362 };
00363
00369 std::ostream& operator<<(std::ostream& s,
00370 const gpstk::GPSZcount& z) ;
00371
00373
00374 }
00375
00376 #endif