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
6#include "qopcuanodecreationattributes_p.h"
7
8QT_BEGIN_NAMESPACE
9
10/*!
11 \class QOpcUaNodeCreationAttributes
12 \inmodule QtOpcUa
13 \brief This class manages attribute values for node creation.
14
15 This class holds values for node attributes that are passed to the server
16 when creating a new node in the OPC UA address space.
17
18 The following node attributes are supported by the different node classes:
19
20 \table
21 \header
22 \li Attribute
23 \li Object
24 \li Variable
25 \li Method
26 \li ObjectType
27 \li VariableType
28 \li ReferenceType
29 \li DataType
30 \li View
31 \row
32 \li AccessLevel
33 \li
34 \li X
35 \li
36 \li
37 \li
38 \li
39 \li
40 \li
41 \row
42 \li ArrayDimensions
43 \li
44 \li X
45 \li
46 \li
47 \li X
48 \li
49 \li
50 \li
51 \row
52 \li ContainsNoLoops
53 \li
54 \li
55 \li
56 \li
57 \li
58 \li
59 \li
60 \li X
61 \row
62 \li DataType
63 \li
64 \li X
65 \li
66 \li
67 \li X
68 \li
69 \li
70 \li
71 \row
72 \li Description
73 \li X
74 \li X
75 \li X
76 \li X
77 \li X
78 \li X
79 \li X
80 \li X
81 \row
82 \li DisplayName
83 \li X
84 \li X
85 \li X
86 \li X
87 \li X
88 \li X
89 \li X
90 \li X
91 \row
92 \li EventNotifier
93 \li X
94 \li
95 \li
96 \li
97 \li
98 \li
99 \li
100 \li
101 \row
102 \li Executable
103 \li
104 \li
105 \li X
106 \li
107 \li
108 \li
109 \li
110 \li
111 \row
112 \li Historizing
113 \li
114 \li X
115 \li
116 \li
117 \li
118 \li
119 \li
120 \li
121 \row
122 \li InverseName
123 \li
124 \li
125 \li
126 \li
127 \li
128 \li X
129 \li
130 \li
131 \row
132 \li IsAbstract
133 \li
134 \li
135 \li
136 \li X
137 \li X
138 \li X
139 \li X
140 \li
141 \row
142 \li MinimumSamplingInterval
143 \li
144 \li X
145 \li
146 \li
147 \li
148 \li
149 \li
150 \li
151 \row
152 \li Symmetric
153 \li
154 \li
155 \li
156 \li
157 \li
158 \li X
159 \li
160 \li
161 \row
162 \li UserAccessLevel
163 \li
164 \li X
165 \li
166 \li
167 \li
168 \li
169 \li
170 \li
171 \row
172 \li UserExecutable
173 \li
174 \li
175 \li X
176 \li
177 \li
178 \li
179 \li
180 \li
181 \row
182 \li UserWriteMask
183 \li X
184 \li X
185 \li X
186 \li X
187 \li X
188 \li X
189 \li X
190 \li X
191 \row
192 \li Value
193 \li
194 \li X
195 \li
196 \li
197 \li X
198 \li
199 \li
200 \li
201 \row
202 \li ValueRank
203 \li
204 \li X
205 \li
206 \li
207 \li X
208 \li
209 \li
210 \li
211 \row
212 \li WriteMask
213 \li X
214 \li X
215 \li X
216 \li X
217 \li X
218 \li X
219 \li X
220 \li X
221 \endtable
222
223 \sa QOpcUaClient::addNode()
224*/
225
226QOpcUaNodeCreationAttributes::QOpcUaNodeCreationAttributes()
227 : data(new QOpcUaNodeCreationAttributesPrivate())
228{}
229
230/*!
231 Constructs a node creation attributes object with the values of \a other.
232*/
233QOpcUaNodeCreationAttributes::QOpcUaNodeCreationAttributes(const QOpcUaNodeCreationAttributes &other)
234 : data(other.data)
235{}
236
237/*!
238 Assigns the value of \a rhs to this node creation attributes object.
239*/
240QOpcUaNodeCreationAttributes &QOpcUaNodeCreationAttributes::operator=(const QOpcUaNodeCreationAttributes &rhs)
241{
242 if (this != &rhs)
243 data = rhs.data;
244 return *this;
245}
246
247QOpcUaNodeCreationAttributes::~QOpcUaNodeCreationAttributes()
248{}
249
250/*!
251 Returns the value for the AccessLevel attribute.
252*/
253QOpcUa::AccessLevel QOpcUaNodeCreationAttributes::accessLevel() const
254{
255 return data->accessLevel;
256}
257
258/*!
259 Sets the value for the AccessLevel attribute to \a accessLevel.
260*/
261void QOpcUaNodeCreationAttributes::setAccessLevel(QOpcUa::AccessLevel accessLevel)
262{
263 data->accessLevel = accessLevel;
264 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::AccessLevel);
265}
266
267/*!
268 Returns \c true if a value for the AccessLevel attribute is set.
269*/
270bool QOpcUaNodeCreationAttributes::hasAccessLevel() const
271{
272 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::AccessLevel);
273}
274
275/*!
276 Returns the value for the ArrayDimensions attribute.
277*/
278QList<quint32> QOpcUaNodeCreationAttributes::arrayDimensions() const
279{
280 return data->arrayDimensions;
281}
282
283/*!
284 Sets the value for the ArrayDimensions attribute to \a arrayDimensions.
285*/
286void QOpcUaNodeCreationAttributes::setArrayDimensions(const QList<quint32> &arrayDimensions)
287{
288 data->arrayDimensions = arrayDimensions;
289 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::ArrayDimensions);
290}
291
292/*!
293 Returns \c true if a value for the ArrayDimensions attribute is set.
294*/
295bool QOpcUaNodeCreationAttributes::hasArrayDimensions() const
296{
297 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::ArrayDimensions);
298}
299
300/*!
301 Returns the value for the ContainsNoLoops attribute.
302*/
303bool QOpcUaNodeCreationAttributes::containsNoLoops() const
304{
305 return data->containsNoLoops;
306}
307
308/*!
309 Sets the value for the ContainsNoLoops attribute to \a containsNoLoops.
310*/
311void QOpcUaNodeCreationAttributes::setContainsNoLoops(bool containsNoLoops)
312{
313 data->containsNoLoops = containsNoLoops;
314 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::ContainsNoLoops);
315}
316
317/*!
318 Returns \c true if a value for the ContainsNoLoops attribute is set.
319*/
320bool QOpcUaNodeCreationAttributes::hasContainsNoLoops() const
321{
322 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::ContainsNoLoops);
323}
324
325/*!
326 Returns the value for the DataType attribute.
327*/
328QString QOpcUaNodeCreationAttributes::dataTypeId() const
329{
330 return data->dataTypeId;
331}
332
333/*!
334 Sets the value for the DataType attribute to \a dataTypeId.
335*/
336void QOpcUaNodeCreationAttributes::setDataTypeId(const QString &dataTypeId)
337{
338 data->dataTypeId = dataTypeId;
339 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::DataType);
340}
341
342/*!
343 Returns \c true if a value for the DataType attribute is set.
344*/
345bool QOpcUaNodeCreationAttributes::hasDataTypeId() const
346{
347 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::DataType);
348}
349
350/*!
351 Returns the value for the Description attribute.
352*/
353QOpcUaLocalizedText QOpcUaNodeCreationAttributes::description() const
354{
355 return data->description;
356}
357
358/*!
359 Sets the value for the Description attribute to \a description.
360*/
361void QOpcUaNodeCreationAttributes::setDescription(const QOpcUaLocalizedText &description)
362{
363 data->description = description;
364 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Description);
365}
366
367/*!
368 Returns \c true if a value for the Description attribute is set.
369*/
370bool QOpcUaNodeCreationAttributes::hasDescription() const
371{
372 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Description);
373}
374
375/*!
376 Returns the value for the DisplayName attribute.
377*/
378QOpcUaLocalizedText QOpcUaNodeCreationAttributes::displayName() const
379{
380 return data->displayName;
381}
382
383/*!
384 Sets the value for the DisplayName attribute to \a displayName.
385*/
386void QOpcUaNodeCreationAttributes::setDisplayName(const QOpcUaLocalizedText &displayName)
387{
388 data->displayName = displayName;
389 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::DisplayName);
390}
391
392/*!
393 Returns \c true if a value for the DisplayName attribute is set.
394*/
395bool QOpcUaNodeCreationAttributes::hasDisplayName() const
396{
397 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::DisplayName);
398}
399
400/*!
401 Returns the value for the EventNotifier attribute.
402*/
403QOpcUa::EventNotifier QOpcUaNodeCreationAttributes::eventNotifier() const
404{
405 return data->eventNotifier;
406}
407
408/*!
409 Sets the value for the EventNotifier attribute to \a eventNotifier.
410*/
411void QOpcUaNodeCreationAttributes::setEventNotifier(QOpcUa::EventNotifier eventNotifier)
412{
413 data->eventNotifier = eventNotifier;
414 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::EventNotifier);
415}
416
417/*!
418 Returns \c true if a value for the EventNotifier attribute is set.
419*/
420bool QOpcUaNodeCreationAttributes::hasEventNotifier() const
421{
422 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::EventNotifier);
423}
424
425/*!
426 Returns the value for the Executable attribute.
427*/
428bool QOpcUaNodeCreationAttributes::executable() const
429{
430 return data->executable;
431}
432
433/*!
434 Sets the value for the Executable attribute to \a executable.
435*/
436void QOpcUaNodeCreationAttributes::setExecutable(bool executable)
437{
438 data->executable = executable;
439 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Executable);
440}
441
442/*!
443 Returns \c true if a value for the Executable attribute is set.
444*/
445bool QOpcUaNodeCreationAttributes::hasExecutable() const
446{
447 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Executable);
448}
449
450/*!
451 Returns the value for the Historizing attribute.
452*/
453bool QOpcUaNodeCreationAttributes::historizing() const
454{
455 return data->historizing;
456}
457
458/*!
459 Sets the value for the Historizing attribute to \a historizing.
460*/
461void QOpcUaNodeCreationAttributes::setHistorizing(bool historizing)
462{
463 data->historizing = historizing;
464 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Historizing);
465}
466
467/*!
468 Returns \c true if a value for the Historizing attribute is set.
469*/
470bool QOpcUaNodeCreationAttributes::hasHistorizing() const
471{
472 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Historizing);
473}
474
475/*!
476 Returns the value for the InverseName attribute.
477*/
478QOpcUaLocalizedText QOpcUaNodeCreationAttributes::inverseName() const
479{
480 return data->inverseName;
481}
482
483/*!
484 Sets the value for the InverseName attribute to \a inverseName.
485*/
486void QOpcUaNodeCreationAttributes::setInverseName(const QOpcUaLocalizedText &inverseName)
487{
488 data->inverseName = inverseName;
489 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::InverseName);
490}
491
492/*!
493 Returns \c true if a value for the InverseName attribute is set.
494*/
495bool QOpcUaNodeCreationAttributes::hasInverseName() const
496{
497 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::InverseName);
498}
499
500/*!
501 Returns the value for the IsAbstract attribute.
502*/
503bool QOpcUaNodeCreationAttributes::isAbstract() const
504{
505 return data->isAbstract;
506}
507
508/*!
509 Sets the value for the IsAbstract attribute to \a isAbstract.
510*/
511void QOpcUaNodeCreationAttributes::setIsAbstract(bool isAbstract)
512{
513 data->isAbstract = isAbstract;
514 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::IsAbstract);
515}
516
517/*!
518 Returns \c true if a value for the IsAbstract attribute is set.
519*/
520bool QOpcUaNodeCreationAttributes::hasIsAbstract() const
521{
522 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::IsAbstract);
523}
524
525/*!
526 Returns the value for the MinimumSamplingInterval attribute.
527*/
528double QOpcUaNodeCreationAttributes::minimumSamplingInterval() const
529{
530 return data->minimumSamplingInterval;
531}
532
533/*!
534 Sets the value for the MinimumSamplingInterval attribute to \a minimumSamplingInterval.
535*/
536void QOpcUaNodeCreationAttributes::setMinimumSamplingInterval(double minimumSamplingInterval)
537{
538 data->minimumSamplingInterval = minimumSamplingInterval;
539 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::MinimumSamplingInterval);
540}
541
542/*!
543 Returns \c true if a value for the MinimumSamplingInterval attribute is set.
544*/
545bool QOpcUaNodeCreationAttributes::hasMinimumSamplingInterval() const
546{
547 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::MinimumSamplingInterval);
548}
549
550/*!
551 Returns the value for the Symmetric attribute.
552*/
553bool QOpcUaNodeCreationAttributes::symmetric() const
554{
555 return data->symmetric;
556}
557
558/*!
559 Sets the value for the Symmetric attribute to \a symmetric.
560*/
561void QOpcUaNodeCreationAttributes::setSymmetric(bool symmetric)
562{
563 data->symmetric = symmetric;
564 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Symmetric);
565}
566
567/*!
568 Returns \c true if a value for the Symmetric attribute is set.
569*/
570bool QOpcUaNodeCreationAttributes::hasSymmetric() const
571{
572 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Symmetric);
573}
574
575/*!
576 Returns the value for the UserAccessLevel attribute.
577*/
578QOpcUa::AccessLevel QOpcUaNodeCreationAttributes::userAccessLevel() const
579{
580 return data->userAccessLevel;
581}
582
583/*!
584 Sets the value for the UserAccessLevel attribute to \a userAccessLevel.
585*/
586void QOpcUaNodeCreationAttributes::setUserAccessLevel(QOpcUa::AccessLevel userAccessLevel)
587{
588 data->userAccessLevel = userAccessLevel;
589 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::UserAccessLevel);
590}
591
592/*!
593 Returns \c true if a value for the UserAccessLevel attribute is set.
594*/
595bool QOpcUaNodeCreationAttributes::hasUserAccessLevel() const
596{
597 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::UserAccessLevel);
598}
599
600/*!
601 Returns the value for the UserExecutable attribute.
602*/
603bool QOpcUaNodeCreationAttributes::userExecutable() const
604{
605 return data->userExecutable;
606}
607
608/*!
609 Sets the value for the UserExecutable attribute to \a userExecutable.
610*/
611void QOpcUaNodeCreationAttributes::setUserExecutable(bool userExecutable)
612{
613 data->userExecutable = userExecutable;
614 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::UserExecutable);
615}
616
617/*!
618 Returns \c true if a value for the UserExecutable attribute is set.
619*/
620bool QOpcUaNodeCreationAttributes::hasUserExecutable() const
621{
622 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::UserExecutable);
623}
624
625/*!
626 Returns the value for the UserWriteMask attribute.
627*/
628QOpcUa::WriteMask QOpcUaNodeCreationAttributes::userWriteMask() const
629{
630 return data->userWriteMask;
631}
632
633/*!
634 Sets the value for the UserWriteMask attribute to \a userWriteMask.
635*/
636void QOpcUaNodeCreationAttributes::setUserWriteMask(QOpcUa::WriteMask userWriteMask)
637{
638 data->userWriteMask = userWriteMask;
639 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::UserWriteMask);
640}
641
642/*!
643 Returns \c true if a value for the UserWriteMask attribute is set.
644*/
645bool QOpcUaNodeCreationAttributes::hasUserWriteMask() const
646{
647 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::UserWriteMask);
648}
649
650/*!
651 Returns the value for the ValueRank attribute.
652*/
653qint32 QOpcUaNodeCreationAttributes::valueRank() const
654{
655 return data->valueRank;
656}
657
658/*!
659 Sets the value for the ValueRank attribute to \a valueRank.
660*/
661void QOpcUaNodeCreationAttributes::setValueRank(qint32 valueRank)
662{
663 data->valueRank = valueRank;
664 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::ValueRank);
665}
666
667/*!
668 Returns \c true if a value for the ValueRank attribute is set.
669*/
670bool QOpcUaNodeCreationAttributes::hasValueRank() const
671{
672 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::ValueRank);
673}
674
675/*!
676 Returns the value for the WriteMask attribute.
677*/
678QOpcUa::WriteMask QOpcUaNodeCreationAttributes::writeMask() const
679{
680 return data->writeMask;
681}
682
683/*!
684 Sets the value for the WriteMask attribute to \a writeMask.
685*/
686void QOpcUaNodeCreationAttributes::setWriteMask(QOpcUa::WriteMask writeMask)
687{
688 data->writeMask = writeMask;
689 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::WriteMask);
690}
691
692/*!
693 Returns \c true if a value for the WriteMask attribute is set.
694*/
695bool QOpcUaNodeCreationAttributes::hasWriteMask() const
696{
697 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::WriteMask);
698}
699
700/*!
701 Returns the value for the Value attribute.
702*/
703QVariant QOpcUaNodeCreationAttributes::value() const
704{
705 return data->value;
706}
707
708/*!
709 Sets the value for the Value attribute to \a value of type \a type.
710*/
711void QOpcUaNodeCreationAttributes::setValue(const QVariant &value, QOpcUa::Types type)
712{
713 data->value = value;
714 data->valueType = type;
715 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Value);
716}
717
718/*!
719 Returns \c true if a value for the Value attribute is set.
720*/
721bool QOpcUaNodeCreationAttributes::hasValue() const
722{
723 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Value);
724}
725
726/*!
727 Returns the type of the value attribute.
728*/
729QOpcUa::Types QOpcUaNodeCreationAttributes::valueType() const
730{
731 return data->valueType;
732}
733
734QT_END_NAMESPACE
735

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