Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JDatim_t.hh
Go to the documentation of this file.
1#ifndef __JDB_JDATIM_T__
2#define __JDB_JDATIM_T__
3
4#include <TROOT.h>
5#include <TObject.h>
6
8
9#include "JDB/JDate_t.hh"
10#include "JDB/JTime_t.hh"
11
12
13/**
14 * \author mdejong
15 */
16namespace JDATABASE {}
17namespace JPP { using namespace JDATABASE; }
18
19namespace JDATABASE {
20
22 using JLANG::JTYPELIST;
23
24
25 /**
26 * Auxiliairy data structure for date and time.
27 */
28 struct JDatim_t :
29 public JDate_t,
30 public JTime_t,
31 public JMultiComparable<JDatim_t, JTYPELIST<JDate_t, JTime_t>::typelist>
32 {
33 /**
34 * Separation character.
35 */
36 static const char SEPARATOR = '-';
37
38
39 /**
40 * Default constructor.
41 */
43 {}
44
45
46 /**
47 * Constructor.
48 *
49 * \param date date
50 * \param time time
51 */
52 JDatim_t(const JDate_t& date,
53 const JTime_t& time) :
54 JDate_t(date),
55 JTime_t(time)
56 {}
57
58
59 static JDatim_t min() { return JDatim_t(JDate_t::min(), JTime_t::min()); } //!< Minimal date and time
60 static JDatim_t max() { return JDatim_t(JDate_t::max(), JTime_t::max()); } //!< Maximal date and time
61
62
63 /**
64 * Read date and time from input stream.
65 *
66 * \param in input stream
67 * \param object date and time
68 * \return input stream
69 */
70 friend inline std::istream& operator>>(std::istream& in, JDatim_t& object)
71 {
72 in >> static_cast<JDate_t&>(object);
73 in.ignore();
74 in >> static_cast<JTime_t&>(object);
75
76 return in;
77 }
78
79
80 /**
81 * Write date and time to output stream.
82 *
83 * \param out output stream
84 * \param object date and time
85 * \return output stream
86 */
87 friend inline std::ostream& operator<<(std::ostream& out, const JDatim_t& object)
88 {
89 out << static_cast<const JDate_t&>(object);
91 out << static_cast<const JTime_t&>(object);
92
93 return out;
94 }
95
97 };
98}
99
100#endif
Auxiliary classes and methods for database I/O.
Definition JAHRS.hh:14
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliairy data structure for date and time.
Definition JDatim_t.hh:32
ClassDefNV(JDatim_t, 1)
JDatim_t()
Default constructor.
Definition JDatim_t.hh:42
friend std::ostream & operator<<(std::ostream &out, const JDatim_t &object)
Write date and time to output stream.
Definition JDatim_t.hh:87
friend std::istream & operator>>(std::istream &in, JDatim_t &object)
Read date and time from input stream.
Definition JDatim_t.hh:70
static JDatim_t min()
Minimal date and time.
Definition JDatim_t.hh:59
JDatim_t(const JDate_t &date, const JTime_t &time)
Constructor.
Definition JDatim_t.hh:52
static const char SEPARATOR
Separation character.
Definition JDatim_t.hh:36
static JDatim_t max()
Maximal date and time.
Definition JDatim_t.hh:60
Auxiliary class for simple date.
Definition JDate.hh:40
static JDate max()
Maximal date.
Definition JDate.hh:87
static JDate min()
Minimal date.
Definition JDate.hh:86
Auxiliary class for simple time.
Definition Jeep/JTime.hh:40
static JTime max()
Maximal time.
Definition Jeep/JTime.hh:87
static JTime min()
Minimal time.
Definition Jeep/JTime.hh:86
Template definition of auxiliary base class for composite data structures composed of base classes wi...
Auxiliary class for recursive type list generation.
Definition JTypeList.hh:351