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
6QT_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*/
15class QOpcUaBrowsePathTargetData : public QSharedData
16{
17public:
18 QOpcUaExpandedNodeId targetId;
19 quint32 remainingPathIndex{(std::numeric_limits<quint32>::max)()};
20};
21
22QOpcUaBrowsePathTarget::QOpcUaBrowsePathTarget()
23 : data(new QOpcUaBrowsePathTargetData)
24{
25}
26
27/*!
28 Constructs a browse path target from \a rhs.
29*/
30QOpcUaBrowsePathTarget::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*/
38QOpcUaBrowsePathTarget &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*/
48bool QOpcUaBrowsePathTarget::operator==(const QOpcUaBrowsePathTarget &rhs) const
49{
50 return data->targetId == rhs.targetId() &&
51 data->remainingPathIndex == rhs.remainingPathIndex();
52}
53
54QOpcUaBrowsePathTarget::~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*/
63quint32 QOpcUaBrowsePathTarget::remainingPathIndex() const
64{
65 return data->remainingPathIndex;
66}
67
68/*!
69 Sets the remaining path index to \a remainingPathIndex.
70*/
71void 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*/
79bool 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*/
89QOpcUaExpandedNodeId QOpcUaBrowsePathTarget::targetId() const
90{
91 return data->targetId;
92}
93
94/*!
95 Returns a reference to the target id.
96*/
97QOpcUaExpandedNodeId &QOpcUaBrowsePathTarget::targetIdRef()
98{
99 return data->targetId;
100}
101
102/*!
103 Sets the node id of the target node to \a targetId.
104*/
105void QOpcUaBrowsePathTarget::setTargetId(const QOpcUaExpandedNodeId &targetId)
106{
107 data->targetId = targetId;
108}
109
110QT_END_NAMESPACE
111

source code of qtopcua/src/opcua/client/qopcuabrowsepathtarget.cpp