40 #define G_READ "GTimeReference::read(GFitsHDU&)"
41 #define G_READ_XML "GTimeReference::read(GXmlElement&)"
42 #define G_WRITE_XML "GTimeReference::write(GXmlElement&)"
43 #define G_SET "GTimeReference::set(double&, std::string&, std::string&, "\
102 const std::string& timeunit,
103 const std::string& timesys,
104 const std::string& timeref)
110 set(mjdref, timeunit, timesys, timeref);
130 const double& mjdreff,
131 const std::string& timeunit,
132 const std::string& timesys,
133 const std::string& timeref)
139 set(mjdrefi, mjdreff, timeunit, timesys, timeref);
279 set(mjdref, timeunit, timesys, timeref);
282 set(mjdrefi, mjdreff, timeunit, timesys, timeref);
285 std::string msg =
"No valid time reference keywords found in FITS "
286 "header. The FITS header must contain either the "
287 "keyword \"MJDREF\" or the keyword pair"
288 " \"MJDREFI\" and \"MJDREFF\".";
320 hdu.
card(
"MJDREF",
mjdref(),
"[days] Time reference MJD");
328 hdu.
card(
"MJDREFI",
mjdrefi(),
"[days] Integer part of time reference MJD");
329 hdu.
card(
"MJDREFF",
mjdreff(),
"[days] Fractional part of time reference MJD");
375 std::string msg =
"Attribute \"mjdrefi\" not found in XML parameter"
376 " \"TimeReference\"."
377 " Please verify the XML format.";
384 std::string msg =
"Attribute \"mjdreff\" not found in XML parameter"
385 " \"TimeReference\"."
386 " Please verify the XML format.";
393 std::string msg =
"Attribute \"timeunit\" not found in XML parameter"
394 " \"TimeReference\"."
395 " Please verify the XML format.";
402 std::string msg =
"Attribute \"timesys\" not found in XML parameter"
403 " \"TimeReference\"."
404 " Please verify the XML format.";
411 std::string msg =
"Attribute \"timeref\" not found in XML parameter"
412 " \"TimeReference\"."
413 " Please verify the XML format.";
418 set(mjdrefi, mjdreff, timeunit, timesys, timeref);
471 const std::string& timeunit,
472 const std::string& timesys,
473 const std::string& timeref)
477 if (ltimeunit ==
"d" || ltimeunit ==
"day" || ltimeunit ==
"days") {
480 else if (ltimeunit ==
"s" || ltimeunit ==
"sec" || ltimeunit ==
"secs") {
484 std::string msg =
"Invalid time unit \""+timeunit+
"\" specified. "
485 "Please specify one of \"d\", \"day\", \"days\", "
486 "\"s\", \"sec\" or \"secs\"";
514 const double& mjdreff,
515 const std::string& timeunit,
516 const std::string& timesys,
517 const std::string& timeref)
523 set(mjdref, timeunit, timesys, timeref);
647 result.append(
"=== GTimeReference ===");
void clear(void)
Clear time reference.
std::string m_timeunit
Time unit.
GTimeReference(void)
Void constructor.
double mjdreff(void) const
Returns fractional part of MJD reference (units: days)
bool has_card(const int &cardno) const
Check existence of header card.
const std::string & timeunit(void) const
Return time unit.
XML element node class interface definition.
void write(GFitsHDU &hdu) const
Write time reference into FITS header.
int mjdrefi(void) const
Returns integer part of MJD reference (units: days)
Abstract FITS extension base class.
double m_mjdref
Time MJD reference (days)
void read(const GFitsHDU &hdu)
Read time reference from FITS header.
void free_members(void)
Delete class members.
double unitseconds(void) const
Return the time unit in seconds.
GTimeReference & operator=(const GTimeReference &ref)
Assignment operator.
Abstract FITS extension base class definition.
double real(const std::string &keyname) const
Return card value as double precision.
const double & mjdref(void) const
Return MJD reference (units: days)
const GXmlAttribute * attribute(const int &index) const
Return attribute.
bool has_attribute(const std::string &name) const
Check if element has a given attribute.
Time reference class interface definition.
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
const std::string & timesys(void) const
Return time system.
void copy_members(const GTimeReference &ref)
Copy class members.
virtual ~GTimeReference(void)
Destructor.
int integer(const std::string &keyname) const
Return card value as integer.
const std::string & timeref(void) const
Return time reference.
std::string print(const GChatter &chatter=NORMAL) const
Print time reference.
void set(const double &mrdref, const std::string &timeunit, const std::string ×ys="TT", const std::string &timeref="LOCAL")
Set time reference.
std::string string(const std::string &keyname) const
Return card value as string.
Exception handler interface definition.
GTimeReference * clone(void) const
Clone object.
std::string toupper(const std::string &s)
Convert string to upper case.
Implements a time reference.
std::string tolower(const std::string &s)
Convert string to lower case.
int toint(const std::string &arg)
Convert string into integer value.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string m_timeref
Time reference.
GFitsHeaderCard & card(const int &cardno)
Return header card.
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
std::string m_timesys
Time system.
void init_members(void)
Initialise class members.
double todouble(const std::string &arg)
Convert string into double precision value.
bool m_unit_sec
True: unit is seconds, False: unit is days.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.