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 "qopcuareferencedescription.h"
5#include <QtOpcUa/qopcuaexpandednodeid.h>
6#include <QtOpcUa/qopcuaqualifiedname.h>
7#include <QtOpcUa/qopcualocalizedtext.h>
8
9QT_BEGIN_NAMESPACE
10
11/*!
12 \class QOpcUaReferenceDescription
13 \inmodule QtOpcUa
14 \brief Contains information about a node.
15
16 This class is used to return the results of a call to \l QOpcUaNode::browse() or
17 \l QOpcUaNode::browseChildren().
18
19 It contains the type and direction of the reference used to connect the node
20 to the starting node of the browse operation, the node id of the target's type
21 definition node and the values of the following \l {QOpcUa::NodeAttribute} {node attributes}:
22 \table
23 \header
24 \li Attribute
25 \row
26 \li NodeId
27 \row
28 \li BrowseName
29 \row
30 \li DisplayName
31 \row
32 \li NodeClass
33 \endtable
34*/
35
36class QOpcUaReferenceDescriptionPrivate : public QSharedData
37{
38public:
39 QString refTypeId;
40 QOpcUaExpandedNodeId targetNodeId;
41 QOpcUaExpandedNodeId typeDefinition;
42 QOpcUaQualifiedName browseName;
43 QOpcUaLocalizedText displayName;
44 QOpcUa::NodeClass nodeClass {QOpcUa::NodeClass::Object};
45 bool isForwardReference {true};
46};
47
48/*!
49 Creates an empty QOpcUaReferenceDescription object
50*/
51QOpcUaReferenceDescription::QOpcUaReferenceDescription()
52 : d_ptr(new QOpcUaReferenceDescriptionPrivate())
53{}
54
55/*!
56 Creates a copy of the QOpcUaReferenceDescription object \a other.
57*/
58QOpcUaReferenceDescription::QOpcUaReferenceDescription(const QOpcUaReferenceDescription &other)
59 : d_ptr(other.d_ptr)
60{}
61
62/*!
63 Assigns the value of \a other to this object.
64*/
65QOpcUaReferenceDescription &QOpcUaReferenceDescription::operator=(const QOpcUaReferenceDescription &other)
66{
67 d_ptr = other.d_ptr;
68 return *this;
69}
70
71/*!
72 Destructor for QOpcUaReferenceDescription
73*/
74QOpcUaReferenceDescription::~QOpcUaReferenceDescription()
75{}
76
77/*!
78 Returns the node class of the node.
79*/
80QOpcUa::NodeClass QOpcUaReferenceDescription::nodeClass() const
81{
82 return d_ptr->nodeClass;
83}
84
85/*!
86 Sets the node class of the node to \a nodeClass.
87*/
88void QOpcUaReferenceDescription::setNodeClass(QOpcUa::NodeClass nodeClass)
89{
90 d_ptr->nodeClass = nodeClass;
91}
92
93/*!
94 Sets \a isForwardReference as isForwardReference information for the reference.
95*/
96void QOpcUaReferenceDescription::setIsForwardReference(bool isForwardReference)
97{
98 d_ptr->isForwardReference = isForwardReference;
99}
100
101/*!
102 Returns \c true if the reference is forward.
103*/
104bool QOpcUaReferenceDescription::isForwardReference() const
105{
106 return d_ptr->isForwardReference;
107}
108
109/*!
110 Sets \a typeDefinition as id of the type definition.
111*/
112void QOpcUaReferenceDescription::setTypeDefinition(const QOpcUaExpandedNodeId &typeDefinition)
113{
114 d_ptr->typeDefinition = typeDefinition;
115}
116
117/*!
118 Returns the type definition id.
119*/
120QOpcUaExpandedNodeId QOpcUaReferenceDescription::typeDefinition() const
121{
122 return d_ptr->typeDefinition;
123}
124
125/*!
126 Returns the display name of the node.
127*/
128QOpcUaLocalizedText QOpcUaReferenceDescription::displayName() const
129{
130 return d_ptr->displayName;
131}
132
133/*!
134 Sets the display name of the node to \a displayName.
135*/
136void QOpcUaReferenceDescription::setDisplayName(const QOpcUaLocalizedText &displayName)
137{
138 d_ptr->displayName = displayName;
139}
140
141/*!
142 Returns the browse name of the node.
143*/
144QOpcUaQualifiedName QOpcUaReferenceDescription::browseName() const
145{
146 return d_ptr->browseName;
147}
148
149/*!
150 Sets the browse name of the node to \a browseName.
151*/
152void QOpcUaReferenceDescription::setBrowseName(const QOpcUaQualifiedName &browseName)
153{
154 d_ptr->browseName = browseName;
155}
156
157/*!
158 Returns the node id of the node.
159*/
160QOpcUaExpandedNodeId QOpcUaReferenceDescription::targetNodeId() const
161{
162 return d_ptr->targetNodeId;
163}
164
165/*!
166 Sets the node id of the node to \a nodeId.
167*/
168void QOpcUaReferenceDescription::setTargetNodeId(const QOpcUaExpandedNodeId &nodeId)
169{
170 d_ptr->targetNodeId = nodeId;
171}
172
173/*!
174 Returns the reference type id of the node.
175*/
176QString QOpcUaReferenceDescription::refTypeId() const
177{
178 return d_ptr->refTypeId;
179}
180
181/*!
182 Sets the reference type id of the node to \a refTypeId.
183
184 \sa QOpcUa::nodeIdFromReferenceType()
185*/
186void QOpcUaReferenceDescription::setRefTypeId(const QString &refTypeId)
187{
188 d_ptr->refTypeId = refTypeId;
189}
190
191QT_END_NAMESPACE
192

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