Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
gnsstk::TimeTag Class Referenceabstract

Detailed Description

This class is an abstract base class inherited by all the classes that provide a specific time representation. These time representations must ensure or provide a way for the user to verify their own self-consistency.

Definition at line 58 of file TimeTag.hpp.

#include <TimeTag.hpp>

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

Public Types

typedef std::map< char, std::string > IdToValue
 

Public Member Functions

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
 
virtual std::string getDefaultFormat () const =0
 Return a string containing the default format to use in printing. More...
 
virtual std::string getPrintChars () const =0
 
TimeSystem getTimeSystem () const
 Obtain time system info (enum). More...
 
virtual bool isValid () const =0
 Returns true if this object's members are valid, false otherwise. 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 reset ()=0
 Reset this object to the default state. More...
 
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...
 

Static Public Member Functions

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

TimeSystem timeSystem
 time system (representation) of the data More...
 

Member Typedef Documentation

◆ IdToValue

typedef std::map< char, std::string> gnsstk::TimeTag::IdToValue

This type maps a character ( from a time format ) to its corresponding value ( from a time string ).

Definition at line 103 of file TimeTag.hpp.

Constructor & Destructor Documentation

◆ TimeTag() [1/2]

gnsstk::TimeTag::TimeTag ( )
inline

Default constructor.

Definition at line 63 of file TimeTag.hpp.

◆ TimeTag() [2/2]

gnsstk::TimeTag::TimeTag ( const TimeSystem ts)
inline

Constructor.

Definition at line 67 of file TimeTag.hpp.

◆ ~TimeTag()

virtual gnsstk::TimeTag::~TimeTag ( )
inlinevirtual

Virtual Destructor.

Definition at line 71 of file TimeTag.hpp.

Member Function Documentation

◆ asString()

virtual std::string gnsstk::TimeTag::asString ( ) const
inlinevirtual

Format this time as a string using a format specified by the inheriting class.

Definition at line 142 of file TimeTag.hpp.

◆ changeTimeSystem() [1/2]

bool gnsstk::TimeTag::changeTimeSystem ( TimeSystem  timeSys)

Modify both the time value and time system to reflect a change in time system.

Parameters
[in]timeSystemThe time system to convert this time to.
Returns
true if successful, false if the static converter CommonTime::tsConv has not been set or is unable to get/apply the time system offset.

Definition at line 194 of file TimeTag.cpp.

◆ changeTimeSystem() [2/2]

bool gnsstk::TimeTag::changeTimeSystem ( TimeSystem  timeSys,
TimeSystemConverter conv 
)

Modify both the time value and time system to reflect a change in time system.

Parameters
[in]timeSystemThe time system to convert this time to.
[in,out]convThe converter object to use to get the offset between the current time system and the requested time system.
Returns
true if successful, false if unable to get/apply the time system offset.

Definition at line 181 of file TimeTag.cpp.

◆ checkTimeSystem()

void gnsstk::TimeTag::checkTimeSystem ( TimeSystem  ts1,
TimeSystem  ts2 
)
static

Check to see if two time systems are comparable (including "Any" handling).

Note
This method replicates the standard time system checking currently in most (all?) TimeTag classes.
Parameters
[in]ts1The first time system.
[in]ts2The second time system.
Exceptions
InvalidRequestif neither ts1 or ts2 are "Any" and they are not equal.

Definition at line 207 of file TimeTag.cpp.

◆ convertFromCommonTime()

virtual void gnsstk::TimeTag::convertFromCommonTime ( const CommonTime ct)
pure virtual
Exceptions
InvalidRequestif ct cannot be correctly represented in this TimeTag object.

Implemented in gnsstk::GLONASSTime, gnsstk::JulianDate, gnsstk::UnixTime, gnsstk::PosixTime, gnsstk::YDSTime, gnsstk::CivilTime, gnsstk::WeekSecond, gnsstk::GPSWeekZcount, gnsstk::ANSITime, and gnsstk::MJD.

◆ convertToCommonTime()

virtual CommonTime gnsstk::TimeTag::convertToCommonTime ( ) const
pure virtual

◆ getDefaultFormat()

virtual std::string gnsstk::TimeTag::getDefaultFormat ( ) const
pure virtual

◆ getError()

static std::string gnsstk::TimeTag::getError ( )
inlinestatic

This returns the default error string for the TimeTag classes.

Definition at line 161 of file TimeTag.hpp.

◆ getFormatPrefixFloat()

static std::string gnsstk::TimeTag::getFormatPrefixFloat ( )
inlinestatic

This returns the regular expression prefix that is used when searching for float specifiers.

Definition at line 157 of file TimeTag.hpp.

◆ getFormatPrefixInt()

static std::string gnsstk::TimeTag::getFormatPrefixInt ( )
inlinestatic

This returns the regular expression prefix that is used when searching for integer specifiers.

Definition at line 152 of file TimeTag.hpp.

◆ getInfo()

void gnsstk::TimeTag::getInfo ( const std::string &  str,
const std::string &  fmt,
IdToValue info 
)
static

This is the workhorse for the scanf family of functions. It parses the given string str with the given format fmt in order to extract a time or part of a time from str.

Parameters
strthe string from which to cull time information
fmtthe string containing the time format
infoa mapping of all of the character identifier to their respective culled time information
Exceptions
StringExceptionon problems parsing the strings.

Definition at line 66 of file TimeTag.cpp.

◆ getPrintChars()

virtual std::string gnsstk::TimeTag::getPrintChars ( ) const
pure virtual

◆ getTimeSystem()

TimeSystem gnsstk::TimeTag::getTimeSystem ( ) const
inline

Obtain time system info (enum).

Definition at line 169 of file TimeTag.hpp.

◆ isValid()

virtual bool gnsstk::TimeTag::isValid ( ) const
pure virtual

◆ operator CommonTime()

virtual gnsstk::TimeTag::operator CommonTime ( ) const
inlinevirtual

Hey, it's an implicit casting operator! Basically just a lazy way to get at convertToCommonTime().

Definition at line 147 of file TimeTag.hpp.

◆ printError()

virtual std::string gnsstk::TimeTag::printError ( const std::string &  fmt) const
pure virtual

◆ printf()

virtual std::string gnsstk::TimeTag::printf ( const std::string &  fmt) const
pure virtual

◆ reset()

virtual void gnsstk::TimeTag::reset ( )
pure virtual

◆ scanf()

void gnsstk::TimeTag::scanf ( const std::string &  str,
const std::string &  fmt 
)
virtual

This function sets this object to the time stored in the given string str.

Parameters
strthe string to parse
fmtthe string containing the time format
Exceptions
InvalidRequestif an invalid time is given.
StringExceptionon problems parsing the strings.

Definition at line 44 of file TimeTag.cpp.

◆ setFromInfo()

virtual bool gnsstk::TimeTag::setFromInfo ( const IdToValue info)
pure 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.

Implemented in gnsstk::GPSWeek, gnsstk::GPSWeekSecond, gnsstk::BDSWeekSecond, gnsstk::IRNWeekSecond, gnsstk::GALWeekSecond, gnsstk::QZSWeekSecond, gnsstk::JulianDate, gnsstk::UnixTime, gnsstk::GLONASSTime, gnsstk::PosixTime, gnsstk::YDSTime, gnsstk::CivilTime, gnsstk::GPSWeekZcount, gnsstk::ANSITime, and gnsstk::MJD.

◆ setTimeSystem()

void gnsstk::TimeTag::setTimeSystem ( const TimeSystem timeSys)
inline

Set method for internal variable timeSystem (enum).

Definition at line 165 of file TimeTag.hpp.

Member Data Documentation

◆ timeSystem

TimeSystem gnsstk::TimeTag::timeSystem
protected

time system (representation) of the data

Definition at line 204 of file TimeTag.hpp.


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


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