Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JUTCTimeRange.hh
Go to the documentation of this file.
1 #ifndef __JUTC__JUTCTIMERANGE__
2 #define __JUTC__JUTCTIMERANGE__
3 
4 #include "JTools/JRange.hh"
5 #include "JLang/JManip.hh"
6 
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace JUTC {}
13 namespace JPP { using namespace JUTC; }
14 
15 /**
16  * Auxiliaries for handling universal time coordinate (UTC).
17  */
18 namespace JUTC {
19 
20  using JTOOLS::JRange;
21 
22  /**
23  * UTC time range [s].
24  */
25  class JUTCTimeRange :
26  public JRange<double>
27  {
28  public:
29  /**
30  * Default constructor.
31  */
33  JRange<double>(0.0, 999999999999.9)
34  {}
35 
36 
37  /**
38  * Constructor.
39  *
40  * \param timerange UTC time range
41  */
42  JUTCTimeRange(const JRange<double>& timerange) :
43  JRange<double>(timerange)
44  {}
45 
46 
47  /**
48  * Constructor.
49  *
50  * \param Tmin_s minimal UTC time [s]
51  * \param Tmax_s maximal UTC time [s]
52  */
53  JUTCTimeRange(const double Tmin_s, const double Tmax_s) :
54  JRange<double>(Tmin_s, Tmax_s)
55  {}
56 
57 
58  /**
59  * Write UTC time range to output.
60  *
61  * \param out output stream
62  * \param utc UTC time range
63  * \return output stream
64  */
65  friend inline std::ostream& operator<<(std::ostream& out, const JUTCTimeRange& utc)
66  {
67  const JFormat format(out, getFormat<JUTCTimeRange>(JFormat_t(13, 1, std::ios::fixed)));
68 
69  return out << format << utc.getLowerLimit() << ' '
70  << format << utc.getUpperLimit();
71  }
72  };
73 }
74 
75 #endif
JUTCTimeRange(const JRange< double > &timerange)
Constructor.
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JUTCTimeRange()
Default constructor.
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:631
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
JUTCTimeRange(const double Tmin_s, const double Tmax_s)
Constructor.
Range of values.
Definition: JRange.hh:38
I/O manipulators.
UTC time range [s].
Auxiliary class to define a range between two values.
friend std::ostream & operator<<(std::ostream &out, const JUTCTimeRange &utc)
Write UTC time range to output.
Data structure for format specifications.
Definition: JManip.hh:521