| 1 | // Copyright (C) 2018 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 | #include "qopcuanodecreationattributes.h" |
| 5 | #include "qopcuadeletereferenceitem.h" |
| 6 | #include "qopcuaexpandednodeid.h" |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | /*! |
| 11 | \class QOpcUaDeleteReferenceItem |
| 12 | \inmodule QtOpcUa |
| 13 | \brief This class stores the necessary information to delete a reference from the server. |
| 14 | |
| 15 | \sa QOpcUaClient::deleteReference() |
| 16 | */ |
| 17 | |
| 18 | class QOpcUaDeleteReferenceItemData : public QSharedData |
| 19 | { |
| 20 | public: |
| 21 | QString sourceNodeId; |
| 22 | QString referenceTypeId; |
| 23 | bool isForwardReference {true}; |
| 24 | QOpcUaExpandedNodeId targetNodeId; |
| 25 | bool deleteBidirectional {true}; |
| 26 | }; |
| 27 | |
| 28 | /*! |
| 29 | Default constructs a delete reference item with no parameters set. |
| 30 | */ |
| 31 | QOpcUaDeleteReferenceItem::QOpcUaDeleteReferenceItem() |
| 32 | : data(new QOpcUaDeleteReferenceItemData) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | /*! |
| 37 | Constructs a delete reference item from \a other. |
| 38 | */ |
| 39 | QOpcUaDeleteReferenceItem::QOpcUaDeleteReferenceItem(const QOpcUaDeleteReferenceItem &other) |
| 40 | : data(other.data) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | /*! |
| 45 | Sets the values from \a rhs in this delete reference item. |
| 46 | */ |
| 47 | QOpcUaDeleteReferenceItem &QOpcUaDeleteReferenceItem::operator=(const QOpcUaDeleteReferenceItem &rhs) |
| 48 | { |
| 49 | if (this != &rhs) |
| 50 | data.operator=(o: rhs.data); |
| 51 | return *this; |
| 52 | } |
| 53 | |
| 54 | QOpcUaDeleteReferenceItem::~QOpcUaDeleteReferenceItem() |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | /*! |
| 59 | Returns the deleteBidirectional Flag. |
| 60 | */ |
| 61 | bool QOpcUaDeleteReferenceItem::deleteBidirectional() const |
| 62 | { |
| 63 | return data->deleteBidirectional; |
| 64 | } |
| 65 | |
| 66 | /*! |
| 67 | Sets the deleteBidirectional flag to \a deleteBidirectional. |
| 68 | If this flag is false, only this reference will be deleted. |
| 69 | Else, the opposite reference from the target node is deleted too if accessible by the server. |
| 70 | */ |
| 71 | void QOpcUaDeleteReferenceItem::setDeleteBidirectional(bool deleteBidirectional) |
| 72 | { |
| 73 | data->deleteBidirectional = deleteBidirectional; |
| 74 | } |
| 75 | |
| 76 | /*! |
| 77 | Returns the target node id. |
| 78 | */ |
| 79 | QOpcUaExpandedNodeId QOpcUaDeleteReferenceItem::targetNodeId() const |
| 80 | { |
| 81 | return data->targetNodeId; |
| 82 | } |
| 83 | |
| 84 | /*! |
| 85 | Sets the node id of the target node to \a targetNodeId. |
| 86 | */ |
| 87 | void QOpcUaDeleteReferenceItem::setTargetNodeId(const QOpcUaExpandedNodeId &targetNodeId) |
| 88 | { |
| 89 | data->targetNodeId = targetNodeId; |
| 90 | } |
| 91 | |
| 92 | /*! |
| 93 | Returns the isForwardReference flag. |
| 94 | */ |
| 95 | bool QOpcUaDeleteReferenceItem::isForwardReference() const |
| 96 | { |
| 97 | return data->isForwardReference; |
| 98 | } |
| 99 | |
| 100 | /*! |
| 101 | Sets the isForwardReference flag to \a isForwardReference. |
| 102 | */ |
| 103 | void QOpcUaDeleteReferenceItem::setIsForwardReference(bool isForwardReference) |
| 104 | { |
| 105 | data->isForwardReference = isForwardReference; |
| 106 | } |
| 107 | |
| 108 | /*! |
| 109 | Returns the reference type id. |
| 110 | */ |
| 111 | QString QOpcUaDeleteReferenceItem::referenceTypeId() const |
| 112 | { |
| 113 | return data->referenceTypeId; |
| 114 | } |
| 115 | |
| 116 | /*! |
| 117 | Sets the reference type id to \a referenceTypeId. |
| 118 | */ |
| 119 | void QOpcUaDeleteReferenceItem::setReferenceTypeId(const QString &referenceTypeId) |
| 120 | { |
| 121 | data->referenceTypeId = referenceTypeId; |
| 122 | } |
| 123 | |
| 124 | /*! |
| 125 | Returns the source node id. |
| 126 | */ |
| 127 | QString QOpcUaDeleteReferenceItem::sourceNodeId() const |
| 128 | { |
| 129 | return data->sourceNodeId; |
| 130 | } |
| 131 | |
| 132 | /*! |
| 133 | Sets the node id of the source node to \a sourceNodeId. |
| 134 | */ |
| 135 | void QOpcUaDeleteReferenceItem::setSourceNodeId(const QString &sourceNodeId) |
| 136 | { |
| 137 | data->sourceNodeId = sourceNodeId; |
| 138 | } |
| 139 | |
| 140 | QT_END_NAMESPACE |
| 141 |
