List of all members
gnsstk::CivilTime Class Reference

Detailed Description

This class encapsulates the representation of time consisting of year, month, day (of month), hour (of day), minute (of hour), and second (of minute).

Definition at line 55 of file CivilTime.hpp.

#include <CivilTime.hpp>

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

CivilTime Basic Operations

static const char * MonthNames []
 Long month names for converstion from numbers to strings. More...
 
static const char * MonthAbbrevNames []
 Short month names for converstion from numbers to strings. More...
 
 CivilTime (int yr=0, int mo=0, int dy=0, int hr=0, int mn=0, double s=0.0, const TimeSystem &ts=TimeSystem::Unknown)
 
 CivilTime (const CivilTime &right)
 
 CivilTime (const TimeTag &right)
 
 CivilTime (const CommonTime &right)
 
CivilTimeoperator= (const CivilTime &right)
 
virtual ~CivilTime ()
 Virtual Destructor. More...
 
virtual CommonTime convertToCommonTime () const
 
virtual void convertFromCommonTime (const CommonTime &ct)
 
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...
 
static int monthAbbrev (const std::string &amonStr)
 
static int monthLong (const std::string &monStr)
 

CivilTime Comparison Operators

All comparison operators have a parameter "right" which corresponds to the CivilTime object to the right of the symbol. All comparison operators are const and return true on success and false on failure.

int year
 
int month
 
int day
 
int hour
 
int minute
 
double second
 
bool operator== (const CivilTime &right) const
 
bool operator!= (const CivilTime &right) const
 
bool operator< (const CivilTime &right) const
 
bool operator> (const CivilTime &right) const
 
bool operator<= (const CivilTime &right) const
 
bool operator>= (const CivilTime &right) const
 
double getUTHour () const
 Get the "universal time"-esque fractional hour of day. More...
 

Additional Inherited Members

- Public Types inherited from gnsstk::TimeTag
typedef std::map< char, std::string > IdToValue
 
- Public Member Functions inherited from gnsstk::TimeTag
virtual std::string asString () const
 
bool changeTimeSystem (TimeSystem timeSys)
 
bool changeTimeSystem (TimeSystem timeSys, TimeSystemConverter *conv)
 
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 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

◆ CivilTime() [1/4]

gnsstk::CivilTime::CivilTime ( int  yr = 0,
int  mo = 0,
int  dy = 0,
int  hr = 0,
int  mn = 0,
double  s = 0.0,
const TimeSystem ts = TimeSystem::Unknown 
)
inline

Default Constructor. All elements default to zero.

Definition at line 67 of file CivilTime.hpp.

◆ CivilTime() [2/4]

gnsstk::CivilTime::CivilTime ( const CivilTime right)
inline

Copy Constructor.

Parameters
righta const reference to the CivilTime object to copy

Definition at line 81 of file CivilTime.hpp.

◆ CivilTime() [3/4]

gnsstk::CivilTime::CivilTime ( const TimeTag right)
inline

Alternate Copy Constructor. Takes a const TimeTag reference and copies its contents via conversion to CommonTime.

Parameters
righta const reference to the TimeTag-based object to copy
Exceptions
InvalidRequeston over-/under-flow

Definition at line 93 of file CivilTime.hpp.

◆ CivilTime() [4/4]

gnsstk::CivilTime::CivilTime ( const CommonTime right)
inline

Alternate Copy Constructor. Takes a const CommonTime reference and copies its contents via the convertFromCommonTime method.

Parameters
righta const reference to the CommonTime object to copy
Exceptions
InvalidRequeston over-/under-flow

Definition at line 105 of file CivilTime.hpp.

◆ ~CivilTime()

virtual gnsstk::CivilTime::~CivilTime ( )
inlinevirtual

Virtual Destructor.

Definition at line 118 of file CivilTime.hpp.

Member Function Documentation

◆ convertFromCommonTime()

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

Implements gnsstk::TimeTag.

Definition at line 97 of file CivilTime.cpp.

◆ convertToCommonTime()

CommonTime gnsstk::CivilTime::convertToCommonTime ( ) const
virtual
Exceptions
InvalidRequestif this TimeTag cannot be correctly represented by a CommonTime object.

Implements gnsstk::TimeTag.

Definition at line 75 of file CivilTime.cpp.

◆ getDefaultFormat()

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

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

Implements gnsstk::TimeTag.

Definition at line 157 of file CivilTime.hpp.

◆ getPrintChars()

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

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

Implements gnsstk::TimeTag.

Definition at line 151 of file CivilTime.hpp.

◆ getUTHour()

double gnsstk::CivilTime::getUTHour ( ) const
inline

Get the "universal time"-esque fractional hour of day.

Definition at line 195 of file CivilTime.hpp.

◆ isValid()

bool gnsstk::CivilTime::isValid ( ) const
virtual

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

Implements gnsstk::TimeTag.

Definition at line 262 of file CivilTime.cpp.

◆ monthAbbrev()

int gnsstk::CivilTime::monthAbbrev ( const std::string &  amonStr)
static

Translate a month abbreviation to its integer equivalent. Comparisons are case-insensitive.

Parameters
amonStrthe abbreviated month name.
Returns
month number 1-12 or 0 on error.

Definition at line 282 of file CivilTime.cpp.

◆ monthLong()

int gnsstk::CivilTime::monthLong ( const std::string &  monStr)
static

Translate a month name to its integer equivalent. Comparisons are case-insensitive.

Parameters
monStrthe month name.
Returns
month number 1-12 or 0 on error.

Definition at line 293 of file CivilTime.cpp.

◆ operator!=()

bool gnsstk::CivilTime::operator!= ( const CivilTime right) const

Definition at line 324 of file CivilTime.cpp.

◆ operator<()

bool gnsstk::CivilTime::operator< ( const CivilTime right) const

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

Definition at line 329 of file CivilTime.cpp.

◆ operator<=()

bool gnsstk::CivilTime::operator<= ( const CivilTime right) const

Definition at line 393 of file CivilTime.cpp.

◆ operator=()

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

Assignment Operator.

Parameters
righta const reference to the CivilTime object to copy
Returns
a reference to this CivilTime object

Definition at line 63 of file CivilTime.cpp.

◆ operator==()

bool gnsstk::CivilTime::operator== ( const CivilTime right) const

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

Definition at line 304 of file CivilTime.cpp.

◆ operator>()

bool gnsstk::CivilTime::operator> ( const CivilTime right) const

Definition at line 388 of file CivilTime.cpp.

◆ operator>=()

bool gnsstk::CivilTime::operator>= ( const CivilTime right) const

Definition at line 398 of file CivilTime.cpp.

◆ printError()

std::string gnsstk::CivilTime::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.

Definition at line 148 of file CivilTime.cpp.

◆ printf()

std::string gnsstk::CivilTime::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.

Definition at line 111 of file CivilTime.cpp.

◆ reset()

void gnsstk::CivilTime::reset ( )
virtual

Reset this object to the default state.

Implements gnsstk::TimeTag.

Definition at line 273 of file CivilTime.cpp.

◆ setFromInfo()

bool gnsstk::CivilTime::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.

Definition at line 185 of file CivilTime.cpp.

Member Data Documentation

◆ day

int gnsstk::CivilTime::day

Definition at line 200 of file CivilTime.hpp.

◆ hour

int gnsstk::CivilTime::hour

Definition at line 201 of file CivilTime.hpp.

◆ minute

int gnsstk::CivilTime::minute

Definition at line 202 of file CivilTime.hpp.

◆ month

int gnsstk::CivilTime::month

Definition at line 199 of file CivilTime.hpp.

◆ MonthAbbrevNames

const char * gnsstk::CivilTime::MonthAbbrevNames
static
Initial value:
=
{
"err", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}

Short month names for converstion from numbers to strings.

Definition at line 126 of file CivilTime.hpp.

◆ MonthNames

const char * gnsstk::CivilTime::MonthNames
static
Initial value:
=
{
"Error",
"January","February", "March", "April",
"May", "June","July", "August",
"September", "October", "November", "December"
}

Long month names for converstion from numbers to strings.

Definition at line 123 of file CivilTime.hpp.

◆ second

double gnsstk::CivilTime::second

Definition at line 203 of file CivilTime.hpp.

◆ year

int gnsstk::CivilTime::year

Definition at line 198 of file CivilTime.hpp.


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


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