CppEphem
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CERunningDate Class Reference

This class represents a date object that always represents the current instantaneous date

Details

Subsequent evaluations of the underlying methods return different values. The speed of ellapsed time by be computed using the SetTimerSpeed method, thus allowing the user to speed up, slow down, or even reverse the passage of time for this object.

The object may be evaluated in one of several ways to get the current value:

Definition at line 29 of file CERunningDate.h.

Public Member Functions

 CERunningDate ()
 Default constructor. More...
 
 CERunningDate (const CERunningDate &other)
 Copy constructor. More...
 
virtual double GetTimerSpeed (void) const
 Get the rate at which the timer is progressing. More...
 
virtual double Gregorian () const
 Get the current Gregorian calendar date formatted as YYYYMMDD.D. More...
 
virtual double JD () const
 Get the current Julian date. More...
 
virtual double MJD () const
 Get the current modified Julian date. More...
 
CERunningDateoperator= (const CERunningDate &other)
 Copy assignment operator. More...
 
void ResetTime (void)
 Method for resetting the 'start' variable. More...
 
virtual double RunTime (void) const
 Method for getting the number of seconds since this object was created or reset. More...
 
double ScaledRunTime (void) const
 Return the scaled ellapsed time since this object was created. More...
 
virtual void SetTimerSpeed (const double &scale=1.0)
 Set the rate at which the timer progresses. More...
 
virtual ~CERunningDate ()
 Destructor. More...
 
- Public Member Functions inherited from CEDate
 CEDate (const CEDate &other)
 Copy constructor. More...
 
 CEDate (double date=CurrentJD(), CEDateType date_format=CEDateType::JD)
 Constructor from some date format. More...
 
 CEDate (std::vector< double > date)
 Constructor from a set of Gregorian values. More...
 
int Day ()
 Get the Gregorian calendar day. More...
 
double DayFraction ()
 Get the Gregorian calendar day fraction. More...
 
double dut1 (void) const
 Return dut1 based on the date represented by this object. More...
 
double GetDate (CEDateType time_format=CEDateType::JD) const
 Return the date in a given format. More...
 
virtual double GetSecondsSinceMidnight (const double &utc_offset=0.0)
 Method for getting the number of seconds since midnight. More...
 
virtual double GetTime (const double &utc_offset=0.0) const
 Method for getting the current time. More...
 
virtual double GetTime_UTC () const
 Method for getting the current UTC time. More...
 
virtual std::vector< double > GregorianVect ()
 Get the Gregorian calendar date formatted as a vector. More...
 
int Month ()
 Get the Gregorian calendar month. More...
 
 operator double ()
 Overload of the CEDate object which allows the object to be treated as a 'double' representing the date formatted according to 'return_type_'. More...
 
 operator double () const
 Overload of the CEDate object which allows the object to be treated as a 'double' representing the date formatted according to 'return_type_'. More...
 
CEDateoperator= (const CEDate &other)
 Copy assignent operator. More...
 
virtual void SetDate (const double &date=CurrentJD(), const CEDateType &time_format=CEDateType::JD)
 Set the date based on an actual date and the desired time_format. More...
 
virtual void SetDate (std::vector< double > date)
 Set the date based on an actual date and the desired time_format. More...
 
void SetReturnType (CEDateType return_type)
 Set the return type from the overloaded 'operator double'. More...
 
double xpolar (void) const
 Polar motion (x) for a given date. More...
 
int Year ()
 Get the Gregorian calendar year. More...
 
double ypolar (void) const
 Polar motion (y) for a given date. More...
 
virtual ~CEDate ()
 Destructor. More...
 

Private Member Functions

void copy_members (const CERunningDate &other)
 Copy data members from another object. More...
 
void free_members (void)
 Deallocate data members. More...
 
void init_members (void)
 Initialize data members. More...
 

Private Attributes

std::chrono::high_resolution_clock::time_point start_
 Variable to hold the starting time. More...
 
double timer_speed_factor_
 Variable that can be used to speed up, slow down, or reverse the rate of time. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CEDate
static double CurrentJD ()
 Static method for getting the current Julian date. More...
 
static double dut1 (const double &date, const CEDateType &date_type=CEDateType::JD)
 Return dut1 based on a given modified date. More...
 
static double GetMJD2JDFactor ()
 Gets the stored SOFA Julian date to Mod Julian date factor 'DJM0'. More...
 
static std::vector< double > Gregorian2GregorianVect (double gregorian)
 Helper method for converting from non-vector formatted Gregorian date to vector format Gregorian date. More...
 
static double Gregorian2JD (double gregorian)
 Gregorian calendar date -> Julian date. More...
 
static double Gregorian2MJD (double gregorian)
 Gregorian calendar formatted date -> Julian date converter. More...
 
static double GregorianVect2Gregorian (std::vector< double > gregorian)
 Helper method for converting from Gregorian vector format to the non-vector format. More...
 
static double GregorianVect2JD (std::vector< double > gregorian)
 Gregorian calendar vector formatted date -> Julian date converter. More...
 
static double GregorianVect2MJD (std::vector< double > gregorian)
 Gregorian calendar vector formatted date -> Modified Julian date converter. More...
 
static double JD2Gregorian (const double jd)
 Julian date -> Gregorian calendar date conversion method. More...
 
static std::vector< double > JD2GregorianVect (double jd)
 Julian date -> modified Julian date conversion method. More...
 
static double JD2MJD (double jd)
 Julian date -> modified Julian date conversion method. More...
 
static double MJD2Gregorian (double mjd)
 Modified Julian date -> Gregorian calendar date conversion method. More...
 
static std::vector< double > MJD2GregorianVect (double mjd)
 Modified Julian date -> Gregorian calendar, vector formatted date. More...
 
static double MJD2JD (double mjd)
 Modified Julian date -> Julian date conversion method. More...
 
static void UTC2TDB (const double &mjd, double *tdb1, double *tdb2)
 Convert the UTC MJD to TDB JD (useful for planet computations) More...
 
static void UTC2TT (const double &mjd, double *tt1, double *tt2)
 Convert the UTC MJD to TT JD. More...
 
static void UTC2UT1 (const double &mjd, double *ut11, double *ut12)
 Convert the UTC MJD to UT1 JD. More...
 
static double xpolar (const double &date, const CEDateType &date_type=CEDateType::JD)
 Polar motion (x) for a given date. More...
 
static double ypolar (const double &date, const CEDateType &date_type=CEDateType::JD)
 Polar motion (xy for a given date. More...
 

#include <CERunningDate.h>

Inheritance diagram for CERunningDate:
Inheritance graph
[legend]
Collaboration diagram for CERunningDate:
Collaboration graph
[legend]

Constructor & Destructor Documentation

◆ CERunningDate() [1/2]

CERunningDate::CERunningDate ( )

Default constructor.

Definition at line 46 of file CERunningDate.cpp.

◆ CERunningDate() [2/2]

CERunningDate::CERunningDate ( const CERunningDate other)

Copy constructor.

Parameters
[in]otherCERunningDate object to copy from

Definition at line 58 of file CERunningDate.cpp.

◆ ~CERunningDate()

CERunningDate::~CERunningDate ( )
virtual

Destructor.

Definition at line 69 of file CERunningDate.cpp.

Member Function Documentation

◆ copy_members()

void CERunningDate::copy_members ( const CERunningDate other)
private

Copy data members from another object.

Parameters
[in]otherCERunningDate object to copy from

Definition at line 147 of file CERunningDate.cpp.

◆ free_members()

void CERunningDate::free_members ( void  )
private

Deallocate data members.

Definition at line 167 of file CERunningDate.cpp.

◆ GetTimerSpeed()

double CERunningDate::GetTimerSpeed ( void  ) const
inlinevirtual

Get the rate at which the timer is progressing.

Returns
Time scale factor

Definition at line 71 of file CERunningDate.h.

◆ Gregorian()

double CERunningDate::Gregorian ( void  ) const
virtual

Get the current Gregorian calendar date formatted as YYYYMMDD.D.

Returns
Instantaneous Gregorian calendar date formatted as YYYYMMDD.D

Reimplemented from CEDate.

Definition at line 117 of file CERunningDate.cpp.

◆ init_members()

void CERunningDate::init_members ( void  )
private

Initialize data members.

Definition at line 157 of file CERunningDate.cpp.

◆ JD()

double CERunningDate::JD ( void  ) const
virtual

Get the current Julian date.

Returns
Instantaneous Julian date

Reimplemented from CEDate.

Definition at line 96 of file CERunningDate.cpp.

◆ MJD()

double CERunningDate::MJD ( void  ) const
virtual

Get the current modified Julian date.

Returns
Instantaneous modified Julian date

Reimplemented from CEDate.

Definition at line 107 of file CERunningDate.cpp.

◆ operator=()

CERunningDate & CERunningDate::operator= ( const CERunningDate other)

Copy assignment operator.

Parameters
[in]otherCERunningDate object to copy from

Definition at line 80 of file CERunningDate.cpp.

◆ ResetTime()

void CERunningDate::ResetTime ( void  )
inline

Method for resetting the 'start' variable.

Definition at line 81 of file CERunningDate.h.

◆ RunTime()

double CERunningDate::RunTime ( void  ) const
virtual

Method for getting the number of seconds since this object was created or reset.

Get the number of seconds since the creation of this object.

Definition at line 126 of file CERunningDate.cpp.

◆ ScaledRunTime()

double CERunningDate::ScaledRunTime ( void  ) const
inline

Return the scaled ellapsed time since this object was created.

Returns
Ellapsed time since object was created (seconds)

Definition at line 103 of file CERunningDate.h.

◆ SetTimerSpeed()

void CERunningDate::SetTimerSpeed ( const double &  scale = 1.0)
inlinevirtual

Set the rate at which the timer progresses.

Parameters
scaleTime scale factorvirtual

Definition at line 92 of file CERunningDate.h.

Member Data Documentation

◆ start_

std::chrono::high_resolution_clock::time_point CERunningDate::start_
private

Variable to hold the starting time.

Additional updates will be computed from this start time.

Definition at line 76 of file CERunningDate.h.

◆ timer_speed_factor_

double CERunningDate::timer_speed_factor_
private

Variable that can be used to speed up, slow down, or reverse the rate of time.

Definition at line 79 of file CERunningDate.h.


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