#ifndef __JUTC__JUTCTIMERANGE__ #define __JUTC__JUTCTIMERANGE__ #include "JTools/JRange.hh" #include "JLang/JManip.hh" /** * \author mdejong */ namespace JUTC {} namespace JPP { using namespace JUTC; } /** * Auxiliaries for handling universal time coordinate (UTC). */ namespace JUTC { using JTOOLS::JRange; /** * UTC time range [s]. */ class JUTCTimeRange : public JRange { public: /** * Default constructor. */ JUTCTimeRange() : JRange(0.0, 999999999999.9) {} /** * Constructor. * * \param timerange UTC time range */ JUTCTimeRange(const JRange& timerange) : JRange(timerange) {} /** * Constructor. * * \param Tmin_s minimal UTC time [s] * \param Tmax_s maximal UTC time [s] */ JUTCTimeRange(const double Tmin_s, const double Tmax_s) : JRange(Tmin_s, Tmax_s) {} /** * Get UTC time range. * * \return UTC time range */ const JUTCTimeRange& getUTCTimeRange() const { return static_cast(*this); } /** * Get UTC time range. * * \return UTC time range */ JUTCTimeRange& getUTCTimeRange() { return static_cast(*this); } /** * Set UTC time range. * * \param timerange UTC time range */ void setUTCTimeRange(const JRange& timerange) { static_cast(*this) = timerange; } /** * Write UTC time range to output. * * \param out output stream * \param utc UTC time range * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JUTCTimeRange& utc) { const JFormat format(out, getFormat(JFormat_t(13, 1, std::ios::fixed))); return out << format << utc.getLowerLimit() << ' ' << format << utc.getUpperLimit(); } }; } #endif