#ifndef __JDB_JDATIM_T__ #define __JDB_JDATIM_T__ #include #include #include "JLang/JMultiComparable.hh" #include "JDB/JDate_t.hh" #include "JDB/JTime_t.hh" /** * \author mdejong */ namespace JDATABASE {} namespace JPP { using namespace JDATABASE; } namespace JDATABASE { using JLANG::JMultiComparable; using JLANG::JTYPELIST; /** * Auxiliairy data structure for date and time. */ struct JDatim_t : public JDate_t, public JTime_t, public JMultiComparable::typelist> { /** * Separation character. */ static const char SEPARATOR = '-'; /** * Default constructor. */ JDatim_t() {} /** * Constructor. * * \param date date * \param time time */ JDatim_t(const JDate_t& date, const JTime_t& time) : JDate_t(date), JTime_t(time) {} static JDatim_t min() { return JDatim_t(JDate_t::min(), JTime_t::min()); } //!< Minimal date and time static JDatim_t max() { return JDatim_t(JDate_t::max(), JTime_t::max()); } //!< Maximal date and time /** * Read date and time from input stream. * * \param in input stream * \param object date and time * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JDatim_t& object) { in >> static_cast(object); in.ignore(); in >> static_cast(object); return in; } /** * Write date and time to output stream. * * \param out output stream * \param object date and time * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JDatim_t& object) { out << static_cast(object); out << JDatim_t::SEPARATOR; out << static_cast(object); return out; } ClassDefNV(JDatim_t, 1); }; } #endif