Public Member Functions | List of all members
gnsstk::Week Class Referenceabstract

Detailed Description

This class is an abstract base class inherited by other time-related classes that use a "week number + seconds of week" formulation; this includes GPS, GAL, BDS and QZS. It handles only the week number, including rollover and the modulo operation; class WeekSecond inherits this class and handles the seconds-of-week.

The class is abstract because it does not fulfill the abstract methods of the TimeTag class, and because the routines defining the number of bits in the "ModWeek" and the starting epoch are not defined.

The Week class inherits from TimeTag and handles the epoch and N-bit week special cases: getEpoch() returns int (week / rollover) or the number of rollovers, getWeek() returns full week getModWeek() returns week % rollover or the "short week" getEpochModWeek(int& e, int& w) e = getEpoch(); w = getModWeek(); setEpoch(int e) sets week = (week & bitmask) | (e << Nbits); setModWeek(int w) sets week = (week & ~bitmask) | (w & bitmask); setEpochModWeek(int e, int w) calls setEpoch(e); setWeek(w);

Definition at line 81 of file Week.hpp.

#include <Week.hpp>

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

Public Member Functions

virtual int bitmask (void) const =0
 
int MAXWEEK (void) const
 
virtual long MJDEpoch (void) const =0
 
virtual int Nbits (void) const =0
 
Weekoperator= (const Week &right)
 Assignment Operator. More...
 
virtual int rollover (void) const
 
 Week (int w=0, TimeSystem ts=TimeSystem::Unknown)
 Constructor. More...
 
virtual ~Week ()
 Virtual Destructor. More...
 
Comparison Operators.
bool operator== (const Week &right) const
 
bool operator!= (const Week &right) const
 
bool operator< (const Week &right) const
 
bool operator<= (const Week &right) const
 
bool operator> (const Week &right) const
 
bool operator>= (const Week &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 std::string printError (const std::string &fmt) const =0
 
virtual std::string printf (const std::string &fmt) const =0
 
virtual void scanf (const std::string &str, const std::string &fmt)
 
virtual bool setFromInfo (const IdToValue &info)=0
 
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...
 

Special Epoch and Nbit Week Methods.

int week
 Full week number. More...
 
virtual unsigned int getWeek () const
 
virtual unsigned int getModWeek () const
 
virtual unsigned int getEpoch () const
 
virtual void getEpochModWeek (unsigned int &e, unsigned int &w) const
 
virtual void setEpoch (unsigned int e)
 
virtual void setModWeek (unsigned int w)
 
virtual void setEpochModWeek (unsigned int e, unsigned int w)
 
virtual void adjustToYear (unsigned int y)
 
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

◆ Week()

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

Constructor.

Definition at line 122 of file Week.hpp.

◆ ~Week()

virtual gnsstk::Week::~Week ( )
inlinevirtual

Virtual Destructor.

Definition at line 127 of file Week.hpp.

Member Function Documentation

◆ adjustToYear()

virtual void gnsstk::Week::adjustToYear ( unsigned int  y)
inlinevirtual

Definition at line 219 of file Week.hpp.

◆ bitmask()

virtual int gnsstk::Week::bitmask ( void  ) const
pure virtual

Return the bitmask used to get the ModWeek from the full week. This is pure virtual and must be implemented in the derived class; e.g. GPSWeek::bitmask(void) { static const int bm=0x3FF; return bm; }

Implemented in gnsstk::BDSWeekSecond, gnsstk::IRNWeekSecond, gnsstk::QZSWeekSecond, gnsstk::GALWeekSecond, and gnsstk::GPSWeekSecond.

◆ getDayOfWeek()

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

Force this interface on this classes descendants.

Implemented in gnsstk::WeekSecond.

◆ getDefaultFormat()

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

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

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekSecond, gnsstk::BDSWeekSecond, gnsstk::IRNWeekSecond, gnsstk::QZSWeekSecond, and gnsstk::GALWeekSecond.

Definition at line 248 of file Week.hpp.

◆ getEpoch()

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

Definition at line 188 of file Week.hpp.

◆ getEpochModWeek()

virtual void gnsstk::Week::getEpochModWeek ( unsigned int &  e,
unsigned int &  w 
) const
inlinevirtual

Definition at line 193 of file Week.hpp.

◆ getModWeek()

virtual unsigned int gnsstk::Week::getModWeek ( ) const
inlinevirtual

Definition at line 183 of file Week.hpp.

◆ getPrintChars()

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

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

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::GPSWeekSecond, gnsstk::BDSWeekSecond, gnsstk::IRNWeekSecond, gnsstk::QZSWeekSecond, and gnsstk::GALWeekSecond.

Definition at line 242 of file Week.hpp.

◆ getWeek()

virtual unsigned int gnsstk::Week::getWeek ( ) const
inlinevirtual

Definition at line 178 of file Week.hpp.

◆ isValid()

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

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

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::WeekSecond.

Definition at line 253 of file Week.hpp.

◆ MAXWEEK()

int gnsstk::Week::MAXWEEK ( void  ) const
inline

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

Definition at line 115 of file Week.hpp.

◆ MJDEpoch()

virtual long gnsstk::Week::MJDEpoch ( void  ) const
pure virtual

Return the Modified Julian Date (MJD) of epoch for this system. This is pure virtual and must be implemented in the derived class; e.g. long GPSWeek::MJDEpoch(void) { static const long e=GPS_EPOCH_MJD; return e; }

Note
this assumes the epoch(MJD) is integer, i.e. H:M:S=0:0:0; true (so far).

Implemented in gnsstk::BDSWeekSecond, gnsstk::IRNWeekSecond, gnsstk::QZSWeekSecond, gnsstk::GALWeekSecond, and gnsstk::GPSWeekSecond.

◆ Nbits()

virtual int gnsstk::Week::Nbits ( void  ) const
pure virtual

Return the number of bits in the bitmask used to get the ModWeek from the full week. This is pure virtual and must be implemented in the derived class; e.g. GPSWeek::Nbits(void) { static const int n=10; return n; }

Implemented in gnsstk::BDSWeekSecond, gnsstk::IRNWeekSecond, gnsstk::QZSWeekSecond, gnsstk::GALWeekSecond, and gnsstk::GPSWeekSecond.

◆ operator!=()

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

Definition at line 145 of file Week.hpp.

◆ operator<()

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

Definition at line 151 of file Week.hpp.

◆ operator<=()

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

Definition at line 157 of file Week.hpp.

◆ operator=()

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

Assignment Operator.

Definition at line 46 of file Week.cpp.

◆ operator==()

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

Definition at line 135 of file Week.hpp.

◆ operator>()

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

Definition at line 163 of file Week.hpp.

◆ operator>=()

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

Definition at line 169 of file Week.hpp.

◆ reset()

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

Reset this object to the default state.

Implements gnsstk::TimeTag.

Reimplemented in gnsstk::WeekSecond.

Definition at line 258 of file Week.hpp.

◆ rollover()

virtual int gnsstk::Week::rollover ( void  ) const
inlinevirtual

Return the maximum Nbit-week-number minus 1, i.e. the week number at which rollover occurs.

Definition at line 101 of file Week.hpp.

◆ setEpoch()

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

Definition at line 200 of file Week.hpp.

◆ setEpochModWeek()

virtual void gnsstk::Week::setEpochModWeek ( unsigned int  e,
unsigned int  w 
)
inlinevirtual

Definition at line 212 of file Week.hpp.

◆ setModWeek()

virtual void gnsstk::Week::setModWeek ( unsigned int  w)
inlinevirtual

Definition at line 206 of file Week.hpp.

Member Data Documentation

◆ week

int gnsstk::Week::week

Full week number.

Definition at line 267 of file Week.hpp.


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


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