GPSWeekZcount.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #ifndef GNSSTK_GPSWEEKZCOUNT_HPP
40 #define GNSSTK_GPSWEEKZCOUNT_HPP
41 
42 #include "GPSWeek.hpp"
43 #include "TimeConstants.hpp"
44 #include "TimeSystem.hpp"
45 
46 namespace gnsstk
47 {
49 
50 
55  class GPSWeekZcount : public GPSWeek
56  {
57  public:
59  static const unsigned int bits19 = 0x7FFFF;
60 
69  GPSWeekZcount( int w = 0,
70  int z = 0,
72  : GPSWeek( w ), zcount( z )
73  { timeSystem = ts; }
74 
79  GPSWeekZcount( const GPSWeekZcount& right )
80  : GPSWeek( right.week ), zcount( right.zcount )
81  { timeSystem = right.timeSystem; }
82 
90  GPSWeekZcount( const TimeTag& right )
91  {
93  }
94 
102  GPSWeekZcount( const CommonTime& right )
103  {
104  convertFromCommonTime( right );
105  }
106 
112  GPSWeekZcount& operator=( const GPSWeekZcount& right );
113 
115  virtual ~GPSWeekZcount()
116  {}
118 
119  // The following functions are required by TimeTag.
120  virtual CommonTime convertToCommonTime() const;
121 
122  virtual void convertFromCommonTime( const CommonTime& ct );
123 
126  virtual std::string printf( const std::string& fmt ) const;
127 
130  virtual std::string printError( const std::string& fmt) const;
131 
138  virtual bool setFromInfo( const IdToValue& info );
139 
142  inline virtual std::string getPrintChars() const
143  {
144  return GPSWeek::getPrintChars() + "wzZcC";
145  }
146 
148  inline virtual std::string getDefaultFormat() const
149  {
150  return GPSWeek::getDefaultFormat() + " %06Z %P";
151  }
152 
153  virtual bool isValid() const
154  {
155  return ( GPSWeek::isValid() && zcount < ZCOUNT_PER_WEEK );
156  }
157 
158  inline virtual void reset()
159  {
160  GPSWeek::reset();
161  zcount = 0;
162  }
163 
167 
168  inline unsigned int getZcount29() const
169  {
170  return (getWeek10() << 19) | zcount;
171  }
172 
173  inline unsigned int getZcount32() const
174  {
175  return (week << 19) | zcount;
176  }
177 
178  GPSWeekZcount& setZcount29(unsigned int z);
179 
180  GPSWeekZcount& setZcount32(unsigned int z);
182 
183  inline virtual unsigned int getDayOfWeek() const
184  {
185  return static_cast<unsigned int>(zcount) / ZCOUNT_PER_DAY;
186  }
187 
196  //
197  inline bool operator==( const GPSWeekZcount& right ) const
198  {
199  return ( GPSWeek::operator==(right) && zcount == right.zcount );
200  }
201 
202  inline bool operator!=( const GPSWeekZcount& right ) const
203  {
204  return ( !operator==( right ) );
205  }
206 
207  inline bool operator<( const GPSWeekZcount& right ) const
208  {
209  if( GPSWeek::operator<(right) )
210  {
211  return true;
212  }
213  if( GPSWeek::operator>(right) )
214  {
215  return false;
216  }
217  if( zcount < right.zcount )
218  {
219  return true;
220  }
221  return false;
222  }
223 
224  inline bool operator>( const GPSWeekZcount& right ) const
225  {
226  return ( !operator<=( right ) );
227  }
228 
229  inline bool operator<=( const GPSWeekZcount& right ) const
230  {
231  return ( operator<( right ) || operator==( right ) );
232  }
233 
234  inline bool operator>=( const GPSWeekZcount& right ) const
235  {
236  return ( !operator<( right ) );
237  }
238 
240 
244  unsigned long getTotalZcounts() const
245  noexcept
246  { return (unsigned long)week * ZCOUNT_PER_WEEK + zcount; }
247 
253  GPSWeekZcount& addWeeks(short inWeeks);
254 
263  GPSWeekZcount& addZcounts(long inZcounts);
264 
273 
281 
290 
298 
307  GPSWeekZcount operator+(long inZcounts) const;
308 
317  GPSWeekZcount operator-(long inZcounts) const;
318 
322  long operator-(const GPSWeekZcount& right) const
323  noexcept;
324 
333  GPSWeekZcount& operator+=(long inZcounts);
334 
343  GPSWeekZcount& operator-=(long inZcounts);
344 
366  bool inSameTimeBlock(const GPSWeekZcount& other,
367  unsigned long inZcountBlock,
368  unsigned long inZcountOffset = 0)
369  noexcept;
370 
371  unsigned int zcount;
372  };
373 
375 
376 } // namespace
377 
378 #endif // GNSSTK_GPSWEEKZCOUNT_HPP
TimeSystem.hpp
gnsstk::GPSWeekZcount::addWeeks
GPSWeekZcount & addWeeks(short inWeeks)
Definition: GPSWeekZcount.cpp:245
TimeConstants.hpp
gnsstk::GPSWeekZcount::zcount
unsigned int zcount
Definition: GPSWeekZcount.hpp:371
gnsstk::GPSWeekZcount::operator+
GPSWeekZcount operator+(long inZcounts) const
Definition: GPSWeekZcount.cpp:335
gnsstk::GPSWeekZcount::getZcount32
unsigned int getZcount32() const
Definition: GPSWeekZcount.hpp:173
gnsstk::GPSWeek::getDefaultFormat
virtual std::string getDefaultFormat() const
Return a string containing the default format to use in printing.
Definition: GPSWeek.hpp:253
gnsstk::GPSWeekZcount::getTotalZcounts
unsigned long getTotalZcounts() const noexcept
Definition: GPSWeekZcount.hpp:244
GPSWeek.hpp
gnsstk::TimeTag::IdToValue
std::map< char, std::string > IdToValue
Definition: TimeTag.hpp:103
gnsstk::GPSWeekZcount::getDefaultFormat
virtual std::string getDefaultFormat() const
Return a string containing the default format to use in printing.
Definition: GPSWeekZcount.hpp:148
const
#define const
Definition: getopt.c:43
gnsstk::GPSWeekZcount::reset
virtual void reset()
Reset this object to the default state.
Definition: GPSWeekZcount.hpp:158
gnsstk::GPSWeekZcount::convertFromCommonTime
virtual void convertFromCommonTime(const CommonTime &ct)
Definition: GPSWeekZcount.cpp:88
gnsstk::GPSWeekZcount::setZcount32
GPSWeekZcount & setZcount32(unsigned int z)
Definition: GPSWeekZcount.cpp:237
gnsstk::GPSWeek::isValid
virtual bool isValid() const
Returns true if this object's members are valid, false otherwise.
Definition: GPSWeek.hpp:258
gnsstk::GPSWeek::reset
virtual void reset()
Reset this object to the default state.
Definition: GPSWeek.hpp:263
gnsstk::GPSWeekZcount::getDayOfWeek
virtual unsigned int getDayOfWeek() const
Force this interface on this classes descendants.
Definition: GPSWeekZcount.hpp:183
gnsstk::GPSWeekZcount::~GPSWeekZcount
virtual ~GPSWeekZcount()
Virtual Destructor.
Definition: GPSWeekZcount.hpp:115
gnsstk::GPSWeekZcount::operator--
GPSWeekZcount & operator--()
Definition: GPSWeekZcount.cpp:329
gnsstk::GPSWeek::getWeek10
virtual unsigned int getWeek10() const
Definition: GPSWeek.hpp:197
gnsstk::GPSWeekZcount::operator<=
bool operator<=(const GPSWeekZcount &right) const
Definition: GPSWeekZcount.hpp:229
gnsstk::GPSWeekZcount::convertToCommonTime
virtual CommonTime convertToCommonTime() const
Definition: GPSWeekZcount.cpp:68
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::GPSWeekZcount::getPrintChars
virtual std::string getPrintChars() const
Definition: GPSWeekZcount.hpp:142
gnsstk::GPSWeekZcount::bits19
static const unsigned int bits19
This is just a 19-bit mask.
Definition: GPSWeekZcount.hpp:59
gnsstk::TimeTag::timeSystem
TimeSystem timeSystem
time system (representation) of the data
Definition: TimeTag.hpp:204
gnsstk::GPSWeek::week
int week
Definition: GPSWeek.hpp:271
gnsstk::GPSWeekZcount::getZcount29
unsigned int getZcount29() const
Definition: GPSWeekZcount.hpp:168
gnsstk::TimeTag
Definition: TimeTag.hpp:58
gnsstk::GPSWeekZcount::printf
virtual std::string printf(const std::string &fmt) const
Definition: GPSWeekZcount.cpp:114
gnsstk::GPSWeekZcount::operator-
GPSWeekZcount operator-(long inZcounts) const
Definition: GPSWeekZcount.cpp:341
gnsstk::GPSWeekZcount::operator-=
GPSWeekZcount & operator-=(long inZcounts)
Definition: GPSWeekZcount.cpp:361
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::GPSWeekZcount::operator==
bool operator==(const GPSWeekZcount &right) const
Definition: GPSWeekZcount.hpp:197
gnsstk::GPSWeekZcount::operator+=
GPSWeekZcount & operator+=(long inZcounts)
Definition: GPSWeekZcount.cpp:355
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
gnsstk::GPSWeekZcount::GPSWeekZcount
GPSWeekZcount(int w=0, int z=0, TimeSystem ts=TimeSystem::GPS)
Definition: GPSWeekZcount.hpp:69
gnsstk::TimeTag::convertToCommonTime
virtual CommonTime convertToCommonTime() const =0
gnsstk::GPSWeekZcount
Definition: GPSWeekZcount.hpp:55
gnsstk::GPSWeekZcount::operator!=
bool operator!=(const GPSWeekZcount &right) const
Definition: GPSWeekZcount.hpp:202
gnsstk::GPSWeekZcount::isValid
virtual bool isValid() const
Returns true if this object's members are valid, false otherwise.
Definition: GPSWeekZcount.hpp:153
gnsstk::GPSWeekZcount::operator++
GPSWeekZcount & operator++()
Definition: GPSWeekZcount.cpp:315
gnsstk::GPSWeek::getPrintChars
virtual std::string getPrintChars() const
Definition: GPSWeek.hpp:247
gnsstk::GPSWeekZcount::setFromInfo
virtual bool setFromInfo(const IdToValue &info)
Definition: GPSWeekZcount.cpp:174
gnsstk::GPSWeekZcount::GPSWeekZcount
GPSWeekZcount(const GPSWeekZcount &right)
Definition: GPSWeekZcount.hpp:79
gnsstk::GPSWeekZcount::printError
virtual std::string printError(const std::string &fmt) const
Definition: GPSWeekZcount.cpp:146
gnsstk::TimeSystem::GPS
@ GPS
GPS system time.
gnsstk::GPSWeekZcount::inSameTimeBlock
bool inSameTimeBlock(const GPSWeekZcount &other, unsigned long inZcountBlock, unsigned long inZcountOffset=0) noexcept
Definition: GPSWeekZcount.cpp:367
gnsstk::GPSWeekZcount::GPSWeekZcount
GPSWeekZcount(const TimeTag &right)
Definition: GPSWeekZcount.hpp:90
gnsstk::GPSWeekZcount::operator<
bool operator<(const GPSWeekZcount &right) const
Definition: GPSWeekZcount.hpp:207
gnsstk::ZCOUNT_PER_DAY
const long ZCOUNT_PER_DAY
Zcounts in a day.
Definition: TimeConstants.hpp:88
gnsstk::GPSWeekZcount::operator>=
bool operator>=(const GPSWeekZcount &right) const
Definition: GPSWeekZcount.hpp:234
gnsstk::ZCOUNT_PER_WEEK
const long ZCOUNT_PER_WEEK
Zcounts in a week.
Definition: TimeConstants.hpp:92
gnsstk::GPSWeekZcount::setZcount29
GPSWeekZcount & setZcount29(unsigned int z)
Definition: GPSWeekZcount.cpp:230
gnsstk::GPSWeekZcount::operator=
GPSWeekZcount & operator=(const GPSWeekZcount &right)
Definition: GPSWeekZcount.cpp:61
gnsstk::GPSWeekZcount::addZcounts
GPSWeekZcount & addZcounts(long inZcounts)
Definition: GPSWeekZcount.cpp:257
gnsstk::GPSWeekZcount::GPSWeekZcount
GPSWeekZcount(const CommonTime &right)
Definition: GPSWeekZcount.hpp:102
gnsstk::GPSWeek
Definition: GPSWeek.hpp:82
gnsstk::GPSWeekZcount::operator>
bool operator>(const GPSWeekZcount &right) const
Definition: GPSWeekZcount.hpp:224


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:39