casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
asdm::ArrayTime Class Reference

The ArrayTime class implements the concept of a point in time, implemented as an Interval of time since 17 November 1858 00:00:00 UTC, the beginning of the modified Julian Day. More...

#include <ArrayTime.h>

Inheritance diagram for asdm::ArrayTime:
asdm::Interval

Public Member Functions

 ArrayTime ()
 The nullary constructor. More...
 
 ArrayTime (const std::string &s)
 Builds an ArrayTime out of the content of a string. More...
 
 ArrayTime (const ArrayTime &t)
 The copy constructor. More...
 
 ArrayTime (const asdmIDLTypes::IDLArrayTime &t)
 Builds an ArrayTime from the CORBA/IDL representation of an ArrayTime. More...
 
 ArrayTime (int year, int month, double day)
 Builds an ArrayTime from a triple (year, month, day). More...
 
 ArrayTime (int year, int month, int day, int hour, int minute, double second)
 Build an ArrayTime from a sextuple (year, month, day, hour, minute, second. More...
 
 ArrayTime (double modifiedJulianDay)
 Build an ArrayTime from an MJD date. More...
 
 ArrayTime (int modifiedJulianDay, double secondsInADay)
 Build an ArrayTime from an MJD date. More...
 
 ArrayTime (int64_t nanoseconds)
 Build an ArrayTime from a number of nanoseconds. More...
 
double getJD () const
 Return the julian day. More...
 
double getMJD () const
 Return the modified julian day. More...
 
asdmIDLTypes::IDLArrayTime toIDLArrayTime () const
 
std::string toFITS () const
 
void toBin (EndianOSStream &eoss)
 Write the binary representation of this to a EndianOSStream. More...
 
int * getDateTime () const
 
double getTimeOfDay () const
 
int getDayOfWeek () const
 
int getDayOfYear () const
 
std::string timeOfDayToString () const
 
double getLocalSiderealTime (double longitudeInHours) const
 
double getGreenwichMeanSiderealTime () const
 
- Public Member Functions inherited from asdm::Interval
 Interval ()
 Interval constructors. More...
 
 Interval (const Interval &)
 
 Interval (const std::string &s)
 
 Interval (const asdmIDLTypes::IDLInterval &)
 
 Interval (int64_t value)
 
virtual ~Interval ()
 Interval destructor. More...
 
Intervaloperator= (const Interval &)
 assignment operator More...
 
Intervaloperator= (const int64_t)
 assignment operator More...
 
Intervaloperator+= (const Interval &)
 assignment with arithmetic operators More...
 
Intervaloperator-= (const Interval &)
 
Intervaloperator*= (const int64_t)
 
Intervaloperator/= (const int64_t)
 
Interval operator+ (const Interval &) const
 arithmetic functions More...
 
Interval operator- (const Interval &) const
 
Interval operator* (const int64_t) const
 
Interval operator/ (const int64_t) const
 
bool operator< (const Interval &) const
 comparison operators More...
 
bool operator> (const Interval &) const
 
bool operator<= (const Interval &) const
 
bool operator>= (const Interval &) const
 
bool operator== (const Interval &) const
 
bool equals (const Interval &) const
 
bool operator!= (const Interval &) const
 
bool isZero () const
 
Interval operator- () const
 unary - and + operators More...
 
Interval operator+ () const
 
std::string toString () const
 
std::string toStringI () const
 
void toBin (EndianOSStream &eoss)
 Write the binary representation of this into an EndianOSStream. More...
 
 operator std::string () const
 Conversion functions. More...
 
int64_t get () const
 
asdmIDLTypes::IDLInterval toIDLInterval () const
 

Static Public Member Functions

static bool isLeapYear (int year)
 
static double getMJD (double jd)
 
static double getJD (double mjd)
 
static ArrayTime add (const ArrayTime &time, const Interval &interval)
 
static ArrayTime sub (const ArrayTime &time, const Interval &interval)
 
static ArrayTime getArrayTime (StringTokenizer &t)
 
static void toBin (const std::vector< ArrayTime > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of ArrayTime to a EndianOSStream. More...
 
static void toBin (const std::vector< std::vector< ArrayTime > > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of vector of ArrayTime to a EndianOSStream. More...
 
static void toBin (const std::vector< std::vector< std::vector< ArrayTime > > > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of vector of vector of ArrayTime to a EndianOSStream. More...
 
static ArrayTime fromBin (EndianIStream &eis)
 Read the binary representation of an ArrayTime from a EndianIStream and use the read value to set an ArrayTime. More...
 
static std::vector< ArrayTimefrom1DBin (EndianIStream &eis)
 Read the binary representation of a vector of ArrayTime from an EndianIStream and use the read value to set a vector of ArrayTime. More...
 
static std::vector
< std::vector< ArrayTime > > 
from2DBin (EndianIStream &eis)
 Read the binary representation of a vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of ArrayTime. More...
 
static std::vector
< std::vector< std::vector
< ArrayTime > > > 
from3DBin (EndianIStream &eis)
 Read the binary representation of a vector of vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of vector of ArrayTime. More...
 
static double unitToJD (int64_t unit)
 
static double unitToMJD (int64_t unit)
 
static int64_t jdToUnit (double jd)
 
static int64_t mjdToUnit (double mjd)
 
static double utcCorrection (double jd)
 
- Static Public Member Functions inherited from asdm::Interval
static int64_t fromString (const std::string &)
 
static std::string toString (int64_t)
 
static Interval getInterval (StringTokenizer &t) throw (NumberFormatException)
 
static void toBin (std::vector< Interval > interval, EndianOSStream &eoss)
 Write the binary representation of a vector of Interval into a EndianOSStream. More...
 
static void toBin (std::vector< std::vector< Interval > > interval, EndianOSStream &eoss)
 Write the binary representation of a vector of vector of Interval into a EndianOSStream. More...
 
static Interval fromBin (EndianIStream &eis)
 Read the binary representation of an Interval from an EndianIStream and use the read value to set an Interval. More...
 
static std::vector< Intervalfrom1DBin (EndianIStream &eis)
 Read the binary representation of a vector of Interval from a EndianIStream and use the read value to set a vector of Interval. More...
 
static std::vector
< std::vector< Interval > > 
from2DBin (EndianIStream &eis)
 Read the binary representation of a vector of vector of Interval from a EndianIStream and use the read value to set a vector of vector of Interval. More...
 
static std::string unit ()
 

Static Public Attributes

static const int numberSigDigitsInASecond
 Useful constants. More...
 
static const int64_t unitsInASecond
 
static const int64_t unitsInADayL
 
static const double unitsInADay
 
static const double unitsInADayDiv100
 
static const double julianDayOfBase
 
static const int64_t julianDayOfBaseInUnitsInADayDiv100
 

Private Member Functions

int64_t FITSString (std::string t) const
 

Static Private Member Functions

static int64_t init (int year, int month, double day)
 
static int64_t init (int year, int month, int day, int hour, int minute, double second)
 

Static Private Attributes

static const UTCCorrectionUTCCorrectionTable
 
static const UTCCorrection UTCLast
 

Detailed Description

The ArrayTime class implements the concept of a point in time, implemented as an Interval of time since 17 November 1858 00:00:00 UTC, the beginning of the modified Julian Day.

All dates are assumed to be in the Gregorian calendar, including those prior to October 15, 1582. So, if you are interested in very old dates, this isn't the most convenient class to use.

Internally the time is kept in units of nanoseconds (10-9 seconds). The base time is 17 November 1858 00:00:00 UTC, and the maximum time is to the year 2151 (2151-02-25T23:47:16.854775807). This differs from the OMG Time service The OMG time is in units of 100 nanoseconds using the beginning of the Gregorian calandar,15 October 1582 00:00:00 UTC, as the base time. The reason for this increased accuracy is that the Control system is capable of measuring time to an accuracy of 40 nanoseconds. Therefore, by adhering to the representation of time used in the OMG Time Serivce we would be losing precision.

The Time class is an extension of the Interval class, since all times are intervals since 17 November 1858 00:00:00 UTC.

All times in this class are assumed to be International Atomic Time (TAI). A specific TAI time differs from the corresponding UTC time by an offset that is an integral number of seconds.

In the methods that give various quantities associated with calendar times, this class does not apply any UTC corrections. Therefore, if you use these methods to produce calendar times, the results will differ from civil time by a few seconds. The classes UTCTime and LocalTime take the UTC and timezone corrections into account.

The main reference used in crafting these methods is Astronomical Algorithms by Jean Meeus, second edition, 2000, Willmann-Bell, Inc., ISBN 0-943396-61-1. See chapter 7, "Julian day", and chapter 12, "Sidereal Time".

Version
1.0 12 January, 2004
Author
Allen Farris
Version
1.1 Aug 8, 2006
Author
Michel Caillat added toBin/fromBin methods.

Definition at line 89 of file ArrayTime.h.

Constructor & Destructor Documentation

asdm::ArrayTime::ArrayTime ( )

The nullary constructor.

Builds an ArrayTime corresponding to the origin of time i. e. 17 November 1858 00:00:00 UTC

asdm::ArrayTime::ArrayTime ( const std::string &  s)

Builds an ArrayTime out of the content of a string.

If the string contains the textual representation of a double precision value then it will be considered as an MJD date. If the strign contains the textual representation of an integer value then it will be considered as an interval of time counted in nanoseconds since the 17 November 1858 00:00:00 UTC.

Parameters
sa const reference to a string.
asdm::ArrayTime::ArrayTime ( const ArrayTime t)

The copy constructor.

Parameters
sa const reference to an ArrayTime.
asdm::ArrayTime::ArrayTime ( const asdmIDLTypes::IDLArrayTime &  t)

Builds an ArrayTime from the CORBA/IDL representation of an ArrayTime.

Parameters
ta const reference to an IDLArrayTime.
asdm::ArrayTime::ArrayTime ( int  year,
int  month,
double  day 
)

Builds an ArrayTime from a triple (year, month, day).

Parameters
yeara positive integer value,
monthan integer in the range [1, 12],
daya value in double precision, whose integer value must be in a valid range depending on the month.
Exceptions
InvalidArgumentException.
asdm::ArrayTime::ArrayTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second 
)

Build an ArrayTime from a sextuple (year, month, day, hour, minute, second.

Parameters
yeara positive integer value,
monthan integer in the range [1, 12],
dayan integer in the usual range depending on the month,
houran integer in the range [0, 23],
minutean integer value in the range [0, 59],
seconda value in double precision whose integer part must be in the range [0, 59].
Exceptions
InvalidArgumentException.
asdm::ArrayTime::ArrayTime ( double  modifiedJulianDay)

Build an ArrayTime from an MJD date.

Parameters
modifieJulianDaya value in double precision.
asdm::ArrayTime::ArrayTime ( int  modifiedJulianDay,
double  secondsInADay 
)

Build an ArrayTime from an MJD date.

Parameters
modifiedJulianDayan integer value to express the integer part of the MJD date,
secondsInADaya value in double precision to express the decimal part of the MJD date.
asdm::ArrayTime::ArrayTime ( int64_t  nanoseconds)

Build an ArrayTime from a number of nanoseconds.

Parameters
nanosecondsa int64_t integer value to express a number of nanoseconds since 17 November 1858 00:00:00 UTC.

Member Function Documentation

static ArrayTime asdm::ArrayTime::add ( const ArrayTime time,
const Interval interval 
)
static
int64_t asdm::ArrayTime::FITSString ( std::string  t) const
private
static std::vector<ArrayTime> asdm::ArrayTime::from1DBin ( EndianIStream eis)
static

Read the binary representation of a vector of ArrayTime from an EndianIStream and use the read value to set a vector of ArrayTime.

Parameters
disthe EndianIStream to be read
Returns
a vector of ArrayTime
static std::vector<std::vector<ArrayTime> > asdm::ArrayTime::from2DBin ( EndianIStream eis)
static

Read the binary representation of a vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of ArrayTime.

Parameters
eiisthe EndianIStream to be read
Returns
a vector of vector of ArrayTime
static std::vector<std::vector<std::vector<ArrayTime> > > asdm::ArrayTime::from3DBin ( EndianIStream eis)
static

Read the binary representation of a vector of vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of vector of ArrayTime.

Parameters
eisthe EndianIStream to be read
Returns
a vector of vector of vector of ArrayTime
static ArrayTime asdm::ArrayTime::fromBin ( EndianIStream eis)
static

Read the binary representation of an ArrayTime from a EndianIStream and use the read value to set an ArrayTime.

Parameters
eisthe EndianStream to be read
Returns
an ArrayTime
static ArrayTime asdm::ArrayTime::getArrayTime ( StringTokenizer t)
static
int* asdm::ArrayTime::getDateTime ( ) const
int asdm::ArrayTime::getDayOfWeek ( ) const
int asdm::ArrayTime::getDayOfYear ( ) const
double asdm::ArrayTime::getGreenwichMeanSiderealTime ( ) const
static double asdm::ArrayTime::getJD ( double  mjd)
static
double asdm::ArrayTime::getJD ( ) const

Return the julian day.

Returns
a value in double precision expressing this in julian day.
double asdm::ArrayTime::getLocalSiderealTime ( double  longitudeInHours) const
static double asdm::ArrayTime::getMJD ( double  jd)
static
double asdm::ArrayTime::getMJD ( ) const

Return the modified julian day.

Returns
a value in double precision expressing this in modified julian day.
double asdm::ArrayTime::getTimeOfDay ( ) const
static int64_t asdm::ArrayTime::init ( int  year,
int  month,
double  day 
)
staticprivate
static int64_t asdm::ArrayTime::init ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second 
)
staticprivate
static bool asdm::ArrayTime::isLeapYear ( int  year)
static
static int64_t asdm::ArrayTime::jdToUnit ( double  jd)
static
static int64_t asdm::ArrayTime::mjdToUnit ( double  mjd)
static
static ArrayTime asdm::ArrayTime::sub ( const ArrayTime time,
const Interval interval 
)
static
std::string asdm::ArrayTime::timeOfDayToString ( ) const
void asdm::ArrayTime::toBin ( EndianOSStream eoss)

Write the binary representation of this to a EndianOSStream.

static void asdm::ArrayTime::toBin ( const std::vector< ArrayTime > &  arrayTime,
EndianOSStream eoss 
)
static

Write the binary representation of a vector of ArrayTime to a EndianOSStream.

Parameters
arrayTimethe vector of ArrayTime to be written
eossthe EndianOSStream to be written to
static void asdm::ArrayTime::toBin ( const std::vector< std::vector< ArrayTime > > &  arrayTime,
EndianOSStream eoss 
)
static

Write the binary representation of a vector of vector of ArrayTime to a EndianOSStream.

Parameters
arrayTimethe vector of vector of ArrayTime to be written
eossthe EndianOSStream to be written to
static void asdm::ArrayTime::toBin ( const std::vector< std::vector< std::vector< ArrayTime > > > &  arrayTime,
EndianOSStream eoss 
)
static

Write the binary representation of a vector of vector of vector of ArrayTime to a EndianOSStream.

Parameters
arrayTimethe vector of vector of vector of ArrayTime to be written
eossthe EndianOSStream to be written to
std::string asdm::ArrayTime::toFITS ( ) const
asdmIDLTypes::IDLArrayTime asdm::ArrayTime::toIDLArrayTime ( ) const
static double asdm::ArrayTime::unitToJD ( int64_t  unit)
static
static double asdm::ArrayTime::unitToMJD ( int64_t  unit)
static
static double asdm::ArrayTime::utcCorrection ( double  jd)
static

Member Data Documentation

const double asdm::ArrayTime::julianDayOfBase
static

Definition at line 99 of file ArrayTime.h.

const int64_t asdm::ArrayTime::julianDayOfBaseInUnitsInADayDiv100
static

Definition at line 100 of file ArrayTime.h.

const int asdm::ArrayTime::numberSigDigitsInASecond
static

Useful constants.

Definition at line 94 of file ArrayTime.h.

const double asdm::ArrayTime::unitsInADay
static
const double asdm::ArrayTime::unitsInADayDiv100
static

Definition at line 98 of file ArrayTime.h.

const int64_t asdm::ArrayTime::unitsInADayL
static

Definition at line 96 of file ArrayTime.h.

const int64_t asdm::ArrayTime::unitsInASecond
static
const UTCCorrection* asdm::ArrayTime::UTCCorrectionTable
staticprivate

Definition at line 307 of file ArrayTime.h.

const UTCCorrection asdm::ArrayTime::UTCLast
staticprivate

Definition at line 308 of file ArrayTime.h.


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