Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
gnsstk::GPSZcount Class Reference

Detailed Description

A representation class for GPS Time consisting of a short GPS week, and a long GPS Z-count. A valid GPS week is in the following range: 0 <= week <= numerical_limits<short>::max() A valid GPS Z-count is in the following range: 0 <= zcount < 403200

In Z-count addition, if a specified Z-count value is above or below the given range of valid Z-counts, the appropriate number of GPS weeks-worth of Z-counts are added or subtracted from the given value so that it falls within the acceptable range. These extra weeks are then accounted for in the weeks data member. If the addition or subtraction of these additional weeks cause the GPS week value to go out-of-bounds, an InvalidRequest exception is thrown.

Definition at line 75 of file GPSZcount.hpp.

#include <GPSZcount.hpp>

Public Member Functions

GPSZcountaddWeeks (short inWeeks)
 
GPSZcountaddZcounts (long inZcounts)
 
void dump (std::ostream &out, short level=0) const
 
long getFullZcount () const
 
double getTotalZcounts () const
 
short getWeek () const
 GPS week accessor. More...
 
long getZcount () const
 GPS Z-count accessor. More...
 
 GPSZcount (const GPSZcount &right)
 
 GPSZcount (long inFullZcount=0)
 
 GPSZcount (short inWeek, long inZcount)
 
bool inSameTimeBlock (const GPSZcount &other, unsigned long inZcountBlock, unsigned long inZcountOffset=0)
 
 operator std::string () const
 Convert this object to a string. More...
 
bool operator!= (const GPSZcount &right) const
 Inequality operator. More...
 
long operator% (const long right) const
 
GPSZcount operator+ (long inZcounts) const
 
GPSZcountoperator++ ()
 
GPSZcount operator++ (int)
 
GPSZcountoperator+= (long inZcounts)
 
double operator- (const GPSZcount &right) const
 
GPSZcount operator- (long inZcounts) const
 
GPSZcountoperator-- ()
 
GPSZcount operator-- (int)
 
GPSZcountoperator-= (long inZcounts)
 
bool operator< (const GPSZcount &right) const
 Comparison operator (less-than). More...
 
bool operator<= (const GPSZcount &right) const
 Comparison operator (less-than or equal-to). More...
 
GPSZcountoperator= (const GPSZcount &right)
 Assignment operator. More...
 
bool operator== (const GPSZcount &right) const
 Equality operator. More...
 
bool operator> (const GPSZcount &right) const
 Comparison operator (greater-than). More...
 
bool operator>= (const GPSZcount &right) const
 Comparison operator (greater-than or equal-to). More...
 
GPSZcountsetFullZcount (long inZcount)
 
GPSZcountsetWeek (short inWeek)
 
GPSZcountsetZcount (long inZcount)
 
 ~GPSZcount ()
 Destructor. Does nothing. More...
 

Static Public Attributes

static const GNSSTK_EXPORT long ZCOUNT_DAY = 57600
 Z-counts per day (57600) More...
 
static const GNSSTK_EXPORT long ZCOUNT_HOUR = 2400
 Z-counts per hour (2400) More...
 
static const GNSSTK_EXPORT long ZCOUNT_MINUTE = 40
 Z-counts per minute (40) More...
 
static const GNSSTK_EXPORT long ZCOUNT_WEEK = 403200
 Z-counts per whole GPS week. (403200) More...
 

Static Protected Member Functions

static long validZcount (long z)
 

Protected Attributes

short week
 GPS full week. (0 <= week) More...
 
long zcount
 GPS Z-count. (0 <= zcount <= 403199) More...
 

Constructor & Destructor Documentation

◆ GPSZcount() [1/3]

gnsstk::GPSZcount::GPSZcount ( short  inWeek,
long  inZcount 
)

Separate Week and Z-count Constructor.

Parameters
inWeekthe GPS week to use in this object.
inZcountthe GPS Z-count to use in this object.
Exceptions
gnsstk::InvalidParameterif either inWeek or inZcount are invalid values for their respective types.

Definition at line 59 of file GPSZcount.cpp.

◆ GPSZcount() [2/3]

gnsstk::GPSZcount::GPSZcount ( long  inFullZcount = 0)

Full Z-count Constructor.

Parameters
inFullZcountthe Full 29-bit GPS Z-count to use in this object. (default=0 => week == 0; Z-count == 0)
Exceptions
gnsstk::InvalidParameterif either inFullZcount is an invalid value for a full Z-count.

Definition at line 73 of file GPSZcount.cpp.

◆ ~GPSZcount()

gnsstk::GPSZcount::~GPSZcount ( )
inline

Destructor. Does nothing.

Definition at line 105 of file GPSZcount.hpp.

◆ GPSZcount() [3/3]

gnsstk::GPSZcount::GPSZcount ( const GPSZcount right)

Copy Constructor.

Parameters
rightthe GPSZcount object to copy

Definition at line 85 of file GPSZcount.cpp.

Member Function Documentation

◆ addWeeks()

GPSZcount & gnsstk::GPSZcount::addWeeks ( short  inWeeks)

Add the given number of weeks to the current value.

Parameters
inWeeksthe number of weeks to add to the current value.
Returns
a reference to this object
Exceptions
gnsstk::InvalidRequestif adding inWeeks would render this object invalid.

Definition at line 133 of file GPSZcount.cpp.

◆ addZcounts()

GPSZcount & gnsstk::GPSZcount::addZcounts ( long  inZcounts)

Add the given number of Z-counts to the current value. This may cause a roll-(over/under) of the Z-count and appropriate modification of the week.

Parameters
inZcountsthe number of Z-counts to add to the current value.
Returns
a reference to this object
Exceptions
gnsstk::InvalidRequestif adding inZcounts would render this object invalid.

Definition at line 153 of file GPSZcount.cpp.

◆ dump()

void gnsstk::GPSZcount::dump ( std::ostream &  out,
short  level = 0 
) const

Dump the contents of this object to the given output stream.

Parameters
outthe output stream to write to
levelthe level of verbosity to use (default=0)

Definition at line 352 of file GPSZcount.cpp.

◆ getFullZcount()

long gnsstk::GPSZcount::getFullZcount ( ) const
inline

Construct, from the data members, the Z-count which could have been broadcast from an SV.

Returns
a Full Z-count (3 MSB unused, next 10 bits = week, 19 LSB = Z-count)

Definition at line 125 of file GPSZcount.hpp.

◆ getTotalZcounts()

double gnsstk::GPSZcount::getTotalZcounts ( ) const
inline

Calculate the total number of Z-counts in this object.

Returns
weeks * ZCOUNT_WEEK + zcount

Definition at line 131 of file GPSZcount.hpp.

◆ getWeek()

short gnsstk::GPSZcount::getWeek ( ) const
inline

GPS week accessor.

Definition at line 113 of file GPSZcount.hpp.

◆ getZcount()

long gnsstk::GPSZcount::getZcount ( ) const
inline

GPS Z-count accessor.

Definition at line 117 of file GPSZcount.hpp.

◆ inSameTimeBlock()

bool gnsstk::GPSZcount::inSameTimeBlock ( const GPSZcount other,
unsigned long  inZcountBlock,
unsigned long  inZcountOffset = 0 
)

This is a test of whether or not this object and the given GPSZcount object are within the same time-block. Say you need to find out if the two GPSZcounts are: ... in the same day: inZcountBlock == ZCOUNT_DAY ... or the same minute: inZcountBlock == ZCOUNT_MINUTE etc. For inZcountBlock < ZCOUNT_WEEK, blocks start at the beginning of the week. For inZcountBlock >= ZCOUNT_WEEK, blocks start at the beginning of GPS Week 0. inZcountOffset allows checking of times off of the usual boundaries i.e. in the same day where a day is defined as starting at noon instead of at midnight, or in the same minute where a minute starts at 23 seconds instead of zero.

Parameters
otherthe other GPSZcount object
inZcountBlockthe number of Z-counts in a time-block
inZcountOffsetthe number of Z-counts to offset the time-block (default = 0)
Returns
whether this object and /a other are in the same time-block

Definition at line 324 of file GPSZcount.cpp.

◆ operator std::string()

gnsstk::GPSZcount::operator std::string ( ) const

Convert this object to a string.

Definition at line 319 of file GPSZcount.cpp.

◆ operator!=()

bool gnsstk::GPSZcount::operator!= ( const GPSZcount right) const

Inequality operator.

Definition at line 304 of file GPSZcount.cpp.

◆ operator%()

long gnsstk::GPSZcount::operator% ( const long  right) const

Compute the remainder of the ztime

Parameters
rightthe number to
Returns
z counts % right

Definition at line 244 of file GPSZcount.cpp.

◆ operator+()

GPSZcount gnsstk::GPSZcount::operator+ ( long  inZcounts) const

Add the given number of Z-counts to the current value. This may cause a roll-(over/under) of the Z-count and appropriate modification of the week.

Parameters
inZcountsthe number of Z-counts to add to the current value.
Returns
a modified GPSZcount object
Exceptions
gnsstk::InvalidRequestif adding inZcounts would render this object invalid.

Definition at line 228 of file GPSZcount.cpp.

◆ operator++() [1/2]

GPSZcount & gnsstk::GPSZcount::operator++ ( )

Prefix Increment the Z-count in this object (++x). This may also cause the roll-over of the Z-count and incrementing of the week.

Returns
a reference to this object.
Exceptions
gnsstk::InvalidRequestif Z-count increment would render this object invalid.

Definition at line 211 of file GPSZcount.cpp.

◆ operator++() [2/2]

GPSZcount gnsstk::GPSZcount::operator++ ( int  )

Postfix Increment the Z-count in this object (x++). This may also cause the roll-over of the Z-count and incrementing of the week.

Returns
a GPSZcount with the value of this object before the increment
Exceptions
gnsstk::InvalidRequestif Z-count increment would render this object invalid.

Definition at line 204 of file GPSZcount.cpp.

◆ operator+=()

GPSZcount & gnsstk::GPSZcount::operator+= ( long  inZcounts)

Add the given number of Z-counts to the current value. This may cause a roll-(over/under) of the Z-count and appropriate modification of the week.

Parameters
inZcountsthe number of Z-counts to add to the current value.
Returns
a reference to this object
Exceptions
gnsstk::InvalidRequestif adding inZcounts would render this object invalid.

Definition at line 249 of file GPSZcount.cpp.

◆ operator-() [1/2]

double gnsstk::GPSZcount::operator- ( const GPSZcount right) const

Compute the time differenct between this object and right.

Parameters
rightthe GPSZcount to subtract from this object
Returns
the number of Z-counts between this object and right Note that this returns a double as opposed to a long. This is to avoid any overflow issues.

Definition at line 238 of file GPSZcount.cpp.

◆ operator-() [2/2]

GPSZcount gnsstk::GPSZcount::operator- ( long  inZcounts) const

Subtract the given number of Z-counts from the current value. This may cause a roll-(over/under) of the Z-count and appropriate modification of the week.

Parameters
inZcountsthe number of Z-counts to subtract from the current value.
Returns
a modified GPSZcount object
Exceptions
gnsstk::InvalidRequestif subtracting inZcounts would render this object invalid.

Definition at line 233 of file GPSZcount.cpp.

◆ operator--() [1/2]

GPSZcount & gnsstk::GPSZcount::operator-- ( )

Prefix Decrement the Z-count in this object (–x). This may also cause the roll-under of the Z-count and decrementing of the week.

Returns
a reference to this object.
Exceptions
gnsstk::InvalidRequestif a Z-count decrement would render this object invalid.

Definition at line 223 of file GPSZcount.cpp.

◆ operator--() [2/2]

GPSZcount gnsstk::GPSZcount::operator-- ( int  )

Postfix Decrement the Z-count in this object (x–). This may also cause the roll-under of the Z-count and decrementing of the week.

Returns
a GPSZcount with the value of this object before the decrement
Exceptions
gnsstk::InvalidRequestif a Z-count decrement would render this object invalid.

Definition at line 216 of file GPSZcount.cpp.

◆ operator-=()

GPSZcount & gnsstk::GPSZcount::operator-= ( long  inZcounts)

Subtract the given number of Z-counts from the current value. This may cause a roll-(over/under) of the Z-count and appropriate modification of the week.

Parameters
inZcountsthe number of Z-counts to subtract from the current value.
Returns
a reference to this object
Exceptions
gnsstk::InvalidRequestif subtracting inZcounts would render this object invalid.

Definition at line 254 of file GPSZcount.cpp.

◆ operator<()

bool gnsstk::GPSZcount::operator< ( const GPSZcount right) const

Comparison operator (less-than).

Definition at line 266 of file GPSZcount.cpp.

◆ operator<=()

bool gnsstk::GPSZcount::operator<= ( const GPSZcount right) const

Comparison operator (less-than or equal-to).

Definition at line 309 of file GPSZcount.cpp.

◆ operator=()

GPSZcount & gnsstk::GPSZcount::operator= ( const GPSZcount right)

Assignment operator.

Definition at line 259 of file GPSZcount.cpp.

◆ operator==()

bool gnsstk::GPSZcount::operator== ( const GPSZcount right) const

Equality operator.

Definition at line 294 of file GPSZcount.cpp.

◆ operator>()

bool gnsstk::GPSZcount::operator> ( const GPSZcount right) const

Comparison operator (greater-than).

Definition at line 280 of file GPSZcount.cpp.

◆ operator>=()

bool gnsstk::GPSZcount::operator>= ( const GPSZcount right) const

Comparison operator (greater-than or equal-to).

Definition at line 314 of file GPSZcount.cpp.

◆ setFullZcount()

GPSZcount & gnsstk::GPSZcount::setFullZcount ( long  inZcount)

Set the GPS Week and Z-count using the value broadcast from an SV.

Parameters
inZcountA full Z-count (3 MSB unused, next 10 bits = week, 19 LSB = Z-count)
Exceptions
gnsstk::InvalidParameterif the extracted Z-count is an invalid value for a GPS Z-count.

Definition at line 114 of file GPSZcount.cpp.

◆ setWeek()

GPSZcount & gnsstk::GPSZcount::setWeek ( short  inWeek)

Set the GPS week.

Parameters
inWeekthe new value for GPS Week.
Returns
a reference to this object.
Exceptions
gnsstk::InvalidParameterif inWeek is an invalid value for a GPS week.

Definition at line 90 of file GPSZcount.cpp.

◆ setZcount()

GPSZcount & gnsstk::GPSZcount::setZcount ( long  inZcount)

Set the GPS Z-count.

Parameters
inZcountthe new value for GPS Z-count.
Returns
a reference to this object.
Exceptions
gnsstk::InvalidParameterif inZcount is an invalid value for a GPS Z-count.

Definition at line 102 of file GPSZcount.cpp.

◆ validZcount()

long gnsstk::GPSZcount::validZcount ( long  z)
staticprotected

Check the validity of the given Z-count.

Parameters
zthe Z-count to verify
Returns
0 if valid, negative if below zero, positive if above 403199

Definition at line 368 of file GPSZcount.cpp.

Member Data Documentation

◆ week

short gnsstk::GPSZcount::week
protected

GPS full week. (0 <= week)

Definition at line 320 of file GPSZcount.hpp.

◆ zcount

long gnsstk::GPSZcount::zcount
protected

GPS Z-count. (0 <= zcount <= 403199)

Definition at line 321 of file GPSZcount.hpp.

◆ ZCOUNT_DAY

const long gnsstk::GPSZcount::ZCOUNT_DAY = 57600
static

Z-counts per day (57600)

Definition at line 83 of file GPSZcount.hpp.

◆ ZCOUNT_HOUR

const long gnsstk::GPSZcount::ZCOUNT_HOUR = 2400
static

Z-counts per hour (2400)

Definition at line 81 of file GPSZcount.hpp.

◆ ZCOUNT_MINUTE

const long gnsstk::GPSZcount::ZCOUNT_MINUTE = 40
static

Z-counts per minute (40)

Definition at line 79 of file GPSZcount.hpp.

◆ ZCOUNT_WEEK

const long gnsstk::GPSZcount::ZCOUNT_WEEK = 403200
static

Z-counts per whole GPS week. (403200)

Definition at line 85 of file GPSZcount.hpp.


The documentation for this class was generated from the following files:


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