GPSZcount Class Reference
[GPStk Time Group]

#include <GPSZcount.hpp>

List of all members.


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 76 of file GPSZcount.hpp.

Public Member Functions

 GPSZcount (short inWeek, long inZcount) throw (gpstk::InvalidParameter)
 Separate Week and Z-count Constructor.
 GPSZcount (long inFullZcount=0) throw (gpstk::InvalidParameter)
 Full Z-count Constructor.
 ~GPSZcount () throw ()
 Destructor. Does nothing.
 GPSZcount (const GPSZcount &right) throw ()
 Copy Constructor.
short getWeek () const throw ()
 GPS week accessor.
long getZcount () const throw ()
 GPS Z-count accessor.
long getFullZcount () const throw ()
 Construct, from the data members, the Z-count which could have been broadcast from an SV.
double getTotalZcounts () const throw ()
 Calculate the total number of Z-counts in this object.
GPSZcountsetWeek (short inWeek) throw (gpstk::InvalidParameter)
 Set the GPS week.
GPSZcountsetZcount (long inZcount) throw (gpstk::InvalidParameter)
 Set the GPS Z-count.
GPSZcountsetFullZcount (long inZcount) throw (gpstk::InvalidParameter)
 Set the GPS Week and Z-count using the value broadcast from an SV.
GPSZcountaddWeeks (short inWeeks) throw (gpstk::InvalidRequest)
 Add the given number of weeks to the current value.
GPSZcountaddZcounts (long inZcounts) throw (gpstk::InvalidRequest)
 Add the given number of Z-counts to the current value.
GPSZcount operator++ (int) throw (gpstk::InvalidRequest)
 Postfix Increment the Z-count in this object (x++).
GPSZcountoperator++ () throw (gpstk::InvalidRequest)
 Prefix Increment the Z-count in this object (++x).
GPSZcount operator-- (int) throw (gpstk::InvalidRequest)
 Postfix Decrement the Z-count in this object (x--).
GPSZcountoperator-- () throw (gpstk::InvalidRequest)
 Prefix Decrement the Z-count in this object (--x).
GPSZcount operator+ (long inZcounts) const throw (gpstk::InvalidRequest)
 Add the given number of Z-counts to the current value.
GPSZcount operator- (long inZcounts) const throw (gpstk::InvalidRequest)
 Subtract the given number of Z-counts from the current value.
double operator- (const GPSZcount &right) const throw ()
 Compute the time differenct between this object and right.
long operator% (const long right) const throw ()
 Compute the remainder of the ztime.
GPSZcountoperator+= (long inZcounts) throw (gpstk::InvalidRequest)
 Add the given number of Z-counts to the current value.
GPSZcountoperator-= (long inZcounts) throw (gpstk::InvalidRequest)
 Subtract the given number of Z-counts from the current value.
GPSZcountoperator= (const GPSZcount &right) throw ()
 Assignment operator.
bool operator< (const GPSZcount &right) const throw ()
 Comparison operator (less-than).
bool operator> (const GPSZcount &right) const throw ()
 Comparison operator (greater-than).
bool operator== (const GPSZcount &right) const throw ()
 Equality operator.
bool operator!= (const GPSZcount &right) const throw ()
 Inequality operator.
bool operator<= (const GPSZcount &right) const throw ()
 Comparison operator (less-than or equal-to).
bool operator>= (const GPSZcount &right) const throw ()
 Comparison operator (greater-than or equal-to).
 operator std::string () const throw ()
 Convert this object to a string.
bool inSameTimeBlock (const GPSZcount &other, unsigned long inZcountBlock, unsigned long inZcountOffset=0) throw ()
 This is a test of whether or not this object and the given GPSZcount object are within the same time-block.
void dump (std::ostream &out, short level=0) const throw ()
 Dump the contents of this object to the given output stream.

Static Public Attributes

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

Static Protected Member Functions

long validZcount (long z) throw ()
 Check the validity of the given Z-count.

Protected Attributes

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


Constructor & Destructor Documentation

GPSZcount short  inWeek,
long  inZcount
throw (gpstk::InvalidParameter)
 

Separate Week and Z-count Constructor.

Parameters:
inWeek the GPS week to use in this object.
inZcount the GPS Z-count to use in this object.
Exceptions:
gpstk::InvalidParameter if either inWeek or inZcount are invalid values for their respective types.

Definition at line 47 of file GPSZcount.cpp.

References GPSTK_RETHROW.

GPSZcount long  inFullZcount = 0  )  throw (gpstk::InvalidParameter)
 

Full Z-count Constructor.

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

Definition at line 62 of file GPSZcount.cpp.

References GPSTK_RETHROW.

~GPSZcount  )  throw () [inline]
 

Destructor. Does nothing.

Definition at line 108 of file GPSZcount.hpp.

GPSZcount const GPSZcount right  )  throw ()
 

Copy Constructor.

Parameters:
right the GPSZcount object to copy

Definition at line 75 of file GPSZcount.cpp.


Member Function Documentation

GPSZcount & addWeeks short  inWeeks  )  throw (gpstk::InvalidRequest)
 

Add the given number of weeks to the current value.

Parameters:
inWeeks the number of weeks to add to the current value.
Returns:
a reference to this object
Exceptions:
gpstk::InvalidRequest if adding inWeeks would render this object invalid.

Definition at line 127 of file GPSZcount.cpp.

References Exception::addText(), gpstk::StringUtils::asString(), and GPSTK_THROW.

GPSZcount & addZcounts long  inZcounts  )  throw (gpstk::InvalidRequest)
 

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:
inZcounts the number of Z-counts to add to the current value.
Returns:
a reference to this object
Exceptions:
gpstk::InvalidRequest if adding inZcounts would render this object invalid.

Definition at line 148 of file GPSZcount.cpp.

References Exception::addText(), gpstk::StringUtils::asString(), GPSTK_RETHROW, and GPSTK_THROW.

Referenced by GPSZcount::operator+(), GPSZcount::operator++(), and GPSZcount::operator--().

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

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

Parameters:
out the output stream to write to
level the level of verbosity to use (default=0)

Definition at line 367 of file GPSZcount.cpp.

Referenced by main(), and gpstk::operator<<().

long getFullZcount  )  const throw () [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 129 of file GPSZcount.hpp.

double getTotalZcounts  )  const throw () [inline]
 

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

Returns:
weeks * ZCOUNT_WEEK + zcount

Definition at line 136 of file GPSZcount.hpp.

short getWeek  )  const throw () [inline]
 

GPS week accessor.

Definition at line 117 of file GPSZcount.hpp.

Referenced by main().

long getZcount  )  const throw () [inline]
 

GPS Z-count accessor.

Definition at line 121 of file GPSZcount.hpp.

Referenced by main().

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

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:
other the other GPSZcount object
inZcountBlock the number of Z-counts in a time-block
inZcountOffset the 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 338 of file GPSZcount.cpp.

operator std::string  )  const throw ()
 

Convert this object to a string.

Definition at line 332 of file GPSZcount.cpp.

bool operator!= const GPSZcount right  )  const throw ()
 

Inequality operator.

Definition at line 314 of file GPSZcount.cpp.

References gpstk::operator==().

long operator% const long  right  )  const throw ()
 

Compute the remainder of the ztime.

Parameters:
right the number to
Returns:
z counts right

Definition at line 247 of file GPSZcount.cpp.

GPSZcount operator+ long  inZcounts  )  const throw (gpstk::InvalidRequest)
 

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:
inZcounts the number of Z-counts to add to the current value.
Returns:
a modified GPSZcount object
Exceptions:
gpstk::InvalidRequest if adding inZcounts would render this object invalid.

Definition at line 228 of file GPSZcount.cpp.

References GPSZcount::addZcounts().

GPSZcount & operator++  )  throw (gpstk::InvalidRequest)
 

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:
gpstk::InvalidRequest if Z-count increment would render this object invalid.

Definition at line 208 of file GPSZcount.cpp.

References GPSZcount::addZcounts().

GPSZcount operator++ int   )  throw (gpstk::InvalidRequest)
 

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:
gpstk::InvalidRequest if Z-count increment would render this object invalid.

Definition at line 200 of file GPSZcount.cpp.

GPSZcount & operator+= long  inZcounts  )  throw (gpstk::InvalidRequest)
 

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:
inZcounts the number of Z-counts to add to the current value.
Returns:
a reference to this object
Exceptions:
gpstk::InvalidRequest if adding inZcounts would render this object invalid.

Definition at line 253 of file GPSZcount.cpp.

double operator- const GPSZcount right  )  const throw ()
 

Compute the time differenct between this object and right.

Parameters:
right the 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 240 of file GPSZcount.cpp.

GPSZcount operator- long  inZcounts  )  const throw (gpstk::InvalidRequest)
 

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:
inZcounts the number of Z-counts to subtract from the current value.
Returns:
a modified GPSZcount object
Exceptions:
gpstk::InvalidRequest if subtracting inZcounts would render this object invalid.

Definition at line 234 of file GPSZcount.cpp.

References gpstk::operator+().

GPSZcount & operator--  )  throw (gpstk::InvalidRequest)
 

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:
gpstk::InvalidRequest if a Z-count decrement would render this object invalid.

Definition at line 222 of file GPSZcount.cpp.

References GPSZcount::addZcounts().

GPSZcount operator-- int   )  throw (gpstk::InvalidRequest)
 

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:
gpstk::InvalidRequest if a Z-count decrement would render this object invalid.

Definition at line 214 of file GPSZcount.cpp.

GPSZcount & operator-= long  inZcounts  )  throw (gpstk::InvalidRequest)
 

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:
inZcounts the number of Z-counts to subtract from the current value.
Returns:
a reference to this object
Exceptions:
gpstk::InvalidRequest if subtracting inZcounts would render this object invalid.

Definition at line 259 of file GPSZcount.cpp.

bool operator< const GPSZcount right  )  const throw ()
 

Comparison operator (less-than).

Definition at line 273 of file GPSZcount.cpp.

bool operator<= const GPSZcount right  )  const throw ()
 

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

Definition at line 320 of file GPSZcount.cpp.

References gpstk::operator>().

GPSZcount & operator= const GPSZcount right  )  throw ()
 

Assignment operator.

Definition at line 265 of file GPSZcount.cpp.

bool operator== const GPSZcount right  )  const throw ()
 

Equality operator.

Definition at line 303 of file GPSZcount.cpp.

bool operator> const GPSZcount right  )  const throw ()
 

Comparison operator (greater-than).

Definition at line 288 of file GPSZcount.cpp.

bool operator>= const GPSZcount right  )  const throw ()
 

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

Definition at line 326 of file GPSZcount.cpp.

References gpstk::operator<().

GPSZcount & setFullZcount long  inZcount  )  throw (gpstk::InvalidParameter)
 

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

Parameters:
inZcount A full Z-count (3 MSB unused, next 10 bits = week, 19 LSB = Z-count)
Exceptions:
gpstk::InvalidParameter if the extracted Z-count is an invalid value for a GPS Z-count.

Definition at line 107 of file GPSZcount.cpp.

References GPSTK_RETHROW.

GPSZcount & setWeek short  inWeek  )  throw (gpstk::InvalidParameter)
 

Set the GPS week.

Parameters:
inWeek the new value for GPS Week.
Returns:
a reference to this object.
Exceptions:
gpstk::InvalidParameter if inWeek is an invalid value for a GPS week.

Definition at line 81 of file GPSZcount.cpp.

References GPSTK_THROW.

Referenced by main().

GPSZcount & setZcount long  inZcount  )  throw (gpstk::InvalidParameter)
 

Set the GPS Z-count.

Parameters:
inZcount the new value for GPS Z-count.
Returns:
a reference to this object.
Exceptions:
gpstk::InvalidParameter if inZcount is an invalid value for a GPS Z-count.

Definition at line 94 of file GPSZcount.cpp.

References GPSTK_THROW.

Referenced by main().

long validZcount long  z  )  throw () [static, protected]
 

Check the validity of the given Z-count.

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

Definition at line 384 of file GPSZcount.cpp.


Member Data Documentation

short week [protected]
 

GPS full week. (0 <= week).

Definition at line 351 of file GPSZcount.hpp.

long zcount [protected]
 

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

Definition at line 352 of file GPSZcount.hpp.

const long ZCOUNT_DAY = 57600 [static]
 

Z-counts per day (57600).

Definition at line 44 of file GPSZcount.cpp.

const long ZCOUNT_HOUR = 2400 [static]
 

Z-counts per hour (2400).

Definition at line 43 of file GPSZcount.cpp.

const long ZCOUNT_MINUTE = 40 [static]
 

Z-counts per minute (40).

Definition at line 42 of file GPSZcount.cpp.

const long ZCOUNT_WEEK = 403200 [static]
 

Z-counts per whole GPS week. (403200).

Definition at line 45 of file GPSZcount.cpp.


The documentation for this class was generated from the following files:
Generated on Wed Feb 8 03:31:39 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1