SqpDateTime.h
43 lines
| 1.0 KiB
| text/x-c
|
CLexer
r177 | #ifndef SCIQLOP_SQPDATETIME_H | |||
#define SCIQLOP_SQPDATETIME_H | ||||
r218 | #include <QObject> | |||
r274 | ||||
#include <QDebug> | ||||
|
r450 | #include <Common/DateUtils.h> | ||
|
r285 | #include <Common/MetaTypes.h> | ||
r177 | /** | |||
* @brief The SqpDateTime struct holds the information of time parameters | ||||
*/ | ||||
struct SqpDateTime { | ||||
|
r453 | /// Start time (UTC) | ||
r177 | double m_TStart; | |||
|
r453 | /// End time (UTC) | ||
r177 | double m_TEnd; | |||
r212 | ||||
r293 | bool contains(const SqpDateTime &dateTime) const noexcept | |||
r212 | { | |||
return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); | ||||
} | ||||
r240 | ||||
r293 | bool intersect(const SqpDateTime &dateTime) const noexcept | |||
r240 | { | |||
return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); | ||||
} | ||||
r177 | }; | |||
r274 | inline QDebug operator<<(QDebug d, SqpDateTime obj) | |||
{ | ||||
|
r450 | auto tendDateTimeStart = DateUtils::dateTime(obj.m_TStart); | ||
auto tendDateTimeEnd = DateUtils::dateTime(obj.m_TEnd); | ||||
r274 | ||||
d << "ts: " << tendDateTimeStart << " te: " << tendDateTimeEnd; | ||||
return d; | ||||
} | ||||
r218 | // Required for using shared_ptr in signals/slots | |||
|
r285 | SCIQLOP_REGISTER_META_TYPE(SQPDATETIME_REGISTRY, SqpDateTime) | ||
r218 | ||||
r177 | #endif // SCIQLOP_SQPDATETIME_H | |||