@@ -1,28 +1,42 | |||
|
1 | 1 | #ifndef SCIQLOP_SQPDATETIME_H |
|
2 | 2 | #define SCIQLOP_SQPDATETIME_H |
|
3 | 3 | |
|
4 | 4 | #include <QObject> |
|
5 | ||
|
6 | #include <QDateTime> | |
|
7 | #include <QDebug> | |
|
8 | ||
|
5 | 9 | /** |
|
6 | 10 | * @brief The SqpDateTime struct holds the information of time parameters |
|
7 | 11 | */ |
|
8 | 12 | struct SqpDateTime { |
|
9 | 13 | /// Start time |
|
10 | 14 | double m_TStart; |
|
11 | 15 | /// End time |
|
12 | 16 | double m_TEnd; |
|
13 | 17 | |
|
14 | 18 | bool contains(const SqpDateTime &dateTime) |
|
15 | 19 | { |
|
16 | 20 | return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); |
|
17 | 21 | } |
|
18 | 22 | |
|
19 | 23 | bool intersect(const SqpDateTime &dateTime) |
|
20 | 24 | { |
|
21 | 25 | return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); |
|
22 | 26 | } |
|
23 | 27 | }; |
|
24 | 28 | |
|
29 | inline QDebug operator<<(QDebug d, SqpDateTime obj) | |
|
30 | { | |
|
31 | auto tendDateTimeStart = QDateTime::fromMSecsSinceEpoch(obj.m_TStart * 1000); | |
|
32 | auto tendDateTimeEnd = QDateTime::fromMSecsSinceEpoch(obj.m_TEnd * 1000); | |
|
33 | ||
|
34 | // QDebug << "ts: " << tendDateTimeStart << " te: " << tendDateTimeEnd; | |
|
35 | d << "ts: " << tendDateTimeStart << " te: " << tendDateTimeEnd; | |
|
36 | return d; | |
|
37 | } | |
|
38 | ||
|
25 | 39 | // Required for using shared_ptr in signals/slots |
|
26 | 40 | Q_DECLARE_METATYPE(SqpDateTime) |
|
27 | 41 | |
|
28 | 42 | #endif // SCIQLOP_SQPDATETIME_H |
General Comments 0
You need to be logged in to leave comments.
Login now