| 1 | // Copyright (C) 2021 basysKom GmbH, opensource@basyskom.com |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QOPCUADATAVALUE_H |
| 5 | #define QOPCUADATAVALUE_H |
| 6 | |
| 7 | #include <QtOpcUa/qopcuatype.h> |
| 8 | |
| 9 | #include <QtCore/qdatetime.h> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | class QOpcUaDataValueData; |
| 14 | class Q_OPCUA_EXPORT QOpcUaDataValue |
| 15 | { |
| 16 | public: |
| 17 | QOpcUaDataValue(); |
| 18 | QOpcUaDataValue(const QOpcUaDataValue &other); |
| 19 | QOpcUaDataValue &operator=(const QOpcUaDataValue &other); |
| 20 | ~QOpcUaDataValue(); |
| 21 | |
| 22 | void swap(QOpcUaDataValue &other) noexcept |
| 23 | { data.swap(other&: other.data); } |
| 24 | |
| 25 | QDateTime serverTimestamp() const; |
| 26 | void setServerTimestamp(const QDateTime &serverTimestamp); |
| 27 | |
| 28 | quint16 serverPicoseconds() const; |
| 29 | void setServerPicoseconds(quint16 serverPicoseconds); |
| 30 | |
| 31 | QDateTime sourceTimestamp() const; |
| 32 | void setSourceTimestamp(const QDateTime &sourceTimestamp); |
| 33 | |
| 34 | quint16 sourcePicoseconds() const; |
| 35 | void setSourcePicoseconds(quint16 sourcePicoseconds); |
| 36 | |
| 37 | QOpcUa::UaStatusCode statusCode() const; |
| 38 | void setStatusCode(QOpcUa::UaStatusCode statusCode); |
| 39 | |
| 40 | QVariant value() const; |
| 41 | void setValue(const QVariant &value); |
| 42 | |
| 43 | operator QVariant() const; |
| 44 | |
| 45 | private: |
| 46 | QExplicitlySharedDataPointer<QOpcUaDataValueData> data; |
| 47 | |
| 48 | friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaDataValue &lhs, |
| 49 | const QOpcUaDataValue &rhs) noexcept; |
| 50 | friend bool operator==(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept |
| 51 | { return comparesEqual(lhs, rhs); } |
| 52 | friend bool operator!=(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept |
| 53 | { |
| 54 | return !(lhs == rhs); |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | Q_DECLARE_SHARED(QOpcUaDataValue) |
| 59 | |
| 60 | QT_END_NAMESPACE |
| 61 | |
| 62 | Q_DECLARE_METATYPE(QOpcUaDataValue) |
| 63 | |
| 64 | #endif // QOPCUADATAVALUE_H |
| 65 |
