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
226/*!
227 Default constructs a node creation attributes object with no parameters set.
228*/
229QOpcUaNodeCreationAttributes::QOpcUaNodeCreationAttributes()
230 : data(new QOpcUaNodeCreationAttributesPrivate())
231{}
232
233/*!
234 Constructs a node creation attributes object with the values of \a other.
235*/
236QOpcUaNodeCreationAttributes::QOpcUaNodeCreationAttributes(const QOpcUaNodeCreationAttributes &other)
237 : data(other.data)
238{}
239
240/*!
241 Assigns the value of \a rhs to this node creation attributes object.
242*/
243QOpcUaNodeCreationAttributes &QOpcUaNodeCreationAttributes::operator=(const QOpcUaNodeCreationAttributes &rhs)
244{
245 if (this != &rhs)
246 data = rhs.data;
247 return *this;
248}
249
250QOpcUaNodeCreationAttributes::~QOpcUaNodeCreationAttributes()
251{}
252
253/*!
254 Returns the value for the AccessLevel attribute.
255*/
256QOpcUa::AccessLevel QOpcUaNodeCreationAttributes::accessLevel() const
257{
258 return data->accessLevel;
259}
260
261/*!
262 Sets the value for the AccessLevel attribute to \a accessLevel.
263*/
264void QOpcUaNodeCreationAttributes::setAccessLevel(QOpcUa::AccessLevel accessLevel)
265{
266 data->accessLevel = accessLevel;
267 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::AccessLevel);
268}
269
270/*!
271 Returns \c true if a value for the AccessLevel attribute is set.
272*/
273bool QOpcUaNodeCreationAttributes::hasAccessLevel() const
274{
275 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::AccessLevel);
276}
277
278/*!
279 Returns the value for the ArrayDimensions attribute.
280*/
281QList<quint32> QOpcUaNodeCreationAttributes::arrayDimensions() const
282{
283 return data->arrayDimensions;
284}
285
286/*!
287 Sets the value for the ArrayDimensions attribute to \a arrayDimensions.
288*/
289void QOpcUaNodeCreationAttributes::setArrayDimensions(const QList<quint32> &arrayDimensions)
290{
291 data->arrayDimensions = arrayDimensions;
292 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::ArrayDimensions);
293}
294
295/*!
296 Returns \c true if a value for the ArrayDimensions attribute is set.
297*/
298bool QOpcUaNodeCreationAttributes::hasArrayDimensions() const
299{
300 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::ArrayDimensions);
301}
302
303/*!
304 Returns the value for the ContainsNoLoops attribute.
305*/
306bool QOpcUaNodeCreationAttributes::containsNoLoops() const
307{
308 return data->containsNoLoops;
309}
310
311/*!
312 Sets the value for the ContainsNoLoops attribute to \a containsNoLoops.
313*/
314void QOpcUaNodeCreationAttributes::setContainsNoLoops(bool containsNoLoops)
315{
316 data->containsNoLoops = containsNoLoops;
317 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::ContainsNoLoops);
318}
319
320/*!
321 Returns \c true if a value for the ContainsNoLoops attribute is set.
322*/
323bool QOpcUaNodeCreationAttributes::hasContainsNoLoops() const
324{
325 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::ContainsNoLoops);
326}
327
328/*!
329 Returns the value for the DataType attribute.
330*/
331QString QOpcUaNodeCreationAttributes::dataTypeId() const
332{
333 return data->dataTypeId;
334}
335
336/*!
337 Sets the value for the DataType attribute to \a dataTypeId.
338*/
339void QOpcUaNodeCreationAttributes::setDataTypeId(const QString &dataTypeId)
340{
341 data->dataTypeId = dataTypeId;
342 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::DataType);
343}
344
345/*!
346 Returns \c true if a value for the DataType attribute is set.
347*/
348bool QOpcUaNodeCreationAttributes::hasDataTypeId() const
349{
350 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::DataType);
351}
352
353/*!
354 Returns the value for the Description attribute.
355*/
356QOpcUaLocalizedText QOpcUaNodeCreationAttributes::description() const
357{
358 return data->description;
359}
360
361/*!
362 Sets the value for the Description attribute to \a description.
363*/
364void QOpcUaNodeCreationAttributes::setDescription(const QOpcUaLocalizedText &description)
365{
366 data->description = description;
367 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Description);
368}
369
370/*!
371 Returns \c true if a value for the Description attribute is set.
372*/
373bool QOpcUaNodeCreationAttributes::hasDescription() const
374{
375 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Description);
376}
377
378/*!
379 Returns the value for the DisplayName attribute.
380*/
381QOpcUaLocalizedText QOpcUaNodeCreationAttributes::displayName() const
382{
383 return data->displayName;
384}
385
386/*!
387 Sets the value for the DisplayName attribute to \a displayName.
388*/
389void QOpcUaNodeCreationAttributes::setDisplayName(const QOpcUaLocalizedText &displayName)
390{
391 data->displayName = displayName;
392 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::DisplayName);
393}
394
395/*!
396 Returns \c true if a value for the DisplayName attribute is set.
397*/
398bool QOpcUaNodeCreationAttributes::hasDisplayName() const
399{
400 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::DisplayName);
401}
402
403/*!
404 Returns the value for the EventNotifier attribute.
405*/
406QOpcUa::EventNotifier QOpcUaNodeCreationAttributes::eventNotifier() const
407{
408 return data->eventNotifier;
409}
410
411/*!
412 Sets the value for the EventNotifier attribute to \a eventNotifier.
413*/
414void QOpcUaNodeCreationAttributes::setEventNotifier(QOpcUa::EventNotifier eventNotifier)
415{
416 data->eventNotifier = eventNotifier;
417 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::EventNotifier);
418}
419
420/*!
421 Returns \c true if a value for the EventNotifier attribute is set.
422*/
423bool QOpcUaNodeCreationAttributes::hasEventNotifier() const
424{
425 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::EventNotifier);
426}
427
428/*!
429 Returns the value for the Executable attribute.
430*/
431bool QOpcUaNodeCreationAttributes::executable() const
432{
433 return data->executable;
434}
435
436/*!
437 Sets the value for the Executable attribute to \a executable.
438*/
439void QOpcUaNodeCreationAttributes::setExecutable(bool executable)
440{
441 data->executable = executable;
442 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Executable);
443}
444
445/*!
446 Returns \c true if a value for the Executable attribute is set.
447*/
448bool QOpcUaNodeCreationAttributes::hasExecutable() const
449{
450 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Executable);
451}
452
453/*!
454 Returns the value for the Historizing attribute.
455*/
456bool QOpcUaNodeCreationAttributes::historizing() const
457{
458 return data->historizing;
459}
460
461/*!
462 Sets the value for the Historizing attribute to \a historizing.
463*/
464void QOpcUaNodeCreationAttributes::setHistorizing(bool historizing)
465{
466 data->historizing = historizing;
467 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Historizing);
468}
469
470/*!
471 Returns \c true if a value for the Historizing attribute is set.
472*/
473bool QOpcUaNodeCreationAttributes::hasHistorizing() const
474{
475 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Historizing);
476}
477
478/*!
479 Returns the value for the InverseName attribute.
480*/
481QOpcUaLocalizedText QOpcUaNodeCreationAttributes::inverseName() const
482{
483 return data->inverseName;
484}
485
486/*!
487 Sets the value for the InverseName attribute to \a inverseName.
488*/
489void QOpcUaNodeCreationAttributes::setInverseName(const QOpcUaLocalizedText &inverseName)
490{
491 data->inverseName = inverseName;
492 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::InverseName);
493}
494
495/*!
496 Returns \c true if a value for the InverseName attribute is set.
497*/
498bool QOpcUaNodeCreationAttributes::hasInverseName() const
499{
500 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::InverseName);
501}
502
503/*!
504 Returns the value for the IsAbstract attribute.
505*/
506bool QOpcUaNodeCreationAttributes::isAbstract() const
507{
508 return data->isAbstract;
509}
510
511/*!
512 Sets the value for the IsAbstract attribute to \a isAbstract.
513*/
514void QOpcUaNodeCreationAttributes::setIsAbstract(bool isAbstract)
515{
516 data->isAbstract = isAbstract;
517 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::IsAbstract);
518}
519
520/*!
521 Returns \c true if a value for the IsAbstract attribute is set.
522*/
523bool QOpcUaNodeCreationAttributes::hasIsAbstract() const
524{
525 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::IsAbstract);
526}
527
528/*!
529 Returns the value for the MinimumSamplingInterval attribute.
530*/
531double QOpcUaNodeCreationAttributes::minimumSamplingInterval() const
532{
533 return data->minimumSamplingInterval;
534}
535
536/*!
537 Sets the value for the MinimumSamplingInterval attribute to \a minimumSamplingInterval.
538*/
539void QOpcUaNodeCreationAttributes::setMinimumSamplingInterval(double minimumSamplingInterval)
540{
541 data->minimumSamplingInterval = minimumSamplingInterval;
542 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::MinimumSamplingInterval);
543}
544
545/*!
546 Returns \c true if a value for the MinimumSamplingInterval attribute is set.
547*/
548bool QOpcUaNodeCreationAttributes::hasMinimumSamplingInterval() const
549{
550 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::MinimumSamplingInterval);
551}
552
553/*!
554 Returns the value for the Symmetric attribute.
555*/
556bool QOpcUaNodeCreationAttributes::symmetric() const
557{
558 return data->symmetric;
559}
560
561/*!
562 Sets the value for the Symmetric attribute to \a symmetric.
563*/
564void QOpcUaNodeCreationAttributes::setSymmetric(bool symmetric)
565{
566 data->symmetric = symmetric;
567 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Symmetric);
568}
569
570/*!
571 Returns \c true if a value for the Symmetric attribute is set.
572*/
573bool QOpcUaNodeCreationAttributes::hasSymmetric() const
574{
575 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Symmetric);
576}
577
578/*!
579 Returns the value for the UserAccessLevel attribute.
580*/
581QOpcUa::AccessLevel QOpcUaNodeCreationAttributes::userAccessLevel() const
582{
583 return data->userAccessLevel;
584}
585
586/*!
587 Sets the value for the UserAccessLevel attribute to \a userAccessLevel.
588*/
589void QOpcUaNodeCreationAttributes::setUserAccessLevel(QOpcUa::AccessLevel userAccessLevel)
590{
591 data->userAccessLevel = userAccessLevel;
592 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::UserAccessLevel);
593}
594
595/*!
596 Returns \c true if a value for the UserAccessLevel attribute is set.
597*/
598bool QOpcUaNodeCreationAttributes::hasUserAccessLevel() const
599{
600 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::UserAccessLevel);
601}
602
603/*!
604 Returns the value for the UserExecutable attribute.
605*/
606bool QOpcUaNodeCreationAttributes::userExecutable() const
607{
608 return data->userExecutable;
609}
610
611/*!
612 Sets the value for the UserExecutable attribute to \a userExecutable.
613*/
614void QOpcUaNodeCreationAttributes::setUserExecutable(bool userExecutable)
615{
616 data->userExecutable = userExecutable;
617 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::UserExecutable);
618}
619
620/*!
621 Returns \c true if a value for the UserExecutable attribute is set.
622*/
623bool QOpcUaNodeCreationAttributes::hasUserExecutable() const
624{
625 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::UserExecutable);
626}
627
628/*!
629 Returns the value for the UserWriteMask attribute.
630*/
631QOpcUa::WriteMask QOpcUaNodeCreationAttributes::userWriteMask() const
632{
633 return data->userWriteMask;
634}
635
636/*!
637 Sets the value for the UserWriteMask attribute to \a userWriteMask.
638*/
639void QOpcUaNodeCreationAttributes::setUserWriteMask(QOpcUa::WriteMask userWriteMask)
640{
641 data->userWriteMask = userWriteMask;
642 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::UserWriteMask);
643}
644
645/*!
646 Returns \c true if a value for the UserWriteMask attribute is set.
647*/
648bool QOpcUaNodeCreationAttributes::hasUserWriteMask() const
649{
650 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::UserWriteMask);
651}
652
653/*!
654 Returns the value for the ValueRank attribute.
655*/
656qint32 QOpcUaNodeCreationAttributes::valueRank() const
657{
658 return data->valueRank;
659}
660
661/*!
662 Sets the value for the ValueRank attribute to \a valueRank.
663*/
664void QOpcUaNodeCreationAttributes::setValueRank(qint32 valueRank)
665{
666 data->valueRank = valueRank;
667 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::ValueRank);
668}
669
670/*!
671 Returns \c true if a value for the ValueRank attribute is set.
672*/
673bool QOpcUaNodeCreationAttributes::hasValueRank() const
674{
675 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::ValueRank);
676}
677
678/*!
679 Returns the value for the WriteMask attribute.
680*/
681QOpcUa::WriteMask QOpcUaNodeCreationAttributes::writeMask() const
682{
683 return data->writeMask;
684}
685
686/*!
687 Sets the value for the WriteMask attribute to \a writeMask.
688*/
689void QOpcUaNodeCreationAttributes::setWriteMask(QOpcUa::WriteMask writeMask)
690{
691 data->writeMask = writeMask;
692 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::WriteMask);
693}
694
695/*!
696 Returns \c true if a value for the WriteMask attribute is set.
697*/
698bool QOpcUaNodeCreationAttributes::hasWriteMask() const
699{
700 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::WriteMask);
701}
702
703/*!
704 Returns the value for the Value attribute.
705*/
706QVariant QOpcUaNodeCreationAttributes::value() const
707{
708 return data->value;
709}
710
711/*!
712 Sets the value for the Value attribute to \a value of type \a type.
713*/
714void QOpcUaNodeCreationAttributes::setValue(const QVariant &value, QOpcUa::Types type)
715{
716 data->value = value;
717 data->valueType = type;
718 data->setAttributeInMask(QOpcUaNodeCreationAttributesPrivate::BitMask::Value);
719}
720
721/*!
722 Returns \c true if a value for the Value attribute is set.
723*/
724bool QOpcUaNodeCreationAttributes::hasValue() const
725{
726 return data->attributeSet(attribute: QOpcUaNodeCreationAttributesPrivate::BitMask::Value);
727}
728
729/*!
730 Returns the type of the value attribute.
731*/
732QOpcUa::Types QOpcUaNodeCreationAttributes::valueType() const
733{
734 return data->valueType;
735}
736
737QT_END_NAMESPACE
738

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

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