open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
node.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string_view>
5#include <utility> // move
6#include <vector>
7
9#include "open62541pp/common.hpp" // BrowseDirection
10#include "open62541pp/config.hpp"
15#include "open62541pp/span.hpp"
16#include "open62541pp/typeregistry.hpp" // getDataType
17#include "open62541pp/types.hpp"
19#include "open62541pp/wrapper.hpp" // asWrapper
20
26
27namespace opcua {
28
29/**
30 * High-level node class to access node attribute, browse and populate address space.
31 *
32 * The Node API is just a more convenient way of using the free functions in the opcua::services
33 * namespace.
34 *
35 * Node objects are useful as-is but they do not expose the entire OPC UA protocol. You can get
36 * access to the associated NodeId instance with the Node::id() method and apply the native
37 * open62541 functions or the free functions in the opcua::services namespace.
38 *
39 * @note The async functions are available for Client only.
40 *
41 * @tparam Connection Server or Client
42 * @see Services
43 */
44template <typename Connection>
45class Node {
46public:
47 /// Create a Node object.
48 Node(Connection& connection, const NodeId& id)
49 : connection_(&connection),
50 id_(id) {}
51
52 /// Create a Node object.
53 Node(Connection& connection, NodeId&& id)
54 : connection_(&connection),
55 id_(std::move(id)) {}
56
57 /// Get the server/client instance.
58 Connection& connection() noexcept {
59 return *connection_;
60 }
61
62 /// Get the server/client instance.
63 const Connection& connection() const noexcept {
64 return *connection_;
65 }
66
67 /// Get the node id.
68 const NodeId& id() const noexcept {
69 return id_;
70 }
71
72 /// Check if the Node exists in the most efficient manner.
73 /// If the instance is of type `Node<Server>`, the internal node store is searched.
74 /// If the instance is of type `Node<Client>`, an actual read request to the server is made.
75 bool exists() noexcept;
76
77 /// @name NodeManagement
78 /// @{
79
80 /// @wrapper{services::addFolder}
82 const NodeId& id,
83 std::string_view browseName,
84 const ObjectAttributes& attributes = {},
85 const NodeId& referenceType = ReferenceTypeId::HasComponent
86 ) {
87 return fromId(
88 connection(),
89 services::addFolder(connection(), this->id(), id, browseName, attributes, referenceType)
90 );
91 }
92
93 /// @wrapper{services::addFolder}
94 /// @param token @completiontoken{void(Result<Node>&)}
95 /// @return @asyncresult{Result<Node>}
96 template <typename CompletionToken = DefaultCompletionToken>
98 const NodeId& id,
99 std::string_view browseName,
100 const ObjectAttributes& attributes = {},
101 const NodeId& referenceType = ReferenceTypeId::HasComponent,
102 CompletionToken&& token = DefaultCompletionToken()
103 ) {
105 connection(),
106 this->id(),
107 id,
108 browseName,
109 attributes,
110 referenceType,
111 fromIdAsync(connection(), std::forward<CompletionToken>(token))
112 );
113 }
114
115 /// @wrapper{services::addObject}
117 const NodeId& id,
118 std::string_view browseName,
119 const ObjectAttributes& attributes = {},
120 const NodeId& objectType = ObjectTypeId::BaseObjectType,
121 const NodeId& referenceType = ReferenceTypeId::HasComponent
122 ) {
123 return fromId(
124 connection(),
126 connection(), this->id(), id, browseName, attributes, objectType, referenceType
127 )
128 );
129 }
130
131 /// @wrapper{services::addObjectAsync}
132 /// @param token @completiontoken{void(Result<Node>&)}
133 /// @return @asyncresult{Result<Node>}
134 template <typename CompletionToken = DefaultCompletionToken>
136 const NodeId& id,
137 std::string_view browseName,
138 const ObjectAttributes& attributes = {},
139 const NodeId& objectType = ObjectTypeId::BaseObjectType,
140 const NodeId& referenceType = ReferenceTypeId::HasComponent,
141 CompletionToken&& token = DefaultCompletionToken()
142 ) {
144 connection(),
145 this->id(),
146 id,
147 browseName,
148 attributes,
149 objectType,
150 referenceType,
151 fromIdAsync(connection(), std::forward<CompletionToken>(token))
152 );
153 }
154
155 /// @wrapper{services::addVariable}
157 const NodeId& id,
158 std::string_view browseName,
159 const VariableAttributes& attributes = {},
160 const NodeId& variableType = VariableTypeId::BaseDataVariableType,
161 const NodeId& referenceType = ReferenceTypeId::HasComponent
162 ) {
163 return fromId(
164 connection(),
166 connection(), this->id(), id, browseName, attributes, variableType, referenceType
167 )
168 );
169 }
170
171 /// @wrapper{services::addVariableAsync}
172 /// @param token @completiontoken{void(Result<Node>&)}
173 /// @return @asyncresult{Result<Node>}
174 template <typename CompletionToken = DefaultCompletionToken>
176 const NodeId& id,
177 std::string_view browseName,
178 const VariableAttributes& attributes = {},
179 const NodeId& variableType = VariableTypeId::BaseDataVariableType,
180 const NodeId& referenceType = ReferenceTypeId::HasComponent,
181 CompletionToken&& token = DefaultCompletionToken()
182 ) {
184 connection(),
185 this->id(),
186 id,
187 browseName,
188 attributes,
189 variableType,
190 referenceType,
191 fromIdAsync(connection(), std::forward<CompletionToken>(token))
192 );
193 }
194
195 /// @wrapper{services::addProperty}
197 const NodeId& id, std::string_view browseName, const VariableAttributes& attributes = {}
198 ) {
199 return fromId(
200 connection(),
201 services::addProperty(connection(), this->id(), id, browseName, attributes)
202 );
203 }
204
205 /// @wrapper{services::addPropertyAsync}
206 /// @param token @completiontoken{void(Result<Node>&)}
207 /// @return @asyncresult{Result<Node>}
208 template <typename CompletionToken = DefaultCompletionToken>
210 const NodeId& id,
211 std::string_view browseName,
212 const VariableAttributes& attributes = {},
213 CompletionToken&& token = DefaultCompletionToken()
214 ) {
216 connection(),
217 this->id(),
218 id,
219 browseName,
220 attributes,
221 fromIdAsync(connection(), std::forward<CompletionToken>(token))
222 );
223 }
224
225#ifdef UA_ENABLE_METHODCALLS
226 /// @wrapper{services::addMethod}
228 const NodeId& id,
229 std::string_view browseName,
231 Span<const Argument> inputArguments,
232 Span<const Argument> outputArguments,
233 const MethodAttributes& attributes = {},
234 const NodeId& referenceType = ReferenceTypeId::HasComponent
235 ) {
236 return fromId(
237 connection(),
239 connection(),
240 this->id(),
241 id,
242 browseName,
243 std::move(callback),
244 inputArguments,
245 outputArguments,
246 attributes,
247 referenceType
248 )
249 );
250 }
251
252 /// @wrapper{services::addMethodAsync}
253 /// @param token @completiontoken{void(Result<Node>&)}
254 /// @return @asyncresult{Result<Node>}
255 template <typename CompletionToken = DefaultCompletionToken>
257 const NodeId& id,
258 std::string_view browseName,
260 Span<const Argument> inputArguments,
261 Span<const Argument> outputArguments,
262 const MethodAttributes& attributes = {},
263 const NodeId& referenceType = ReferenceTypeId::HasComponent,
264 CompletionToken&& token = DefaultCompletionToken()
265 ) {
267 connection(),
268 this->id(),
269 id,
270 browseName,
271 std::move(callback),
272 inputArguments,
273 outputArguments,
274 attributes,
275 referenceType,
276 fromIdAsync(connection(), std::forward<CompletionToken>(token))
277 );
278 }
279#endif
280
281 /// @wrapper{services::addObjectType}
283 const NodeId& id,
284 std::string_view browseName,
285 const ObjectTypeAttributes& attributes = {},
286 const NodeId& referenceType = ReferenceTypeId::HasSubtype
287 ) {
288 return fromId(
289 connection(),
291 connection(), this->id(), id, browseName, attributes, referenceType
292 )
293 );
294 }
295
296 /// @wrapper{services::addObjectTypeAsync}
297 /// @param token @completiontoken{void(Result<Node>&)}
298 /// @return @asyncresult{Result<Node>}
299 template <typename CompletionToken = DefaultCompletionToken>
301 const NodeId& id,
302 std::string_view browseName,
303 const ObjectTypeAttributes& attributes = {},
304 const NodeId& referenceType = ReferenceTypeId::HasSubtype,
305 CompletionToken&& token = DefaultCompletionToken()
306 ) {
308 connection(),
309 this->id(),
310 id,
311 browseName,
312 attributes,
313 referenceType,
314 fromIdAsync(connection(), std::forward<CompletionToken>(token))
315 );
316 }
317
318 /// @wrapper{services::addVariableType}
320 const NodeId& id,
321 std::string_view browseName,
322 const VariableTypeAttributes& attributes = {},
323 const NodeId& variableType = VariableTypeId::BaseDataVariableType,
324 const NodeId& referenceType = ReferenceTypeId::HasSubtype
325 ) {
326 return fromId(
327 connection(),
329 connection(), this->id(), id, browseName, attributes, variableType, referenceType
330 )
331 );
332 }
333
334 /// @wrapper{services::addVariableTypeAsync}
335 /// @param token @completiontoken{void(Result<Node>&)}
336 /// @return @asyncresult{Result<Node>}
337 template <typename CompletionToken = DefaultCompletionToken>
339 const NodeId& id,
340 std::string_view browseName,
341 const VariableTypeAttributes& attributes = {},
342 const NodeId& variableType = VariableTypeId::BaseDataVariableType,
343 const NodeId& referenceType = ReferenceTypeId::HasSubtype,
344 CompletionToken&& token = DefaultCompletionToken()
345 ) {
347 connection(),
348 this->id(),
349 id,
350 browseName,
351 attributes,
352 variableType,
353 referenceType,
354 fromIdAsync(connection(), std::forward<CompletionToken>(token))
355 );
356 }
357
358 /// @wrapper{services::addReferenceType}
360 const NodeId& id,
361 std::string_view browseName,
362 const ReferenceTypeAttributes& attributes = {},
363 const NodeId& referenceType = ReferenceTypeId::HasSubtype
364 ) {
365 return fromId(
366 connection(),
368 connection(), this->id(), id, browseName, attributes, referenceType
369 )
370 );
371 }
372
373 /// @wrapper{services::addReferenceTypeAsync}
374 /// @param token @completiontoken{void(Result<Node>&)}
375 /// @return @asyncresult{Result<Node>}
376 template <typename CompletionToken = DefaultCompletionToken>
378 const NodeId& id,
379 std::string_view browseName,
380 const ReferenceTypeAttributes& attributes = {},
381 const NodeId& referenceType = ReferenceTypeId::HasSubtype,
382 CompletionToken&& token = DefaultCompletionToken()
383 ) {
385 connection(),
386 this->id(),
387 id,
388 browseName,
389 attributes,
390 referenceType,
391 fromIdAsync(connection(), std::forward<CompletionToken>(token))
392 );
393 }
394
395 /// @wrapper{services::addDataType}
397 const NodeId& id,
398 std::string_view browseName,
399 const DataTypeAttributes& attributes = {},
400 const NodeId& referenceType = ReferenceTypeId::HasSubtype
401 ) {
402 return fromId(
403 connection(),
405 connection(), this->id(), id, browseName, attributes, referenceType
406 )
407 );
408 }
409
410 /// @wrapper{services::addDataTypeAsync}
411 /// @param token @completiontoken{void(Result<Node>&)}
412 /// @return @asyncresult{Result<Node>}
413 template <typename CompletionToken = DefaultCompletionToken>
415 const NodeId& id,
416 std::string_view browseName,
417 const DataTypeAttributes& attributes = {},
418 const NodeId& referenceType = ReferenceTypeId::HasSubtype,
419 CompletionToken&& token = DefaultCompletionToken()
420 ) {
422 connection(),
423 this->id(),
424 id,
425 browseName,
426 attributes,
427 referenceType,
428 fromIdAsync(connection(), std::forward<CompletionToken>(token))
429 );
430 }
431
432 /// @wrapper{services::addView}
434 const NodeId& id,
435 std::string_view browseName,
436 const ViewAttributes& attributes = {},
437 const NodeId& referenceType = ReferenceTypeId::Organizes
438 ) {
439 return fromId(
440 connection(),
441 services::addView(connection(), this->id(), id, browseName, attributes, referenceType)
442 );
443 }
444
445 /// @wrapper{services::addViewAsync}
446 /// @param token @completiontoken{void(Result<Node>&)}
447 /// @return @asyncresult{Result<Node>}
448 template <typename CompletionToken = DefaultCompletionToken>
450 const NodeId& id,
451 std::string_view browseName,
452 const ViewAttributes& attributes = {},
453 const NodeId& referenceType = ReferenceTypeId::Organizes,
454 CompletionToken&& token = DefaultCompletionToken()
455 ) {
457 connection(),
458 this->id(),
459 id,
460 browseName,
461 attributes,
462 referenceType,
463 fromIdAsync(connection(), std::forward<CompletionToken>(token))
464 );
465 }
466
467 /// @wrapper{services::addReference}
468 Node& addReference(const NodeId& targetId, const NodeId& referenceType, bool forward = true) {
469 services::addReference(connection(), id(), targetId, referenceType, forward).throwIfBad();
470 return *this;
471 }
472
473 /// @wrapper{services::addReferenceAsync}
474 /// @param token @completiontoken{void(StatusCode)}
475 /// @return @asyncresult{StatusCode}
476 template <typename CompletionToken = DefaultCompletionToken>
478 const NodeId& targetId,
479 const NodeId& referenceType,
480 bool forward = true,
481 CompletionToken&& token = DefaultCompletionToken()
482 ) {
484 connection(),
485 id(),
486 targetId,
487 referenceType,
488 forward,
489 std::forward<CompletionToken>(token)
490 );
491 }
492
493 /// @wrapper{services::addModellingRule}
496 return *this;
497 }
498
499 /// @wrapper{services::addModellingRuleAsync}
500 /// @param token @completiontoken{void(StatusCode)}
501 /// @return @asyncresult{StatusCode}
502 template <typename CompletionToken = DefaultCompletionToken>
504 ModellingRule rule, CompletionToken&& token = DefaultCompletionToken()
505 ) {
507 connection(), id(), rule, std::forward<CompletionToken>(token)
508 );
509 }
510
511 /// @wrapper{services::deleteNode}
512 void deleteNode(bool deleteReferences = true) {
513 services::deleteNode(connection(), id(), deleteReferences).throwIfBad();
514 }
515
516 /// @wrapper{services::deleteNodeAsync}
517 /// @param token @completiontoken{void(StatusCode)}
518 /// @return @asyncresult{StatusCode}
519 template <typename CompletionToken = DefaultCompletionToken>
521 bool deleteReferences = true, CompletionToken&& token = DefaultCompletionToken()
522 ) {
524 connection(), id(), deleteReferences, std::forward<CompletionToken>(token)
525 );
526 }
527
528 /// @wrapper{services::deleteReference}
530 const NodeId& targetId,
531 const NodeId& referenceType,
532 bool isForward = true,
533 bool deleteBidirectional = true
534 ) {
536 connection(), id(), targetId, referenceType, isForward, deleteBidirectional
537 )
538 .throwIfBad();
539 return *this;
540 }
541
542 /// @wrapper{services::deleteReferenceAsync}
543 /// @param token @completiontoken{void(StatusCode)}
544 /// @return @asyncresult{StatusCode}
545 template <typename CompletionToken = DefaultCompletionToken>
547 const NodeId& targetId,
548 const NodeId& referenceType,
549 bool isForward = true,
550 bool deleteBidirectional = true,
551 CompletionToken&& token = DefaultCompletionToken()
552 ) {
554 connection(),
555 id(),
556 targetId,
557 referenceType,
558 isForward,
559 deleteBidirectional,
560 std::forward<CompletionToken>(token)
561 );
562 }
563
564 /// @}
565 /// @name View
566 /// @{
567
568 /// Browse references.
569 std::vector<ReferenceDescription> browseReferences(
570 BrowseDirection browseDirection = BrowseDirection::Both,
571 const NodeId& referenceType = ReferenceTypeId::References,
572 bool includeSubtypes = true,
574 ) {
575 const BrowseDescription bd(
576 id(),
577 browseDirection,
578 referenceType,
579 includeSubtypes,
580 nodeClassMask,
582 );
583 return services::browseAll(connection(), bd).value();
584 }
585
586 /// Browse referenced nodes (only local nodes).
587 std::vector<Node> browseReferencedNodes(
588 BrowseDirection browseDirection = BrowseDirection::Both,
589 const NodeId& referenceType = ReferenceTypeId::References,
590 bool includeSubtypes = true,
592 ) {
593 const BrowseDescription bd(
594 id(),
595 browseDirection,
596 referenceType,
597 includeSubtypes,
598 nodeClassMask,
599 BrowseResultMask::TargetInfo // only node id required here
600 );
601 auto refs = services::browseAll(connection(), bd).value();
602 std::vector<Node> nodes;
603 nodes.reserve(refs.size());
604 for (auto&& ref : refs) {
605 if (ref.getNodeId().isLocal()) {
606 nodes.emplace_back(connection(), std::move(ref.getNodeId().getNodeId()));
607 }
608 }
609 return nodes;
610 }
611
612 /// Browse child nodes (only local nodes).
613 std::vector<Node> browseChildren(
614 const NodeId& referenceType = ReferenceTypeId::HierarchicalReferences,
616 ) {
617 return browseReferencedNodes(BrowseDirection::Forward, referenceType, true, nodeClassMask);
618 }
619
620 /// Browse child node specified by its relative path from this node (only local nodes).
621 /// The relative path is specified using browse names.
622 /// @exception BadStatus (BadNoMatch) If path not found
624 auto result = services::browseSimplifiedBrowsePath(connection(), id(), path);
625 result.getStatusCode().throwIfBad();
626 for (auto&& target : result.getTargets()) {
627 if (target.getTargetId().isLocal()) {
628 return {connection(), std::move(target.getTargetId().getNodeId())};
629 }
630 }
632 }
633
634 /// Browse parent node.
635 /// A Node may have several parents, the first found is returned.
636 /// @exception BadStatus (BadNotFound) If no parent node found
638 const BrowseDescription bd(
639 id(),
642 true,
645 );
646 auto result = services::browse(connection(), bd, 1);
647 result.getStatusCode().throwIfBad();
648 if (result.getReferences().empty()) {
650 }
651 return fromId(connection(), result.getReferences().front().getNodeId());
652 }
653
654#ifdef UA_ENABLE_METHODCALLS
655 /// @}
656 /// @name Method
657 /// @{
658
659 /// @wrapper{services::call}
660 CallMethodResult callMethod(const NodeId& methodId, Span<const Variant> inputArguments) {
661 return services::call(connection(), id(), methodId, inputArguments);
662 }
663
664 /// @wrapper{services::callAsync}
665 template <typename CompletionToken = DefaultCompletionToken>
667 const NodeId& methodId,
668 Span<const Variant> inputArguments,
669 CompletionToken&& token = DefaultCompletionToken()
670 ) {
671 return services::callAsync(
672 connection(), id(), methodId, inputArguments, std::forward<CompletionToken>(token)
673 );
674 }
675#endif
676
677 /// @}
678 /// @name Attribute
679 /// @{
680
681 /// @wrapper{services::readNodeClass}
683 return services::readNodeClass(connection(), id()).value();
684 }
685
686 /// @wrapper{services::readNodeClassAsync}
687 template <typename CompletionToken = DefaultCompletionToken>
688 auto readNodeClassAsync(CompletionToken&& token = DefaultCompletionToken()) {
690 connection(), id(), std::forward<CompletionToken>(token)
691 );
692 }
693
694 /// @wrapper{services::readBrowseName}
696 return services::readBrowseName(connection(), id()).value();
697 }
698
699 /// @wrapper{services::readBrowseNameAsync}
700 template <typename CompletionToken = DefaultCompletionToken>
701 auto readBrowseNameAsync(CompletionToken&& token = DefaultCompletionToken()) {
703 connection(), id(), std::forward<CompletionToken>(token)
704 );
705 }
706
707 /// @wrapper{services::readDisplayName}
711
712 /// @wrapper{services::readDisplayNameAsync}
713 template <typename CompletionToken = DefaultCompletionToken>
714 auto readDisplayNameAsync(CompletionToken&& token = DefaultCompletionToken()) {
716 connection(), id(), std::forward<CompletionToken>(token)
717 );
718 }
719
720 /// @wrapper{services::readDescription}
724
725 /// @wrapper{services::readDescriptionAsync}
726 template <typename CompletionToken = DefaultCompletionToken>
727 auto readDescriptionAsync(CompletionToken&& token = DefaultCompletionToken()) {
729 connection(), id(), std::forward<CompletionToken>(token)
730 );
731 }
732
733 /// @wrapper{services::readWriteMask}
737
738 /// @wrapper{services::readWriteMaskAsync}
739 template <typename CompletionToken = DefaultCompletionToken>
740 auto readWriteMaskAsync(CompletionToken&& token = DefaultCompletionToken()) {
742 connection(), id(), std::forward<CompletionToken>(token)
743 );
744 }
745
746 /// @wrapper{services::readUserWriteMask}
750
751 /// @wrapper{services::readUserWriteMaskAsync}
752 template <typename CompletionToken = DefaultCompletionToken>
753 auto readUserWriteMaskAsync(CompletionToken&& token = DefaultCompletionToken()) {
755 connection(), id(), std::forward<CompletionToken>(token)
756 );
757 }
758
759 /// @wrapper{services::readIsAbstract}
761 return services::readIsAbstract(connection(), id()).value();
762 }
763
764 /// @wrapper{services::readIsAbstractAsync}
765 template <typename CompletionToken = DefaultCompletionToken>
766 auto readIsAbstractAsync(CompletionToken&& token = DefaultCompletionToken()) {
768 connection(), id(), std::forward<CompletionToken>(token)
769 );
770 }
771
772 /// @wrapper{services::readSymmetric}
774 return services::readSymmetric(connection(), id()).value();
775 }
776
777 /// @wrapper{services::readSymmetricAsync}
778 template <typename CompletionToken = DefaultCompletionToken>
779 auto readSymmetricAsync(CompletionToken&& token = DefaultCompletionToken()) {
781 connection(), id(), std::forward<CompletionToken>(token)
782 );
783 }
784
785 /// @wrapper{services::readInverseName}
789
790 /// @wrapper{services::readInverseNameAsync}
791 template <typename CompletionToken = DefaultCompletionToken>
792 auto readInverseNameAsync(CompletionToken&& token = DefaultCompletionToken()) {
794 connection(), id(), std::forward<CompletionToken>(token)
795 );
796 }
797
798 /// @wrapper{services::readContainsNoLoops}
800 return services::readContainsNoLoops(connection(), id()).value();
801 }
802
803 /// @wrapper{services::readContainsNoLoopsAsync}
804 template <typename CompletionToken = DefaultCompletionToken>
805 auto readContainsNoLoopsAsync(CompletionToken&& token = DefaultCompletionToken()) {
807 connection(), id(), std::forward<CompletionToken>(token)
808 );
809 }
810
811 /// @wrapper{services::readEventNotifier}
815
816 /// @wrapper{services::readEventNotifierAsync}
817 template <typename CompletionToken = DefaultCompletionToken>
818 auto readEventNotifierAsync(CompletionToken&& token = DefaultCompletionToken()) {
820 connection(), id(), std::forward<CompletionToken>(token)
821 );
822 }
823
824 /// @wrapper{services::readDataValue}
826 return services::readDataValue(connection(), id()).value();
827 }
828
829 /// @wrapper{services::readDataValueAsync}
830 template <typename CompletionToken = DefaultCompletionToken>
831 auto readDataValueAsync(CompletionToken&& token = DefaultCompletionToken()) {
833 connection(), id(), std::forward<CompletionToken>(token)
834 );
835 }
836
837 /// @wrapper{services::readValue}
839 return services::readValue(connection(), id()).value();
840 }
841
842 /// @wrapper{services::readValueAsync}
843 template <typename CompletionToken = DefaultCompletionToken>
844 auto readValueAsync(CompletionToken&& token = DefaultCompletionToken()) {
845 return services::readValueAsync(connection(), id(), std::forward<CompletionToken>(token));
846 }
847
848 /// Read scalar value from variable node.
849 template <typename T>
851 return readValue().template getScalarCopy<T>();
852 }
853
854 /// Read array value from variable node.
855 template <typename T>
856 std::vector<T> readValueArray() {
857 return readValue().template getArrayCopy<T>();
858 }
859
860 /// @wrapper{services::readDataType}
862 return services::readDataType(connection(), id()).value();
863 }
864
865 /// @wrapper{services::readDataTypeAsync}
866 template <typename CompletionToken = DefaultCompletionToken>
867 auto readDataTypeAsync(CompletionToken&& token = DefaultCompletionToken()) {
869 connection(), id(), std::forward<CompletionToken>(token)
870 );
871 }
872
873 /// @wrapper{services::readValueRank}
875 return services::readValueRank(connection(), id()).value();
876 }
877
878 /// @wrapper{services::readValueRankAsync}
879 template <typename CompletionToken = DefaultCompletionToken>
880 auto readValueRankAsync(CompletionToken&& token = DefaultCompletionToken()) {
882 connection(), id(), std::forward<CompletionToken>(token)
883 );
884 }
885
886 /// @wrapper{services::readArrayDimensions}
887 std::vector<uint32_t> readArrayDimensions() {
888 return services::readArrayDimensions(connection(), id()).value();
889 }
890
891 /// @wrapper{services::readArrayDimensionsAsync}
892 template <typename CompletionToken = DefaultCompletionToken>
893 auto readArrayDimensionsAsync(CompletionToken&& token = DefaultCompletionToken()) {
895 connection(), id(), std::forward<CompletionToken>(token)
896 );
897 }
898
899 /// @wrapper{services::readAccessLevel}
903
904 /// @wrapper{services::readAccessLevelAsync}
905 template <typename CompletionToken = DefaultCompletionToken>
906 auto readAccessLevelAsync(CompletionToken&& token = DefaultCompletionToken()) {
908 connection(), id(), std::forward<CompletionToken>(token)
909 );
910 }
911
912 /// @wrapper{services::readUserAccessLevel}
916
917 /// @wrapper{services::readUserAccessLevelAsync}
918 template <typename CompletionToken = DefaultCompletionToken>
919 auto readUserAccessLevelAsync(CompletionToken&& token = DefaultCompletionToken()) {
921 connection(), id(), std::forward<CompletionToken>(token)
922 );
923 }
924
925 /// @wrapper{services::readMinimumSamplingInterval}
929
930 /// @wrapper{services::readMinimumSamplingIntervalAsync}
931 template <typename CompletionToken = DefaultCompletionToken>
934 connection(), id(), std::forward<CompletionToken>(token)
935 );
936 }
937
938 /// @wrapper{services::readHistorizing}
940 return services::readHistorizing(connection(), id()).value();
941 }
942
943 /// @wrapper{services::readHistorizingAsync}
944 template <typename CompletionToken = DefaultCompletionToken>
945 auto readHistorizingAsync(CompletionToken&& token = DefaultCompletionToken()) {
947 connection(), id(), std::forward<CompletionToken>(token)
948 );
949 }
950
951 /// @wrapper{services::readExecutable}
953 return services::readExecutable(connection(), id()).value();
954 }
955
956 /// @wrapper{services::readExecutableAsync}
957 template <typename CompletionToken = DefaultCompletionToken>
958 auto readExecutableAsync(CompletionToken&& token = DefaultCompletionToken()) {
960 connection(), id(), std::forward<CompletionToken>(token)
961 );
962 }
963
964 /// @wrapper{services::readUserExecutable}
966 return services::readUserExecutable(connection(), id()).value();
967 }
968
969 /// @wrapper{services::readUserExecutableAsync}
970 template <typename CompletionToken = DefaultCompletionToken>
971 auto readUserExecutableAsync(CompletionToken&& token = DefaultCompletionToken()) {
973 connection(), id(), std::forward<CompletionToken>(token)
974 );
975 }
976
977 /// @wrapper{services::readDataTypeDefinition}
981
982 /// @wrapper{services::readDataTypeDefinitionAsync}
983 template <typename CompletionToken = DefaultCompletionToken>
984 auto readDataTypeDefinitionAsync(CompletionToken&& token = DefaultCompletionToken()) {
986 connection(), id(), std::forward<CompletionToken>(token)
987 );
988 }
989
990 /// Read the value of an object property.
991 /// @param propertyName Browse name of the property (variable node)
993 return browseObjectProperty(propertyName).readValue();
994 }
995
996 /// @wrapper{services::writeDisplayName}
997 Node& writeDisplayName(const LocalizedText& displayName) {
998 services::writeDisplayName(connection(), id(), displayName).throwIfBad();
999 return *this;
1000 }
1001
1002 /// @wrapper{services::writeDisplayNameAsync}
1003 template <typename CompletionToken = DefaultCompletionToken>
1005 const LocalizedText& displayName, CompletionToken&& token = DefaultCompletionToken()
1006 ) {
1008 connection(), id(), displayName, std::forward<CompletionToken>(token)
1009 );
1010 }
1011
1012 /// @wrapper{services::writeDescription}
1013 Node& writeDescription(const LocalizedText& description) {
1014 services::writeDescription(connection(), id(), description).throwIfBad();
1015 return *this;
1016 }
1017
1018 /// @wrapper{services::writeDescriptionAsync}
1019 template <typename CompletionToken = DefaultCompletionToken>
1021 const LocalizedText& description, CompletionToken&& token = DefaultCompletionToken()
1022 ) {
1024 connection(), id(), description, std::forward<CompletionToken>(token)
1025 );
1026 }
1027
1028 /// @wrapper{services::writeWriteMask}
1030 services::writeWriteMask(connection(), id(), writeMask).throwIfBad();
1031 return *this;
1032 }
1033
1034 /// @wrapper{services::writeWriteMaskAsync}
1035 template <typename CompletionToken = DefaultCompletionToken>
1037 Bitmask<WriteMask> writeMask, CompletionToken&& token = DefaultCompletionToken()
1038 ) {
1040 connection(), id(), writeMask, std::forward<CompletionToken>(token)
1041 );
1042 }
1043
1044 /// @wrapper{services::writeUserWriteMask}
1046 services::writeUserWriteMask(connection(), id(), userWriteMask).throwIfBad();
1047 return *this;
1048 }
1049
1050 /// @wrapper{services::writeUserWriteMaskAsync}
1051 template <typename CompletionToken = DefaultCompletionToken>
1053 Bitmask<WriteMask> userWriteMask, CompletionToken&& token = DefaultCompletionToken()
1054 ) {
1056 connection(), id(), userWriteMask, std::forward<CompletionToken>(token)
1057 );
1058 }
1059
1060 /// @wrapper{services::writeIsAbstract}
1061 Node& writeIsAbstract(bool isAbstract) {
1062 services::writeIsAbstract(connection(), id(), isAbstract).throwIfBad();
1063 return *this;
1064 }
1065
1066 /// @wrapper{services::writeIsAbstractAsync}
1067 template <typename CompletionToken = DefaultCompletionToken>
1068 auto writeIsAbstractAsync(bool isAbstract, CompletionToken&& token = DefaultCompletionToken()) {
1070 connection(), id(), isAbstract, std::forward<CompletionToken>(token)
1071 );
1072 }
1073
1074 /// @wrapper{services::writeSymmetric}
1077 return *this;
1078 }
1079
1080 /// @wrapper{services::writeSymmetricAsync}
1081 template <typename CompletionToken = DefaultCompletionToken>
1082 auto writeSymmetricAsync(bool symmetric, CompletionToken&& token = DefaultCompletionToken()) {
1084 connection(), id(), symmetric, std::forward<CompletionToken>(token)
1085 );
1086 }
1087
1088 /// @wrapper{services::writeInverseName}
1089 Node& writeInverseName(const LocalizedText& inverseName) {
1090 services::writeInverseName(connection(), id(), inverseName).throwIfBad();
1091 return *this;
1092 }
1093
1094 /// @wrapper{services::writeInverseNameAsync}
1095 template <typename CompletionToken = DefaultCompletionToken>
1097 const LocalizedText& inverseName, CompletionToken&& token = DefaultCompletionToken()
1098 ) {
1100 connection(), id(), inverseName, std::forward<CompletionToken>(token)
1101 );
1102 }
1103
1104 /// @wrapper{services::writeContainsNoLoops}
1105 Node& writeContainsNoLoops(bool containsNoLoops) {
1106 services::writeContainsNoLoops(connection(), id(), containsNoLoops).throwIfBad();
1107 return *this;
1108 }
1109
1110 /// @wrapper{services::writeContainsNoLoopsAsync}
1111 template <typename CompletionToken = DefaultCompletionToken>
1113 bool containsNoLoops, CompletionToken&& token = DefaultCompletionToken()
1114 ) {
1116 connection(), id(), containsNoLoops, std::forward<CompletionToken>(token)
1117 );
1118 }
1119
1120 /// @wrapper{services::writeEventNotifier}
1122 services::writeEventNotifier(connection(), id(), eventNotifier).throwIfBad();
1123 return *this;
1124 }
1125
1126 /// @wrapper{services::writeEventNotifierAsync}
1127 template <typename CompletionToken = DefaultCompletionToken>
1129 Bitmask<EventNotifier> eventNotifier, CompletionToken&& token = DefaultCompletionToken()
1130 ) {
1132 connection(), id(), eventNotifier, std::forward<CompletionToken>(token)
1133 );
1134 }
1135
1136 /// @wrapper{services::writeDataValue}
1139 return *this;
1140 }
1141
1142 /// @wrapper{services::writeDataValueAsync}
1143 template <typename CompletionToken = DefaultCompletionToken>
1145 const DataValue& value, CompletionToken&& token = DefaultCompletionToken()
1146 ) {
1148 connection(), id(), value, std::forward<CompletionToken>(token)
1149 );
1150 }
1151
1152 /// @wrapper{services::writeValue}
1153 Node& writeValue(const Variant& value) {
1154 services::writeValue(connection(), id(), value).throwIfBad();
1155 return *this;
1156 }
1157
1158 /// @wrapper{services::writeValueAsync}
1159 template <typename CompletionToken = DefaultCompletionToken>
1160 auto writeValueAsync(const Variant& value, CompletionToken&& token = DefaultCompletionToken()) {
1162 connection(), id(), value, std::forward<CompletionToken>(token)
1163 );
1164 }
1165
1166 /// Write scalar to variable node.
1167 template <typename T>
1168 Node& writeValueScalar(const T& value) {
1169 // NOLINTNEXTLINE(*-const-cast), variant isn't modified, try to avoid copy
1171 return *this;
1172 }
1173
1174 /// Write array value to variable node.
1175 template <typename ArrayLike>
1176 Node& writeValueArray(ArrayLike&& array) {
1177 writeValue(
1178 Variant::fromArray<VariantPolicy::ReferenceIfPossible>(std::forward<ArrayLike>(array))
1179 );
1180 return *this;
1181 }
1182
1183 /// Write range of elements as array value to variable node.
1184 template <typename InputIt>
1185 Node& writeValueArray(InputIt first, InputIt last) {
1187 return *this;
1188 }
1189
1190 /// @wrapper{services::writeDataType}
1191 Node& writeDataType(const NodeId& dataType) {
1192 services::writeDataType(connection(), id(), dataType).throwIfBad();
1193 return *this;
1194 }
1195
1196 /// @overload
1197 /// Deduce the `typeId` from the template type.
1198 template <typename T>
1202
1203 /// @wrapper{services::writeDataTypeAsync}
1204 template <typename CompletionToken = DefaultCompletionToken>
1206 const NodeId& dataType, CompletionToken&& token = DefaultCompletionToken()
1207 ) {
1209 connection(), id(), dataType, std::forward<CompletionToken>(token)
1210 );
1211 }
1212
1213 /// @wrapper{services::writeValueRank}
1215 services::writeValueRank(connection(), id(), valueRank).throwIfBad();
1216 return *this;
1217 }
1218
1219 /// @wrapper{services::writeValueRankAsync}
1220 template <typename CompletionToken = DefaultCompletionToken>
1222 ValueRank valueRank, CompletionToken&& token = DefaultCompletionToken()
1223 ) {
1225 connection(), id(), valueRank, std::forward<CompletionToken>(token)
1226 );
1227 }
1228
1229 /// @wrapper{services::writeArrayDimensions}
1232 return *this;
1233 }
1234
1235 /// @wrapper{services::writeArrayDimensionsAsync}
1236 template <typename CompletionToken = DefaultCompletionToken>
1238 Span<const uint32_t> dimensions, CompletionToken&& token = DefaultCompletionToken()
1239 ) {
1241 connection(), id(), dimensions, std::forward<CompletionToken>(token)
1242 );
1243 }
1244
1245 /// @wrapper{services::writeAccessLevel}
1247 services::writeAccessLevel(connection(), id(), accessLevel).throwIfBad();
1248 return *this;
1249 }
1250
1251 /// @wrapper{services::writeAccessLevelAsync}
1252 template <typename CompletionToken = DefaultCompletionToken>
1254 Bitmask<AccessLevel> accessLevel, CompletionToken&& token = DefaultCompletionToken()
1255 ) {
1257 connection(), id(), accessLevel, std::forward<CompletionToken>(token)
1258 );
1259 }
1260
1261 /// @wrapper{services::writeUserAccessLevel}
1263 services::writeUserAccessLevel(connection(), id(), userAccessLevel).throwIfBad();
1264 return *this;
1265 }
1266
1267 /// @wrapper{services::writeUserAccessLevelAsync}
1268 template <typename CompletionToken = DefaultCompletionToken>
1270 Bitmask<AccessLevel> userAccessLevel, CompletionToken&& token = DefaultCompletionToken()
1271 ) {
1273 connection(), id(), userAccessLevel, std::forward<CompletionToken>(token)
1274 );
1275 }
1276
1277 /// @wrapper{services::writeMinimumSamplingInterval}
1278 Node& writeMinimumSamplingInterval(double milliseconds) {
1280 return *this;
1281 }
1282
1283 /// @wrapper{services::writeMinimumSamplingIntervalAsync}
1284 template <typename CompletionToken = DefaultCompletionToken>
1286 double milliseconds, CompletionToken&& token = DefaultCompletionToken()
1287 ) {
1289 connection(), id(), milliseconds, std::forward<CompletionToken>(token)
1290 );
1291 }
1292
1293 /// @wrapper{services::writeHistorizing}
1294 Node& writeHistorizing(bool historizing) {
1295 services::writeHistorizing(connection(), id(), historizing).throwIfBad();
1296 return *this;
1297 }
1298
1299 /// @wrapper{services::writeHistorizingAsync}
1300 template <typename CompletionToken = DefaultCompletionToken>
1302 bool historizing, CompletionToken&& token = DefaultCompletionToken()
1303 ) {
1305 connection(), id(), historizing, std::forward<CompletionToken>(token)
1306 );
1307 }
1308
1309 /// @wrapper{services::writeExecutable}
1310 Node& writeExecutable(bool executable) {
1311 services::writeExecutable(connection(), id(), executable).throwIfBad();
1312 return *this;
1313 }
1314
1315 /// @wrapper{services::writeExecutableAsync}
1316 template <typename CompletionToken = DefaultCompletionToken>
1317 auto writeExecutableAsync(bool executable, CompletionToken&& token = DefaultCompletionToken()) {
1319 connection(), id(), executable, std::forward<CompletionToken>(token)
1320 );
1321 }
1322
1323 /// @wrapper{services::writeUserExecutable}
1324 Node& writeUserExecutable(bool userExecutable) {
1325 services::writeUserExecutable(connection(), id(), userExecutable).throwIfBad();
1326 return *this;
1327 }
1328
1329 /// @wrapper{services::writeUserExecutableAsync}
1330 template <typename CompletionToken = DefaultCompletionToken>
1332 bool userExecutable, CompletionToken&& token = DefaultCompletionToken()
1333 ) {
1335 connection(), id(), userExecutable, std::forward<CompletionToken>(token)
1336 );
1337 }
1338
1339 /// Write the value of an object property.
1340 /// @param propertyName Browse name of the property (variable node)
1341 /// @param value New value
1342 Node& writeObjectProperty(const QualifiedName& propertyName, const Variant& value) {
1343 browseObjectProperty(propertyName).writeValue(value);
1344 return *this;
1345 }
1346
1347 /// @}
1348
1349private:
1350 static Node fromId(Connection& connection, Result<NodeId>&& result) {
1351 return {connection, std::move(result).value()};
1352 }
1353
1354 static Node fromId(Connection& connection, ExpandedNodeId& id) {
1355 if (!id.isLocal()) {
1356 throw BadStatus(UA_STATUSCODE_BADNODEIDUNKNOWN);
1357 }
1358 return {connection, std::move(id.getNodeId())};
1359 }
1360
1361 template <typename CompletionToken>
1362 static auto fromIdAsync(Connection& connection, CompletionToken&& token) {
1364 [&](Result<NodeId>& result) {
1365 return result.transform([&](NodeId& id) -> Node {
1366 return {connection, std::move(id)};
1367 });
1368 },
1369 std::forward<CompletionToken>(token)
1370 );
1371 }
1372
1373 Node browseObjectProperty(const QualifiedName& propertyName) {
1375 connection(),
1376 BrowsePath(id(), {{ReferenceTypeId::HasProperty, false, true, propertyName}})
1377 );
1378 result.getStatusCode().throwIfBad();
1379 for (auto&& target : result.getTargets()) {
1380 if (target.getTargetId().isLocal()) {
1381 return {connection(), std::move(target.getTargetId().getNodeId())};
1382 }
1383 }
1384 throw BadStatus(UA_STATUSCODE_BADNOTFOUND);
1385 }
1386
1387 Connection* connection_;
1388 NodeId id_;
1389};
1390
1391/* ---------------------------------------------------------------------------------------------- */
1392
1393template <typename Connection>
1394bool operator==(const Node<Connection>& lhs, const Node<Connection>& rhs) noexcept {
1395 return (lhs.connection() == rhs.connection()) && (lhs.id() == rhs.id());
1396}
1397
1398template <typename Connection>
1399bool operator!=(const Node<Connection>& lhs, const Node<Connection>& rhs) noexcept {
1400 return !(lhs == rhs);
1401}
1402
1403} // namespace opcua
Exception for bad status codes from open62541 UA_STATUSCODE_*.
Definition exception.hpp:15
Bitmask using (scoped) enums.
Definition bitmask.hpp:125
UA_BrowseDescription wrapper class.
UA_CallMethodResult wrapper class.
UA_DataTypeAttributes wrapper class.
UA_DataValue wrapper class.
Definition types.hpp:1478
UA_LocalizedText wrapper class.
Definition types.hpp:837
UA_MethodAttributes wrapper class.
UA_NodeId wrapper class.
Definition types.hpp:590
High-level node class to access node attribute, browse and populate address space.
Definition server.hpp:30
auto readEventNotifierAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::EventNotifier attribute of a node.
Definition node.hpp:818
auto writeContainsNoLoopsAsync(bool containsNoLoops, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::ContainsNoLoops attribute of a node.
Definition node.hpp:1112
double readMinimumSamplingInterval()
Read the AttributeId::MinimumSamplingInterval attribute of a node.
Definition node.hpp:926
auto readArrayDimensionsAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::ArrayDimensions attribute of a node.
Definition node.hpp:893
auto readHistorizingAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::Historizing attribute of a node.
Definition node.hpp:945
auto readBrowseNameAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::BrowseName attribute of a node.
Definition node.hpp:701
auto writeValueAsync(const Variant &value, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::Value attribute of a node.
Definition node.hpp:1160
bool readIsAbstract()
Read the AttributeId::IsAbstract attribute of a node.
Definition node.hpp:760
auto writeEventNotifierAsync(Bitmask< EventNotifier > eventNotifier, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::EventNotifier attribute of a node.
Definition node.hpp:1128
QualifiedName readBrowseName()
Read the AttributeId::BrowseName attribute of a node.
Definition node.hpp:695
Node & writeEventNotifier(Bitmask< EventNotifier > eventNotifier)
Write the AttributeId::EventNotifier attribute of a node.
Definition node.hpp:1121
Bitmask< AccessLevel > readUserAccessLevel()
Read the AttributeId::UserAccessLevel attribute of a node.
Definition node.hpp:913
Variant readObjectProperty(const QualifiedName &propertyName)
Read the value of an object property.
Definition node.hpp:992
auto readDescriptionAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::Description attribute of a node.
Definition node.hpp:727
auto addReferenceTypeAsync(const NodeId &id, std::string_view browseName, const ReferenceTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype, CompletionToken &&token=DefaultCompletionToken())
Add reference type.
Definition node.hpp:377
LocalizedText readDisplayName()
Read the AttributeId::DisplayName attribute of a node.
Definition node.hpp:708
auto readUserExecutableAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::UserExecutable attribute of a node.
Definition node.hpp:971
auto writeArrayDimensionsAsync(Span< const uint32_t > dimensions, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::ArrayDimensions attribute of a node.
Definition node.hpp:1237
Node & writeArrayDimensions(Span< const uint32_t > dimensions)
Write the AttributeId::ArrayDimensions attribute of a node.
Definition node.hpp:1230
auto addMethodAsync(const NodeId &id, std::string_view browseName, services::MethodCallback callback, Span< const Argument > inputArguments, Span< const Argument > outputArguments, const MethodAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasComponent, CompletionToken &&token=DefaultCompletionToken())
Add method.
Definition node.hpp:256
Node addView(const NodeId &id, std::string_view browseName, const ViewAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::Organizes)
Add view.
Definition node.hpp:433
auto readDataTypeAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::DataType attribute of a node.
Definition node.hpp:867
auto readValueRankAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::ValueRank attribute of a node.
Definition node.hpp:880
Node & writeValueScalar(const T &value)
Write scalar to variable node.
Definition node.hpp:1168
auto addModellingRuleAsync(ModellingRule rule, CompletionToken &&token=DefaultCompletionToken())
Add modelling rule.
Definition node.hpp:503
auto writeHistorizingAsync(bool historizing, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::Historizing attribute of a node.
Definition node.hpp:1301
Node & writeContainsNoLoops(bool containsNoLoops)
Write the AttributeId::ContainsNoLoops attribute of a node.
Definition node.hpp:1105
DataValue readDataValue()
Read the AttributeId::Value attribute of a node as a DataValue object.
Definition node.hpp:825
auto writeDescriptionAsync(const LocalizedText &description, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::Description attribute of a node.
Definition node.hpp:1020
auto writeDisplayNameAsync(const LocalizedText &displayName, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::DisplayName attribute of a node.
Definition node.hpp:1004
auto writeDataValueAsync(const DataValue &value, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::Value attribute of a node as a DataValue object.
Definition node.hpp:1144
auto readDataValueAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::Value attribute of a node as a DataValue object.
Definition node.hpp:831
auto addObjectTypeAsync(const NodeId &id, std::string_view browseName, const ObjectTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype, CompletionToken &&token=DefaultCompletionToken())
Add object type.
Definition node.hpp:300
Node & addModellingRule(ModellingRule rule)
Add modelling rule.
Definition node.hpp:494
auto addObjectAsync(const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &objectType=ObjectTypeId::BaseObjectType, const NodeId &referenceType=ReferenceTypeId::HasComponent, CompletionToken &&token=DefaultCompletionToken())
Add object.
Definition node.hpp:135
Node addObjectType(const NodeId &id, std::string_view browseName, const ObjectTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype)
Add object type.
Definition node.hpp:282
Node addProperty(const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={})
Add property.
Definition node.hpp:196
auto writeValueRankAsync(ValueRank valueRank, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::ValueRank attribute of a node.
Definition node.hpp:1221
Variant readDataTypeDefinition()
Read the AttributeId::DataTypeDefinition attribute of a node.
Definition node.hpp:978
auto callMethodAsync(const NodeId &methodId, Span< const Variant > inputArguments, CompletionToken &&token=DefaultCompletionToken())
Definition node.hpp:666
auto addVariableAsync(const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasComponent, CompletionToken &&token=DefaultCompletionToken())
Add variable.
Definition node.hpp:175
Connection & connection() noexcept
Get the server/client instance.
Definition node.hpp:58
Node & writeValueArray(ArrayLike &&array)
Write array value to variable node.
Definition node.hpp:1176
Node & writeUserExecutable(bool userExecutable)
Write the AttributeId::UserExecutable attribute of a node.
Definition node.hpp:1324
Node & writeObjectProperty(const QualifiedName &propertyName, const Variant &value)
Write the value of an object property.
Definition node.hpp:1342
std::vector< Node > browseChildren(const NodeId &referenceType=ReferenceTypeId::HierarchicalReferences, Bitmask< NodeClass > nodeClassMask=NodeClass::Unspecified)
Browse child nodes (only local nodes).
Definition node.hpp:613
auto addVariableTypeAsync(const NodeId &id, std::string_view browseName, const VariableTypeAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasSubtype, CompletionToken &&token=DefaultCompletionToken())
Add variable type.
Definition node.hpp:338
Node(Connection &connection, const NodeId &id)
Create a Node object.
Definition node.hpp:48
void deleteNode(bool deleteReferences=true)
Delete node.
Definition node.hpp:512
auto addDataTypeAsync(const NodeId &id, std::string_view browseName, const DataTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype, CompletionToken &&token=DefaultCompletionToken())
Add data type.
Definition node.hpp:414
auto deleteNodeAsync(bool deleteReferences=true, CompletionToken &&token=DefaultCompletionToken())
Delete node.
Definition node.hpp:520
auto readContainsNoLoopsAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::ContainsNoLoops attribute of a node.
Definition node.hpp:805
auto writeAccessLevelAsync(Bitmask< AccessLevel > accessLevel, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::AccessLevel attribute of a node.
Definition node.hpp:1253
Node & writeHistorizing(bool historizing)
Write the AttributeId::Historizing attribute of a node.
Definition node.hpp:1294
LocalizedText readInverseName()
Read the AttributeId::InverseName attribute of a node.
Definition node.hpp:786
Node & deleteReference(const NodeId &targetId, const NodeId &referenceType, bool isForward=true, bool deleteBidirectional=true)
Delete reference.
Definition node.hpp:529
NodeClass readNodeClass()
Read the AttributeId::NodeClass attribute of a node.
Definition node.hpp:682
Node & writeSymmetric(bool symmetric)
Write the AttributeId::Symmetric attribute of a node.
Definition node.hpp:1075
auto readWriteMaskAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::WriteMask attribute of a node.
Definition node.hpp:740
bool exists() noexcept
Check if the Node exists in the most efficient manner.
auto addPropertyAsync(const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={}, CompletionToken &&token=DefaultCompletionToken())
Add property.
Definition node.hpp:209
Node & writeAccessLevel(Bitmask< AccessLevel > accessLevel)
Write the AttributeId::AccessLevel attribute of a node.
Definition node.hpp:1246
Node addFolder(const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add folder.
Definition node.hpp:81
auto deleteReferenceAsync(const NodeId &targetId, const NodeId &referenceType, bool isForward=true, bool deleteBidirectional=true, CompletionToken &&token=DefaultCompletionToken())
Delete reference.
Definition node.hpp:546
Node & writeDataType(const NodeId &dataType)
Write the AttributeId::DataType attribute of a node.
Definition node.hpp:1191
std::vector< uint32_t > readArrayDimensions()
Read the AttributeId::ArrayDimensions attribute of a node.
Definition node.hpp:887
Node & writeDataValue(const DataValue &value)
Write the AttributeId::Value attribute of a node as a DataValue object.
Definition node.hpp:1137
Node addObject(const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &objectType=ObjectTypeId::BaseObjectType, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add object.
Definition node.hpp:116
Node & writeWriteMask(Bitmask< WriteMask > writeMask)
Write the AttributeId::WriteMask attribute of a node.
Definition node.hpp:1029
std::vector< Node > browseReferencedNodes(BrowseDirection browseDirection=BrowseDirection::Both, const NodeId &referenceType=ReferenceTypeId::References, bool includeSubtypes=true, Bitmask< NodeClass > nodeClassMask=NodeClass::Unspecified)
Browse referenced nodes (only local nodes).
Definition node.hpp:587
Node addDataType(const NodeId &id, std::string_view browseName, const DataTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype)
Add data type.
Definition node.hpp:396
auto writeInverseNameAsync(const LocalizedText &inverseName, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::InverseName attribute of a node.
Definition node.hpp:1096
std::vector< ReferenceDescription > browseReferences(BrowseDirection browseDirection=BrowseDirection::Both, const NodeId &referenceType=ReferenceTypeId::References, bool includeSubtypes=true, Bitmask< NodeClass > nodeClassMask=NodeClass::Unspecified)
Browse references.
Definition node.hpp:569
auto readInverseNameAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::InverseName attribute of a node.
Definition node.hpp:792
T readValueScalar()
Read scalar value from variable node.
Definition node.hpp:850
auto readDisplayNameAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::DisplayName attribute of a node.
Definition node.hpp:714
bool readExecutable()
Read the AttributeId::Executable attribute of a node.
Definition node.hpp:952
bool readContainsNoLoops()
Read the AttributeId::ContainsNoLoops attribute of a node.
Definition node.hpp:799
Node & writeInverseName(const LocalizedText &inverseName)
Write the AttributeId::InverseName attribute of a node.
Definition node.hpp:1089
Bitmask< AccessLevel > readAccessLevel()
Read the AttributeId::AccessLevel attribute of a node.
Definition node.hpp:900
Node addReferenceType(const NodeId &id, std::string_view browseName, const ReferenceTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype)
Add reference type.
Definition node.hpp:359
Variant readValue()
Read the AttributeId::Value attribute of a node.
Definition node.hpp:838
Node & writeValueRank(ValueRank valueRank)
Write the AttributeId::ValueRank attribute of a node.
Definition node.hpp:1214
Node & writeDisplayName(const LocalizedText &displayName)
Write the AttributeId::DisplayName attribute of a node.
Definition node.hpp:997
Node(Connection &connection, NodeId &&id)
Create a Node object.
Definition node.hpp:53
auto addFolderAsync(const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasComponent, CompletionToken &&token=DefaultCompletionToken())
Add folder.
Definition node.hpp:97
bool readSymmetric()
Read the AttributeId::Symmetric attribute of a node.
Definition node.hpp:773
Node & writeIsAbstract(bool isAbstract)
Write the AttributeId::IsAbstract attribute of a node.
Definition node.hpp:1061
LocalizedText readDescription()
Read the AttributeId::Description attribute of a node.
Definition node.hpp:721
auto writeUserAccessLevelAsync(Bitmask< AccessLevel > userAccessLevel, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::UserAccessLevel attribute of a node.
Definition node.hpp:1269
Node addVariableType(const NodeId &id, std::string_view browseName, const VariableTypeAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasSubtype)
Add variable type.
Definition node.hpp:319
auto readSymmetricAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::Symmetric attribute of a node.
Definition node.hpp:779
Bitmask< WriteMask > readUserWriteMask()
Read the AttributeId::UserWriteMask attribute of a node.
Definition node.hpp:747
Node & writeDataType()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition node.hpp:1199
Node & writeValue(const Variant &value)
Write the AttributeId::Value attribute of a node.
Definition node.hpp:1153
bool readHistorizing()
Read the AttributeId::Historizing attribute of a node.
Definition node.hpp:939
Node & writeUserWriteMask(Bitmask< WriteMask > userWriteMask)
Write the AttributeId::UserWriteMask attribute of a node.
Definition node.hpp:1045
ValueRank readValueRank()
Read the AttributeId::ValueRank attribute of a node.
Definition node.hpp:874
auto writeWriteMaskAsync(Bitmask< WriteMask > writeMask, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::WriteMask attribute of a node.
Definition node.hpp:1036
auto readIsAbstractAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::IsAbstract attribute of a node.
Definition node.hpp:766
Node & writeExecutable(bool executable)
Write the AttributeId::Executable attribute of a node.
Definition node.hpp:1310
auto writeExecutableAsync(bool executable, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::Executable attribute of a node.
Definition node.hpp:1317
auto readExecutableAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::Executable attribute of a node.
Definition node.hpp:958
Node & addReference(const NodeId &targetId, const NodeId &referenceType, bool forward=true)
Add reference.
Definition node.hpp:468
auto readValueAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::Value attribute of a node.
Definition node.hpp:844
NodeId readDataType()
Read the AttributeId::DataType attribute of a node.
Definition node.hpp:861
std::vector< T > readValueArray()
Read array value from variable node.
Definition node.hpp:856
const Connection & connection() const noexcept
Get the server/client instance.
Definition node.hpp:63
auto readUserAccessLevelAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::UserAccessLevel attribute of a node.
Definition node.hpp:919
auto readMinimumSamplingIntervalAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::MinimumSamplingInterval attribute of a node.
Definition node.hpp:932
Node addVariable(const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add variable.
Definition node.hpp:156
auto addViewAsync(const NodeId &id, std::string_view browseName, const ViewAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::Organizes, CompletionToken &&token=DefaultCompletionToken())
Add view.
Definition node.hpp:449
Node & writeDescription(const LocalizedText &description)
Write the AttributeId::Description attribute of a node.
Definition node.hpp:1013
auto writeDataTypeAsync(const NodeId &dataType, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::DataType attribute of a node.
Definition node.hpp:1205
Node & writeValueArray(InputIt first, InputIt last)
Write range of elements as array value to variable node.
Definition node.hpp:1185
Node addMethod(const NodeId &id, std::string_view browseName, services::MethodCallback callback, Span< const Argument > inputArguments, Span< const Argument > outputArguments, const MethodAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add method.
Definition node.hpp:227
CallMethodResult callMethod(const NodeId &methodId, Span< const Variant > inputArguments)
Call server methods.
Definition node.hpp:660
auto readAccessLevelAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::AccessLevel attribute of a node.
Definition node.hpp:906
auto writeMinimumSamplingIntervalAsync(double milliseconds, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::MinimumSamplingInterval attribute of a node.
Definition node.hpp:1285
Node browseParent()
Browse parent node.
Definition node.hpp:637
Bitmask< WriteMask > readWriteMask()
Read the AttributeId::WriteMask attribute of a node.
Definition node.hpp:734
Node & writeUserAccessLevel(Bitmask< AccessLevel > userAccessLevel)
Write the AttributeId::UserAccessLevel attribute of a node.
Definition node.hpp:1262
auto writeUserExecutableAsync(bool userExecutable, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::UserExecutable attribute of a node.
Definition node.hpp:1331
auto writeSymmetricAsync(bool symmetric, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::Symmetric attribute of a node.
Definition node.hpp:1082
auto readDataTypeDefinitionAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::DataTypeDefinition attribute of a node.
Definition node.hpp:984
bool readUserExecutable()
Read the AttributeId::UserExecutable attribute of a node.
Definition node.hpp:965
const NodeId & id() const noexcept
Get the node id.
Definition node.hpp:68
auto addReferenceAsync(const NodeId &targetId, const NodeId &referenceType, bool forward=true, CompletionToken &&token=DefaultCompletionToken())
Add reference.
Definition node.hpp:477
auto readNodeClassAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::NodeClass attribute of a node.
Definition node.hpp:688
auto writeUserWriteMaskAsync(Bitmask< WriteMask > userWriteMask, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::UserWriteMask attribute of a node.
Definition node.hpp:1052
Bitmask< EventNotifier > readEventNotifier()
Read the AttributeId::EventNotifier attribute of a node.
Definition node.hpp:812
auto writeIsAbstractAsync(bool isAbstract, CompletionToken &&token=DefaultCompletionToken())
Write the AttributeId::IsAbstract attribute of a node.
Definition node.hpp:1068
Node & writeMinimumSamplingInterval(double milliseconds)
Write the AttributeId::MinimumSamplingInterval attribute of a node.
Definition node.hpp:1278
auto readUserWriteMaskAsync(CompletionToken &&token=DefaultCompletionToken())
Read the AttributeId::UserWriteMask attribute of a node.
Definition node.hpp:753
Node browseChild(Span< const QualifiedName > path)
Browse child node specified by its relative path from this node (only local nodes).
Definition node.hpp:623
UA_ObjectAttributes wrapper class.
UA_ObjectTypeAttributes wrapper class.
UA_QualifiedName wrapper class.
Definition types.hpp:800
UA_ReferenceTypeAttributes wrapper class.
The template class Result encapsulates a StatusCode and optionally a value.
Definition result.hpp:53
View to a contiguous sequence of objects, similar to std::span in C++20.
Definition span.hpp:26
constexpr void throwIfBad() const
Throw a BadStatus exception if the status code is bad.
Definition types.hpp:82
UA_VariableAttributes wrapper class.
UA_VariableAttributes wrapper class.
UA_Variant wrapper class.
Definition types.hpp:887
static Variant fromScalar(T &&value)
Create Variant from scalar value.
Definition types.hpp:894
static Variant fromArray(ArrayLike &&array)
Create Variant from array.
Definition types.hpp:912
UA_ViewAttributes wrapper class.
auto addObjectTypeAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectTypeAttributes &attributes, const NodeId &referenceType, CompletionToken &&token)
Add object type.
auto addPropertyAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableAttributes &attributes, CompletionToken &&token)
Add property.
Result< NodeId > addObject(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes, const NodeId &objectType, const NodeId &referenceType) noexcept
Add object.
auto addMethodAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, MethodCallback callback, Span< const Argument > inputArguments, Span< const Argument > outputArguments, const MethodAttributes &attributes, const NodeId &referenceType, CompletionToken &&token)
Add method.
Result< NodeId > addObjectType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectTypeAttributes &attributes, const NodeId &referenceType) noexcept
Add object type.
Result< NodeId > addMethod(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, MethodCallback callback, Span< const Argument > inputArguments, Span< const Argument > outputArguments, const MethodAttributes &attributes, const NodeId &referenceType) noexcept
Add method.
auto addFolderAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes, const NodeId &referenceType, CompletionToken &&token)
Add folder.
std::function< void(Span< const Variant > input, Span< Variant > output)> MethodCallback
Method callback.
Result< NodeId > addFolder(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes, const NodeId &referenceType) noexcept
Add folder.
Result< NodeId > addDataType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const DataTypeAttributes &attributes, const NodeId &referenceType) noexcept
Add data type.
auto addReferenceTypeAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ReferenceTypeAttributes &attributes, const NodeId &referenceType, CompletionToken &&token)
Add reference type.
auto addDataTypeAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const DataTypeAttributes &attributes, const NodeId &referenceType, CompletionToken &&token)
Add data type.
auto addVariableTypeAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableTypeAttributes &attributes, const NodeId &variableType, const NodeId &referenceType, CompletionToken &&token)
Add variable type.
Result< NodeId > addVariableType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableTypeAttributes &attributes, const NodeId &variableType, const NodeId &referenceType) noexcept
Add variable type.
auto addVariableAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableAttributes &attributes, const NodeId &variableType, const NodeId &referenceType, CompletionToken &&token)
Add variable.
Result< NodeId > addReferenceType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ReferenceTypeAttributes &attributes, const NodeId &referenceType) noexcept
Add reference type.
Result< NodeId > addProperty(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableAttributes &attributes) noexcept
Add property.
Result< NodeId > addView(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ViewAttributes &attributes, const NodeId &referenceType) noexcept
Add view.
auto addObjectAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes, const NodeId &objectType, const NodeId &referenceType, CompletionToken &&token)
Add object.
auto addViewAsync(Client &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ViewAttributes &attributes, const NodeId &referenceType, CompletionToken &&token)
Add view.
Result< NodeId > addVariable(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableAttributes &attributes, const NodeId &variableType, const NodeId &referenceType) noexcept
Add variable.
StatusCode addModellingRule(T &connection, const NodeId &id, ModellingRule rule) noexcept
Add modelling rule.
auto addModellingRuleAsync(Client &connection, const NodeId &id, ModellingRule rule, CompletionToken &&token)
Add modelling rule.
auto addReferenceAsync(Client &connection, const NodeId &sourceId, const NodeId &targetId, const NodeId &referenceType, bool forward, CompletionToken &&token)
Add reference.
StatusCode addReference(T &connection, const NodeId &sourceId, const NodeId &targetId, const NodeId &referenceType, bool forward) noexcept
Add reference.
UseFutureToken DefaultCompletionToken
Default completion token for async operations.
Definition async.hpp:147
Result< std::vector< ReferenceDescription > > browseAll(T &connection, const BrowseDescription &bd, uint32_t maxReferences=0)
Discover all the references of a specified node (without calling browseNext).
BrowseResponse browse(Client &connection, const BrowseRequest &request) noexcept
Discover the references of one or more nodes (client only).
CallResponse call(Client &connection, const CallRequest &request) noexcept
Call server methods.
auto callAsync(Client &connection, const CallRequest &request, CompletionToken &&token)
Call server methods.
Definition method.hpp:49
auto deleteNodeAsync(Client &connection, const NodeId &id, bool deleteReferences, CompletionToken &&token)
Delete node.
StatusCode deleteNode(T &connection, const NodeId &id, bool deleteReferences) noexcept
Delete node.
auto deleteReferenceAsync(Client &connection, const NodeId &sourceId, const NodeId &targetId, const NodeId &referenceType, bool isForward, bool deleteBidirectional, CompletionToken &&token)
Delete reference.
StatusCode deleteReference(T &connection, const NodeId &sourceId, const NodeId &targetId, const NodeId &referenceType, bool isForward, bool deleteBidirectional) noexcept
Delete reference.
auto readDataValueAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::Value attribute of a node as a DataValue object.
Result< bool > readContainsNoLoops(T &connection, const NodeId &id) noexcept
Read the AttributeId::ContainsNoLoops attribute of a node.
Result< double > readMinimumSamplingInterval(T &connection, const NodeId &id) noexcept
Read the AttributeId::MinimumSamplingInterval attribute of a node.
Result< NodeId > readDataType(T &connection, const NodeId &id) noexcept
Read the AttributeId::DataType attribute of a node.
Result< bool > readUserExecutable(T &connection, const NodeId &id) noexcept
Read the AttributeId::UserExecutable attribute of a node.
Result< LocalizedText > readInverseName(T &connection, const NodeId &id) noexcept
Read the AttributeId::InverseName attribute of a node.
Result< NodeClass > readNodeClass(T &connection, const NodeId &id) noexcept
Read the AttributeId::NodeClass attribute of a node.
auto readArrayDimensionsAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::ArrayDimensions attribute of a node.
Result< Bitmask< EventNotifier > > readEventNotifier(T &connection, const NodeId &id) noexcept
Read the AttributeId::EventNotifier attribute of a node.
auto readDataTypeDefinitionAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::DataTypeDefinition attribute of a node.
Result< DataValue > readDataValue(T &connection, const NodeId &id) noexcept
Read the AttributeId::Value attribute of a node as a DataValue object.
Result< Bitmask< WriteMask > > readUserWriteMask(T &connection, const NodeId &id) noexcept
Read the AttributeId::UserWriteMask attribute of a node.
Result< bool > readHistorizing(T &connection, const NodeId &id) noexcept
Read the AttributeId::Historizing attribute of a node.
auto readDescriptionAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::Description attribute of a node.
auto readNodeClassAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::NodeClass attribute of a node.
Result< LocalizedText > readDisplayName(T &connection, const NodeId &id) noexcept
Read the AttributeId::DisplayName attribute of a node.
auto readAccessLevelAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::AccessLevel attribute of a node.
auto readUserExecutableAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::UserExecutable attribute of a node.
Result< QualifiedName > readBrowseName(T &connection, const NodeId &id) noexcept
Read the AttributeId::BrowseName attribute of a node.
auto readEventNotifierAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::EventNotifier attribute of a node.
auto readDisplayNameAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::DisplayName attribute of a node.
Result< bool > readExecutable(T &connection, const NodeId &id) noexcept
Read the AttributeId::Executable attribute of a node.
auto readIsAbstractAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::IsAbstract attribute of a node.
auto readDataTypeAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::DataType attribute of a node.
auto readWriteMaskAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::WriteMask attribute of a node.
auto readUserWriteMaskAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::UserWriteMask attribute of a node.
Result< Variant > readDataTypeDefinition(T &connection, const NodeId &id) noexcept
Read the AttributeId::DataTypeDefinition attribute of a node.
Result< Bitmask< WriteMask > > readWriteMask(T &connection, const NodeId &id) noexcept
Read the AttributeId::WriteMask attribute of a node.
auto readExecutableAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::Executable attribute of a node.
Result< LocalizedText > readDescription(T &connection, const NodeId &id) noexcept
Read the AttributeId::Description attribute of a node.
Result< Variant > readValue(T &connection, const NodeId &id) noexcept
Read the AttributeId::Value attribute of a node.
auto readContainsNoLoopsAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::ContainsNoLoops attribute of a node.
auto readSymmetricAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::Symmetric attribute of a node.
auto readMinimumSamplingIntervalAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::MinimumSamplingInterval attribute of a node.
auto readUserAccessLevelAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::UserAccessLevel attribute of a node.
auto readHistorizingAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::Historizing attribute of a node.
Result< ValueRank > readValueRank(T &connection, const NodeId &id) noexcept
Read the AttributeId::ValueRank attribute of a node.
auto readBrowseNameAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::BrowseName attribute of a node.
Result< bool > readIsAbstract(T &connection, const NodeId &id) noexcept
Read the AttributeId::IsAbstract attribute of a node.
auto readValueAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::Value attribute of a node.
Result< bool > readSymmetric(T &connection, const NodeId &id) noexcept
Read the AttributeId::Symmetric attribute of a node.
Result< Bitmask< AccessLevel > > readUserAccessLevel(T &connection, const NodeId &id) noexcept
Read the AttributeId::UserAccessLevel attribute of a node.
Result< Bitmask< AccessLevel > > readAccessLevel(T &connection, const NodeId &id) noexcept
Read the AttributeId::AccessLevel attribute of a node.
Result< std::vector< uint32_t > > readArrayDimensions(T &connection, const NodeId &id) noexcept
Read the AttributeId::ArrayDimensions attribute of a node.
auto readInverseNameAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::InverseName attribute of a node.
auto readValueRankAsync(Client &connection, const NodeId &id, CompletionToken &&token)
Read the AttributeId::ValueRank attribute of a node.
BrowsePathResult translateBrowsePathToNodeIds(T &connection, const BrowsePath &browsePath) noexcept
Translate a browse path to NodeIds.
BrowsePathResult browseSimplifiedBrowsePath(T &connection, const NodeId &origin, Span< const QualifiedName > browsePath)
A simplified version of translateBrowsePathToNodeIds.
Definition view.hpp:236
StatusCode writeDataType(T &connection, const NodeId &id, const NodeId &dataType) noexcept
Write the AttributeId::DataType attribute of a node.
StatusCode writeHistorizing(T &connection, const NodeId &id, bool historizing) noexcept
Write the AttributeId::Historizing attribute of a node.
StatusCode writeUserWriteMask(T &connection, const NodeId &id, Bitmask< WriteMask > userWriteMask) noexcept
Write the AttributeId::UserWriteMask attribute of a node.
auto writeAccessLevelAsync(Client &connection, const NodeId &id, Bitmask< AccessLevel > accessLevel, CompletionToken &&token)
Write the AttributeId::AccessLevel attribute of a node.
StatusCode writeContainsNoLoops(T &connection, const NodeId &id, const bool &containsNoLoops) noexcept
Write the AttributeId::ContainsNoLoops attribute of a node.
StatusCode writeArrayDimensions(T &connection, const NodeId &id, Span< const uint32_t > arrayDimensions) noexcept
Write the AttributeId::ArrayDimensions attribute of a node.
auto writeHistorizingAsync(Client &connection, const NodeId &id, bool historizing, CompletionToken &&token)
Write the AttributeId::Historizing attribute of a node.
auto writeEventNotifierAsync(Client &connection, const NodeId &id, Bitmask< EventNotifier > eventNotifier, CompletionToken &&token)
Write the AttributeId::EventNotifier attribute of a node.
StatusCode writeEventNotifier(T &connection, const NodeId &id, Bitmask< EventNotifier > eventNotifier) noexcept
Write the AttributeId::EventNotifier attribute of a node.
StatusCode writeExecutable(T &connection, const NodeId &id, bool executable) noexcept
Write the AttributeId::Executable attribute of a node.
auto writeDataValueAsync(Client &connection, const NodeId &id, const DataValue &value, CompletionToken &&token)
Write the AttributeId::Value attribute of a node as a DataValue object.
StatusCode writeIsAbstract(T &connection, const NodeId &id, bool isAbstract) noexcept
Write the AttributeId::IsAbstract attribute of a node.
auto writeArrayDimensionsAsync(Client &connection, const NodeId &id, Span< const uint32_t > arrayDimensions, CompletionToken &&token)
Write the AttributeId::ArrayDimensions attribute of a node.
StatusCode writeValue(T &connection, const NodeId &id, const Variant &value) noexcept
Write the AttributeId::Value attribute of a node.
StatusCode writeDataValue(T &connection, const NodeId &id, const DataValue &value) noexcept
Write the AttributeId::Value attribute of a node as a DataValue object.
auto writeContainsNoLoopsAsync(Client &connection, const NodeId &id, const bool &containsNoLoops, CompletionToken &&token)
Write the AttributeId::ContainsNoLoops attribute of a node.
StatusCode writeValueRank(T &connection, const NodeId &id, ValueRank valueRank) noexcept
Write the AttributeId::ValueRank attribute of a node.
auto writeUserWriteMaskAsync(Client &connection, const NodeId &id, Bitmask< WriteMask > userWriteMask, CompletionToken &&token)
Write the AttributeId::UserWriteMask attribute of a node.
auto writeValueRankAsync(Client &connection, const NodeId &id, ValueRank valueRank, CompletionToken &&token)
Write the AttributeId::ValueRank attribute of a node.
StatusCode writeInverseName(T &connection, const NodeId &id, const LocalizedText &inverseName) noexcept
Write the AttributeId::InverseName attribute of a node.
auto writeDataTypeAsync(Client &connection, const NodeId &id, const NodeId &dataType, CompletionToken &&token)
Write the AttributeId::DataType attribute of a node.
auto writeDisplayNameAsync(Client &connection, const NodeId &id, const LocalizedText &displayName, CompletionToken &&token)
Write the AttributeId::DisplayName attribute of a node.
auto writeInverseNameAsync(Client &connection, const NodeId &id, const LocalizedText &inverseName, CompletionToken &&token)
Write the AttributeId::InverseName attribute of a node.
StatusCode writeDescription(T &connection, const NodeId &id, const LocalizedText &description) noexcept
Write the AttributeId::Description attribute of a node.
StatusCode writeDisplayName(T &connection, const NodeId &id, const LocalizedText &displayName) noexcept
Write the AttributeId::DisplayName attribute of a node.
StatusCode writeUserAccessLevel(T &connection, const NodeId &id, Bitmask< AccessLevel > userAccessLevel) noexcept
Write the AttributeId::UserAccessLevel attribute of a node.
StatusCode writeMinimumSamplingInterval(T &connection, const NodeId &id, double minimumSamplingInterval) noexcept
Write the AttributeId::MinimumSamplingInterval attribute of a node.
auto writeSymmetricAsync(Client &connection, const NodeId &id, bool symmetric, CompletionToken &&token)
Write the AttributeId::Symmetric attribute of a node.
StatusCode writeWriteMask(T &connection, const NodeId &id, Bitmask< WriteMask > writeMask) noexcept
Write the AttributeId::WriteMask attribute of a node.
auto writeMinimumSamplingIntervalAsync(Client &connection, const NodeId &id, double minimumSamplingInterval, CompletionToken &&token)
Write the AttributeId::MinimumSamplingInterval attribute of a node.
StatusCode writeSymmetric(T &connection, const NodeId &id, bool symmetric) noexcept
Write the AttributeId::Symmetric attribute of a node.
StatusCode writeAccessLevel(T &connection, const NodeId &id, Bitmask< AccessLevel > accessLevel) noexcept
Write the AttributeId::AccessLevel attribute of a node.
StatusCode writeUserExecutable(T &connection, const NodeId &id, bool userExecutable) noexcept
Write the AttributeId::UserExecutable attribute of a node.
auto writeValueAsync(Client &connection, const NodeId &id, const Variant &value, CompletionToken &&token)
Write the AttributeId::Value attribute of a node.
auto writeWriteMaskAsync(Client &connection, const NodeId &id, Bitmask< WriteMask > writeMask, CompletionToken &&token)
Write the AttributeId::WriteMask attribute of a node.
auto writeIsAbstractAsync(Client &connection, const NodeId &id, bool isAbstract, CompletionToken &&token)
Write the AttributeId::IsAbstract attribute of a node.
auto writeDescriptionAsync(Client &connection, const NodeId &id, const LocalizedText &description, CompletionToken &&token)
Write the AttributeId::Description attribute of a node.
auto writeUserExecutableAsync(Client &connection, const NodeId &id, bool userExecutable, CompletionToken &&token)
Write the AttributeId::UserExecutable attribute of a node.
auto writeExecutableAsync(Client &connection, const NodeId &id, bool executable, CompletionToken &&token)
Write the AttributeId::Executable attribute of a node.
auto writeUserAccessLevelAsync(Client &connection, const NodeId &id, Bitmask< AccessLevel > userAccessLevel, CompletionToken &&token)
Write the AttributeId::UserAccessLevel attribute of a node.
TransformToken(TransformFunction &&, CompletionToken &&) -> TransformToken< TransformFunction, CompletionToken >
NodeClass
Node class.
Definition common.hpp:138
ValueRank
Value rank.
Definition common.hpp:224
BrowseDirection
Browse direction.
Definition common.hpp:273
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
bool operator!=(const Client &lhs, const Client &rhs) noexcept
Definition client.hpp:295
@ NodeId
Unambiguous identifier of a node.
const UA_DataType & getDataType() noexcept
ModellingRule
Modelling rules.
Definition common.hpp:257
bool operator==(const Client &lhs, const Client &rhs) noexcept
Definition client.hpp:291
#define UA_STATUSCODE_BADNOTFOUND
#define UA_STATUSCODE_BADNOMATCH
If a reference is symmetric
Definition symmetric.dox:1