TimeTag Class Reference

#include <TimeTag.hpp>

Inheritance diagram for TimeTag:

Inheritance graph
[legend]
List of all members.

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 41 of file TimeTag.hpp.

Public Types

typedef std::map< char, std::string > IdToValue
 This type maps a character ( from a time format ) to its corresponding value ( from a time string ).

Public Member Functions

virtual ~TimeTag () throw ()
 Virtual Destructor.
virtual CommonTime convertToCommonTime () const =0 throw ( gpstk::InvalidRequest )
 
Exceptions:
InvalidRequest if this TimeTag cannot be correctly represented by a CommonTime object.

virtual void convertFromCommonTime (const CommonTime &ct)=0 throw ( gpstk::InvalidRequest )
 
Exceptions:
InvalidRequest if ct cannot be correctly represented in this TimeTag object.

virtual std::string printf (const std::string &fmt) const =0 throw ( gpstk::StringUtils::StringException )
 This function formats this time to a string.
virtual std::string printError (const std::string &fmt) const =0 throw ( gpstk::StringUtils::StringException )
 This function works similarly to printf.
virtual void scanf (const std::string &str, const std::string &fmt) throw ( gpstk::InvalidRequest, gpstk::StringUtils::StringException )
 This function sets this object to the time stored in the given string str.
virtual bool setFromInfo (const IdToValue &info)=0 throw ()
 Set this object using the information provided in info.
virtual std::string getPrintChars () const =0 throw ()
 Return a string containing the characters that this class understands when printing times.
virtual std::string getDefaultFormat () const =0 throw ()
 Return a string containing the default format to use in printing.
virtual bool isValid () const =0 throw ()
 Returns true if this object's members are valid, false otherwise.
virtual void reset ()=0 throw ()
 Reset this object to the default state.
virtual std::string asString () const throw ( gpstk::StringUtils::StringException )
 Format this time as a string using a format specified by the inheriting class.
virtual operator CommonTime () const throw (InvalidRequest)
 Hey, it's an implicit casting operator! Basically just a lazy way to get at convertToCommonTime().

Static Public Member Functions

void getInfo (const std::string &str, const std::string &fmt, IdToValue &info) throw ( gpstk::StringUtils::StringException )
 This is the workhorse for the scanf family of functions.
std::string getFormatPrefixInt ()
 This returns the regular expression prefix that is used when searching for integer specifiers.
std::string getFormatPrefixFloat ()
 This returns the regular expression prefix that is used when searching for float specifiers.
std::string getError ()
 This returns the default error string for the TimeTag classes.


Member Typedef Documentation

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

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

Definition at line 85 of file TimeTag.hpp.


Constructor & Destructor Documentation

virtual ~TimeTag  )  throw () [inline, virtual]
 

Virtual Destructor.

Definition at line 46 of file TimeTag.hpp.


Member Function Documentation

virtual std::string asString  )  const throw ( gpstk::StringUtils::StringException ) [inline, virtual]
 

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

Definition at line 130 of file TimeTag.hpp.

virtual void convertFromCommonTime const CommonTime ct  )  throw ( gpstk::InvalidRequest ) [pure virtual]
 

Exceptions:
InvalidRequest if ct cannot be correctly represented in this TimeTag object.

Implemented in ANSITime, CivilTime, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

Referenced by Test::toCommonAndBack().

virtual CommonTime convertToCommonTime  )  const throw ( gpstk::InvalidRequest ) [pure virtual]
 

Exceptions:
InvalidRequest if this TimeTag cannot be correctly represented by a CommonTime object.

Implemented in ANSITime, CivilTime, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

Referenced by Test::dumpCommonTime().

virtual std::string getDefaultFormat  )  const throw () [pure virtual]
 

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

Implemented in ANSITime, CivilTime, GPSWeek, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

Referenced by operator<<().

std::string getError  )  [inline, static]
 

This returns the default error string for the TimeTag classes.

Definition at line 151 of file TimeTag.hpp.

std::string getFormatPrefixFloat  )  [inline, static]
 

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

Definition at line 147 of file TimeTag.hpp.

std::string getFormatPrefixInt  )  [inline, static]
 

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

Definition at line 142 of file TimeTag.hpp.

void getInfo const std::string &  str,
const std::string &  fmt,
IdToValue info
throw ( gpstk::StringUtils::StringException ) [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:
str the string from which to cull time information
fmt the string containing the time format
info a mapping of all of the character identifier to their respective culled time information
Exceptions:
StringException on problems parsing the strings.

Definition at line 56 of file TimeTag.cpp.

References gpstk::StringUtils::asInt(), GPSTK_RETHROW, and gpstk::StringUtils::stripLeading().

virtual std::string getPrintChars  )  const throw () [pure virtual]
 

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

Implemented in ANSITime, CivilTime, GPSWeek, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

virtual bool isValid  )  const throw () [pure virtual]
 

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

Implemented in ANSITime, CivilTime, GPSWeek, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

virtual operator CommonTime  )  const throw (InvalidRequest) [inline, virtual]
 

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

Definition at line 136 of file TimeTag.hpp.

virtual std::string printError const std::string &  fmt  )  const throw ( gpstk::StringUtils::StringException ) [pure virtual]
 

This function works similarly to printf.

Instead of filling the format with data, it fills with error messages.

Implemented in ANSITime, CivilTime, GPSWeek, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

virtual std::string printf const std::string &  fmt  )  const throw ( gpstk::StringUtils::StringException ) [pure virtual]
 

This function formats this time to a string.

The exceptions thrown would only be due to problems parsing the fmt string.

Implemented in ANSITime, CivilTime, GPSWeek, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

Referenced by operator<<().

virtual void reset  )  throw () [pure virtual]
 

Reset this object to the default state.

Implemented in ANSITime, CivilTime, GPSWeek, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.

void scanf const std::string &  str,
const std::string &  fmt
throw ( gpstk::InvalidRequest, gpstk::StringUtils::StringException ) [virtual]
 

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

Parameters:
str the string to parse
fmt the string containing the time format
Exceptions:
InvalidRequest if an invalid time is given.
StringException on problems parsing the strings.

Definition at line 32 of file TimeTag.cpp.

References GPSTK_RETHROW, and GPSTK_THROW.

Referenced by Test::otherTest().

virtual bool setFromInfo const IdToValue info  )  throw () [pure virtual]
 

Set this object using the information provided in info.

Parameters:
info the 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 ANSITime, CivilTime, GPSWeek, GPSWeekSecond, GPSWeekZcount, JulianDate, MJD, UnixTime, and YDSTime.


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