1 | // Copyright (C) 2015 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 "qopcuabrowsepathtarget.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | /*! |
9 | \class QOpcUaBrowsePathTarget |
10 | \inmodule QtOpcUa |
11 | \brief The OPC UA BrowsePathTarget. |
12 | |
13 | A BrowsePathTarget contains a target of a browse path and information about the completeness of the node id resolution. |
14 | */ |
15 | class QOpcUaBrowsePathTargetData : public QSharedData |
16 | { |
17 | public: |
18 | QOpcUaExpandedNodeId targetId; |
19 | quint32 remainingPathIndex{(std::numeric_limits<quint32>::max)()}; |
20 | }; |
21 | |
22 | QOpcUaBrowsePathTarget::QOpcUaBrowsePathTarget() |
23 | : data(new QOpcUaBrowsePathTargetData) |
24 | { |
25 | } |
26 | |
27 | /*! |
28 | Constructs a browse path target from \a rhs. |
29 | */ |
30 | QOpcUaBrowsePathTarget::QOpcUaBrowsePathTarget(const QOpcUaBrowsePathTarget &rhs) |
31 | : data(rhs.data) |
32 | { |
33 | } |
34 | |
35 | /*! |
36 | Sets the values of \a rhs in this browse path target. |
37 | */ |
38 | QOpcUaBrowsePathTarget &QOpcUaBrowsePathTarget::operator=(const QOpcUaBrowsePathTarget &rhs) |
39 | { |
40 | if (this != &rhs) |
41 | data.operator=(o: rhs.data); |
42 | return *this; |
43 | } |
44 | |
45 | /*! |
46 | Returns \c true if this browse path target has the same value as \a rhs. |
47 | */ |
48 | bool QOpcUaBrowsePathTarget::operator==(const QOpcUaBrowsePathTarget &rhs) const |
49 | { |
50 | return data->targetId == rhs.targetId() && |
51 | data->remainingPathIndex == rhs.remainingPathIndex(); |
52 | } |
53 | |
54 | QOpcUaBrowsePathTarget::~QOpcUaBrowsePathTarget() |
55 | { |
56 | } |
57 | |
58 | /*! |
59 | Returns the index of the first unprocessed element in the browse path. |
60 | If the path was followed to the end, remainingPathIndex has the maximum value of quint32. |
61 | \sa QOpcUaBrowsePathTarget::targetId() |
62 | */ |
63 | quint32 QOpcUaBrowsePathTarget::remainingPathIndex() const |
64 | { |
65 | return data->remainingPathIndex; |
66 | } |
67 | |
68 | /*! |
69 | Sets the remaining path index to \a remainingPathIndex. |
70 | */ |
71 | void QOpcUaBrowsePathTarget::setRemainingPathIndex(quint32 remainingPathIndex) |
72 | { |
73 | data->remainingPathIndex = remainingPathIndex; |
74 | } |
75 | |
76 | /*! |
77 | Returns \c true if the browse path has been fully resolved. |
78 | */ |
79 | bool QOpcUaBrowsePathTarget::isFullyResolved() const |
80 | { |
81 | return (data->remainingPathIndex == (std::numeric_limits<quint32>::max)()); |
82 | } |
83 | |
84 | /*! |
85 | Returns the target of the last reference the server was able to follow. |
86 | If the reference leads to an external server, \e targetId is the id of the first node on that server. |
87 | \sa QOpcUaBrowsePathTarget::remainingPathIndex |
88 | */ |
89 | QOpcUaExpandedNodeId QOpcUaBrowsePathTarget::targetId() const |
90 | { |
91 | return data->targetId; |
92 | } |
93 | |
94 | /*! |
95 | Returns a reference to the target id. |
96 | */ |
97 | QOpcUaExpandedNodeId &QOpcUaBrowsePathTarget::targetIdRef() |
98 | { |
99 | return data->targetId; |
100 | } |
101 | |
102 | /*! |
103 | Sets the node id of the target node to \a targetId. |
104 | */ |
105 | void QOpcUaBrowsePathTarget::setTargetId(const QOpcUaExpandedNodeId &targetId) |
106 | { |
107 | data->targetId = targetId; |
108 | } |
109 | |
110 | QT_END_NAMESPACE |
111 |