Public Member Functions | Static Public Attributes | List of all members
gnsstk::GPSWeek Class Referenceabstract

Detailed Description

This class is an abstract base class inherited by other GPS-time-related classes. It is abstract because it does not fulfill the abstract methods imposed by the TimeTag class. It handles the week portion of the GPS TimeTag classes.

All of the GPS time classes can be boiled down to just two basic types: GPSWeekZcount and GPSWeekSecond. GPSWeekZcount consists of an integer week and integer zcount. GPSWeekSecond consists of an integer week and double second.

The GPSWeek class inherits from TimeTag and handles the epoch and 10-bit week special cases: getEpoch() returns week / 1024, getWeek10() returns week % 1024, getEpochWeek10(int& e, int& w) e = getEpoch(); w = getWeek10(); setEpoch(int e) sets week = (week & 0x3FF) | (e << 10); setWeek10(int w) sets week = (week & ~0x3FF) | (w & 0x3FF); setEpochWeek10(int e, int w) calls setEpoch(e); setWeek(w);

GPSWeekZcount inherits from GPSWeek and covers all Zcount-related special cases: getZcount29() returns (getWeek10() << 19) | getZcount() getZcount32() returns (getWeek() << 19) | getZcount()

setZcount29(int z) sets week = (z >> 19) & 0x3FF; zcount = z & 0x7FFFF; setZcount32(int z) sets week = z >> 19; zcount = z & 07FFFF;

GPSWeekSecond inherits from GPSWeek. I don't know of any special cases related to second-of-week.

Definition at line 82 of file GPSWeek.hpp.

#include <GPSWeek.hpp>

Inheritance diagram for gnsstk::GPSWeek:
Inheritance graph
[legend]

Public Member Functions

 GPSWeek (int w=0, TimeSystem ts=TimeSystem::Unknown)
 Constructor. More...
 
GPSWeekoperator= (const GPSWeek &right)
 Assignment Operator. More...
 
virtual ~GPSWeek ()
 Virtual Destructor. More...
 
Comparison Operators.
bool operator== (const GPSWeek &right) const
 
bool operator!= (const GPSWeek &right) const
 
bool operator< (const GPSWeek &right) const
 
bool operator<= (const GPSWeek &right) const
 
bool operator> (const GPSWeek &right) const
 
bool operator>= (const GPSWeek &right) const
 
- Public Member Functions inherited from gnsstk::TimeTag
virtual std::string asString () const
 
bool changeTimeSystem (TimeSystem timeSys)
 
bool changeTimeSystem (TimeSystem timeSys, TimeSystemConverter *conv)
 
virtual void convertFromCommonTime (const CommonTime &ct)=0
 
virtual CommonTime convertToCommonTime () const =0
 
TimeSystem getTimeSystem () const
 Obtain time system info (enum). More...
 
virtual operator CommonTime () const
 
virtual void scanf (const std::string &str, const std::string &fmt)
 
void setTimeSystem (const TimeSystem &timeSys)
 Set method for internal variable timeSystem (enum). More...
 
 TimeTag ()
 Default constructor. More...
 
 TimeTag (const TimeSystem &ts)
 Constructor. More...
 
virtual ~TimeTag ()
 Virtual Destructor. More...
 

Static Public Attributes

static const GNSSTK_EXPORT int bits10 = 0x3FF
 
static const GNSSTK_EXPORT int MAX_WEEK =(CommonTime::END_LIMIT_JDAY-MJD_JDAY-GPS_EPOCH_MJD)/7
 

Special Epoch and 10-bit Week Methods.

Todo:
Should the "set" methods return a reference?
int week
 
virtual unsigned int getEpoch () const
 
virtual unsigned int getWeek10 () const
 
virtual void getEpochWeek10 (unsigned int &e, unsigned int &w) const
 
virtual void setEpoch (unsigned int e)
 
virtual void setWeek10 (unsigned int w)
 
virtual void setEpochWeek10 (unsigned int e, unsigned int w)
 
virtual std::string printf (const std::string &fmt) const
 
virtual std::string printError (const std::string &fmt) const
 
virtual bool setFromInfo (const IdToValue &info)
 
virtual std::string getPrintChars () const
 
virtual std::string getDefaultFormat () const
 Return a string containing the default format to use in printing. More...
 
virtual bool isValid () const
 Returns true if this object's members are valid, false otherwise. More...
 
virtual void reset ()
 Reset this object to the default state. More...
 
virtual unsigned int getDayOfWeek () const =0
 Force this interface on this classes descendants. More...
 

Additional Inherited Members

- Public Types inherited from gnsstk::TimeTag
typedef std::map< char, std::string > IdToValue
 
- Static Public Member Functions inherited from gnsstk::TimeTag
static void checkTimeSystem (TimeSystem ts1, TimeSystem ts2)
 
static std::string getError ()
 This returns the default error string for the TimeTag classes. More...
 
static std::string getFormatPrefixFloat ()
 
static std::string getFormatPrefixInt ()
 
static void getInfo (const std::string &str, const std::string &fmt, IdToValue &info)
 
- Protected Attributes inherited from gnsstk::TimeTag
TimeSystem timeSystem
 time system (representation) of the data More...
 

Constructor & Destructor Documentation

◆ GPSWeek()

gnsstk::GPSWeek::GPSWeek ( int  w = 0,
TimeSystem  ts = TimeSystem::Unknown 
)
inline

Constructor.

Definition at line 93 of file GPSWeek.hpp.

◆ ~GPSWeek()

virtual gnsstk::GPSWeek::~GPSWeek ( )
inlinevirtual

Virtual Destructor.

Definition at line 99 of file GPSWeek.hpp.

Member Function Documentation

◆ getDayOfWeek()

virtual unsigned int gnsstk::GPSWeek::getDayOfWeek ( ) const
pure virtual

Force this interface on this classes descendants.

Implemented in gnsstk::GPSWeekZcount.

◆ getDefaultFormat()

virtual std::string gnsstk::GPSWeek::getDefaultFormat ( ) const
inlinevirtual

Return a string containing the default format to use in printing.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekZcount.

Definition at line 253 of file GPSWeek.hpp.

◆ getEpoch()

virtual unsigned int gnsstk::GPSWeek::getEpoch ( ) const
inlinevirtual

Definition at line 192 of file GPSWeek.hpp.

◆ getEpochWeek10()

virtual void gnsstk::GPSWeek::getEpochWeek10 ( unsigned int &  e,
unsigned int &  w 
) const
inlinevirtual

Definition at line 202 of file GPSWeek.hpp.

◆ getPrintChars()

virtual std::string gnsstk::GPSWeek::getPrintChars ( ) const
inlinevirtual

Return a string containing the characters that this class understands when printing times.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekZcount.

Definition at line 247 of file GPSWeek.hpp.

◆ getWeek10()

virtual unsigned int gnsstk::GPSWeek::getWeek10 ( ) const
inlinevirtual

Definition at line 197 of file GPSWeek.hpp.

◆ isValid()

virtual bool gnsstk::GPSWeek::isValid ( ) const
inlinevirtual

Returns true if this object's members are valid, false otherwise.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekZcount.

Definition at line 258 of file GPSWeek.hpp.

◆ operator!=()

bool gnsstk::GPSWeek::operator!= ( const GPSWeek right) const
inline

Any (wildcard) type exception allowed, otherwise must be same time systems

Definition at line 118 of file GPSWeek.hpp.

◆ operator<()

bool gnsstk::GPSWeek::operator< ( const GPSWeek right) const
inline

Any (wildcard) type exception allowed, otherwise must be same time systems

Definition at line 132 of file GPSWeek.hpp.

◆ operator<=()

bool gnsstk::GPSWeek::operator<= ( const GPSWeek right) const
inline

Any (wildcard) type exception allowed, otherwise must be same time systems

Definition at line 146 of file GPSWeek.hpp.

◆ operator=()

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

Assignment Operator.

Definition at line 48 of file GPSWeek.cpp.

◆ operator==()

bool gnsstk::GPSWeek::operator== ( const GPSWeek right) const
inline

Any (wildcard) type exception allowed, otherwise must be same time systems

Definition at line 107 of file GPSWeek.hpp.

◆ operator>()

bool gnsstk::GPSWeek::operator> ( const GPSWeek right) const
inline

Any (wildcard) type exception allowed, otherwise must be same time systems

Definition at line 160 of file GPSWeek.hpp.

◆ operator>=()

bool gnsstk::GPSWeek::operator>= ( const GPSWeek right) const
inline

Any (wildcard) type exception allowed, otherwise must be same time systems

Definition at line 174 of file GPSWeek.hpp.

◆ printError()

std::string gnsstk::GPSWeek::printError ( const std::string &  fmt) const
virtual

This function works similarly to printf. Instead of filling the format with data, it fills with error messages.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekZcount.

Definition at line 78 of file GPSWeek.cpp.

◆ printf()

std::string gnsstk::GPSWeek::printf ( const std::string &  fmt) const
virtual

This function formats this time to a string. The exceptions thrown would only be due to problems parsing the fmt string.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekZcount.

Definition at line 55 of file GPSWeek.cpp.

◆ reset()

virtual void gnsstk::GPSWeek::reset ( )
inlinevirtual

Reset this object to the default state.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekZcount.

Definition at line 263 of file GPSWeek.hpp.

◆ setEpoch()

virtual void gnsstk::GPSWeek::setEpoch ( unsigned int  e)
inlinevirtual

Definition at line 209 of file GPSWeek.hpp.

◆ setEpochWeek10()

virtual void gnsstk::GPSWeek::setEpochWeek10 ( unsigned int  e,
unsigned int  w 
)
inlinevirtual

Definition at line 221 of file GPSWeek.hpp.

◆ setFromInfo()

bool gnsstk::GPSWeek::setFromInfo ( const IdToValue info)
virtual

Set this object using the information provided in info.

Parameters
infothe IdToValue object to which this object shall be set.
Returns
true if this object was successfully set using the data in info, false if not.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekZcount.

Definition at line 107 of file GPSWeek.cpp.

◆ setWeek10()

virtual void gnsstk::GPSWeek::setWeek10 ( unsigned int  w)
inlinevirtual

Definition at line 215 of file GPSWeek.hpp.

Member Data Documentation

◆ bits10

const GNSSTK_EXPORT int gnsstk::GPSWeek::bits10 = 0x3FF
static

This is a 10-bit mask used in the several special Epoch and 10-bit Week methods.

Definition at line 87 of file GPSWeek.hpp.

◆ MAX_WEEK

const int gnsstk::GPSWeek::MAX_WEEK =(CommonTime::END_LIMIT_JDAY-MJD_JDAY-GPS_EPOCH_MJD)/7
static

This is the greatest week value for which a conversion to or from CommonTime would work.

Definition at line 90 of file GPSWeek.hpp.

◆ week

int gnsstk::GPSWeek::week

Definition at line 271 of file GPSWeek.hpp.


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


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