open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
nodemanagement.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <functional>
5#include <string_view>
6#include <utility> // exchange, forward
7
9#include "open62541pp/common.hpp" // ModellingRule
10#include "open62541pp/config.hpp"
12#include "open62541pp/nodeids.hpp" // *TypeId
18#include "open62541pp/span.hpp"
19#include "open62541pp/types.hpp"
21
22namespace opcua {
23class Client;
24}
25
26namespace opcua::services {
27
28/**
29 * @defgroup NodeManagement NodeManagement service set
30 * Add/delete nodes and references.
31 *
32 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7
33 * @ingroup Services
34 * @{
35 */
36
37/**
38 * @defgroup AddNodes AddNodes service
39 * Add nodes into the address space hierarchy.
40 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.2
41 * @{
42 */
43
44/**
45 * Add one or more nodes (client only).
46 * @param connection Instance of type Client
47 * @param request Add nodes request
48 */
49AddNodesResponse addNodes(Client& connection, const AddNodesRequest& request) noexcept;
50
51/**
52 * @copydoc addNodes
53 * @param token @completiontoken{void(AddNodesResponse&)}
54 * @return @asyncresult{AddNodesResponse}
55 */
56template <typename CompletionToken>
57auto addNodesAsync(Client& connection, const AddNodesRequest& request, CompletionToken&& token) {
59 connection, request, std::forward<CompletionToken>(token)
60 );
61}
62
63/**
64 * Add a node.
65 * @param connection Instance of type Client (or Server)
66 * @param nodeClass Node class
67 * @param parentId Parent node
68 * @param id Requested NodeId of the node to add
69 * @param browseName Browse name
70 * @param nodeAttributes Node attributes
71 * @param typeDefinition NodeId of the type
72 * @param referenceType Hierarchical reference type from the parent node to the new node
73 */
74template <typename T>
76 T& connection,
77 NodeClass nodeClass,
78 const NodeId& parentId,
79 const NodeId& id,
80 std::string_view browseName,
81 const ExtensionObject& nodeAttributes,
82 const NodeId& typeDefinition,
83 const NodeId& referenceType
84) noexcept;
85
86/**
87 * @copydoc addNode
88 * @param token @completiontoken{void(Result<NodeId>&)}
89 * @return @asyncresult{Result<NodeId>}
90 */
91template <typename CompletionToken>
93 Client& connection,
94 NodeClass nodeClass,
95 const NodeId& parentId,
96 const NodeId& id,
97 std::string_view browseName,
98 const ExtensionObject& nodeAttributes,
99 const NodeId& typeDefinition,
100 const NodeId& referenceType,
101 CompletionToken&& token
102) {
103 auto item = detail::createAddNodesItem(
104 parentId, referenceType, id, browseName, nodeClass, nodeAttributes, typeDefinition
105 );
106 const auto request = detail::createAddNodesRequest(item);
107 return addNodesAsync(
108 connection,
111 [](UA_AddNodesResponse& response) {
112 return detail::getSingleResultRef(response).andThen(detail::getAddedNodeId);
113 },
114 std::forward<CompletionToken>(token)
115 )
116 );
117}
118
119/**
120 * @}
121 * @defgroup AddReferences AddReferences service
122 * Add references to nodes.
123 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.3
124 * @{
125 */
126
127/**
128 * Add one or more references (client only).
129 * @param connection Instance of type Client
130 * @param request Add references request
131 */
133 Client& connection, const AddReferencesRequest& request
134) noexcept;
135
136/**
137 * @copydoc addReferences
138 * @param token @completiontoken{void(AddReferencesResponse&)}
139 * @return @asyncresult{AddReferencesReponse}
140 */
141template <typename CompletionToken>
143 Client& connection, const AddReferencesRequest& request, CompletionToken&& token
144) {
146 connection, request, std::forward<CompletionToken>(token)
147 );
148}
149
150/**
151 * Add reference.
152 * @param connection Instance of type Client (or Server)
153 * @param sourceId Node to which the reference is to be added
154 * @param targetId Target node
155 * @param referenceType NodeId of the reference type that defines the reference
156 * @param forward Create a forward reference if `true` or a inverse reference if `false`
157 */
158template <typename T>
160 T& connection,
161 const NodeId& sourceId,
162 const NodeId& targetId,
163 const NodeId& referenceType,
164 bool forward
165) noexcept;
166
167/**
168 * @copydoc addReference
169 * @param token @completiontoken{void(StatusCode)}
170 * @return @asyncresult{StatusCode}
171 */
172template <typename CompletionToken>
174 Client& connection,
175 const NodeId& sourceId,
176 const NodeId& targetId,
177 const NodeId& referenceType,
178 bool forward,
179 CompletionToken&& token
180) {
181 auto item = detail::createAddReferencesItem(sourceId, referenceType, forward, targetId);
182 const auto request = detail::createAddReferencesRequest(item);
183 return addReferencesAsync(
184 connection,
187 detail::getSingleStatus<AddReferencesResponse>, std::forward<CompletionToken>(token)
188 )
189 );
190}
191
192/**
193 * @}
194 * @defgroup DeleteNodes DeleteNodes service
195 * Delete nodes from the address space.
196 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.4
197 * @{
198 */
199
200/**
201 * Delete one or more nodes (client only).
202 * @param connection Instance of type Client
203 * @param request Delete nodes request
204 */
205DeleteNodesResponse deleteNodes(Client& connection, const DeleteNodesRequest& request) noexcept;
206
207/**
208 * @copydoc deleteNodes
209 * @param token @completiontoken{void(DeleteNodesResponse&)}
210 * @return @asyncresult{DeleteNodesResponse}
211 */
212template <typename CompletionToken>
214 Client& connection, const DeleteNodesRequest& request, CompletionToken&& token
215) {
217 connection, request, std::forward<CompletionToken>(token)
218 );
219}
220
221/**
222 * Delete node.
223 * @param connection Instance of type Client (or Server)
224 * @param id Node to delete
225 * @param deleteReferences Delete references in target nodes that reference the node to delete
226 */
227template <typename T>
228StatusCode deleteNode(T& connection, const NodeId& id, bool deleteReferences) noexcept;
229
230/**
231 * @copydoc deleteNode
232 * @param token @completiontoken{void(StatusCode)}
233 * @return @asyncresult{StatusCode}
234 */
235template <typename CompletionToken>
237 Client& connection, const NodeId& id, bool deleteReferences, CompletionToken&& token
238) {
240 const auto request = detail::createDeleteNodesRequest(item);
241 return deleteNodesAsync(
242 connection,
245 detail::getSingleStatus<DeleteNodesResponse>, std::forward<CompletionToken>(token)
246 )
247 );
248}
249
250/**
251 * @}
252 * @defgroup DeleteReferences DeleteReferences service
253 * Delete references from nodes.
254 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.5
255 * @{
256 */
257
258/**
259 * Delete one or more references (client only).
260 * @param connection Instance of type Client
261 * @param request Delete references request
262 */
264 Client& connection, const DeleteReferencesRequest& request
265) noexcept;
266
267/**
268 * @copydoc deleteReferences
269 * @param token @completiontoken{void(DeleteReferencesResponse&)}
270 * @return @asyncresult{DeleteReferencesResponse}
271 */
272template <typename CompletionToken>
274 Client& connection, const DeleteReferencesRequest& request, CompletionToken&& token
275) {
277 connection, request, std::forward<CompletionToken>(token)
278 );
279}
280
281/**
282 * Delete reference.
283 * @param connection Instance of type Client (or Server)
284 * @param sourceId Node that contains the reference to delete
285 * @param targetId Target node of the reference to delete
286 * @param referenceType NodeId of the reference type that defines the reference to delete
287 * @param isForward Delete the forward reference if `true`, delete the inverse reference if `false`
288 * @param deleteBidirectional Delete the specified and opposite reference from the target node
289 */
290template <typename T>
292 T& connection,
293 const NodeId& sourceId,
294 const NodeId& targetId,
295 const NodeId& referenceType,
296 bool isForward,
297 bool deleteBidirectional
298) noexcept;
299
300/**
301 * @copydoc deleteReference
302 * @param token @completiontoken{void(StatusCode)}
303 * @return @asyncresult{StatusCode}
304 */
305template <typename CompletionToken>
307 Client& connection,
308 const NodeId& sourceId,
309 const NodeId& targetId,
310 const NodeId& referenceType,
311 bool isForward,
312 bool deleteBidirectional,
313 CompletionToken&& token
314) {
316 sourceId, referenceType, isForward, targetId, deleteBidirectional
317 );
318 const auto request = detail::createDeleteReferencesRequest(item);
320 connection,
323 detail::getSingleStatus<DeleteReferencesResponse>, std::forward<CompletionToken>(token)
324 )
325 );
326}
327
328/**
329 * @}
330 */
331
332/* ------------------------------- Specialized (inline) functions ------------------------------- */
333
334/**
335 * @addtogroup AddNodes
336 * @{
337 */
338
339/**
340 * Add object.
341 * @param connection Instance of type Client (or Server)
342 * @param parentId Parent node
343 * @param id Requested NodeId of the object node to add
344 * @param browseName Browse name
345 * @param attributes Object attributes
346 * @param objectType NodeId of the object type, e.g. ObjectTypeId::BaseObjectType
347 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
348 * ReferenceTypeId::HasComponent
349 */
350template <typename T>
352 T& connection,
353 const NodeId& parentId,
354 const NodeId& id,
355 std::string_view browseName,
356 const ObjectAttributes& attributes,
357 const NodeId& objectType,
358 const NodeId& referenceType
359) noexcept {
360 return addNode(
361 connection,
363 parentId,
364 id,
365 browseName,
366 detail::wrapNodeAttributes(attributes),
367 objectType,
368 referenceType
369 );
370}
371
372/**
373 * @copydoc addObject
374 * @param token @completiontoken{void(Result<NodeId>&)}
375 * @return @asyncresult{Result<NodeId>}
376 */
377template <typename CompletionToken>
379 Client& connection,
380 const NodeId& parentId,
381 const NodeId& id,
382 std::string_view browseName,
383 const ObjectAttributes& attributes,
384 const NodeId& objectType,
385 const NodeId& referenceType,
386 CompletionToken&& token
387) {
388 return addNodeAsync(
389 connection,
391 parentId,
392 id,
393 browseName,
394 detail::wrapNodeAttributes(attributes),
395 objectType,
396 referenceType,
397 std::forward<CompletionToken>(token)
398 );
399}
400
401/**
402 * Add folder.
403 * @param connection Instance of type Client (or Server)
404 * @param parentId Parent node
405 * @param id Requested NodeId of the node to add
406 * @param browseName Browse name
407 * @param attributes Object attributes
408 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
409 * ReferenceTypeId::HasComponent
410 */
411template <typename T>
413 T& connection,
414 const NodeId& parentId,
415 const NodeId& id,
416 std::string_view browseName,
417 const ObjectAttributes& attributes,
418 const NodeId& referenceType
419) noexcept {
420 return addObject(
421 connection, parentId, id, browseName, attributes, ObjectTypeId::FolderType, referenceType
422 );
423}
424
425/**
426 * @copydoc addFolder
427 * @param token @completiontoken{void(Result<NodeId>&)}
428 * @return @asyncresult{Result<NodeId>}
429 */
430template <typename CompletionToken>
432 Client& connection,
433 const NodeId& parentId,
434 const NodeId& id,
435 std::string_view browseName,
436 const ObjectAttributes& attributes,
437 const NodeId& referenceType,
438 CompletionToken&& token
439) {
440 return addObjectAsync(
441 connection,
442 parentId,
443 id,
444 browseName,
445 attributes,
447 referenceType,
448 std::forward<CompletionToken>(token)
449 );
450}
451
452/**
453 * Add variable.
454 * @param connection Instance of type Client (or Server)
455 * @param parentId Parent node
456 * @param id Requested NodeId of the node to add
457 * @param browseName Browse name
458 * @param attributes Variable attributes
459 * @param variableType NodeId of the variable type, e.g. VariableTypeId::BaseDataVariableType
460 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
461 * ReferenceTypeId::HasComponent
462 */
463template <typename T>
465 T& connection,
466 const NodeId& parentId,
467 const NodeId& id,
468 std::string_view browseName,
469 const VariableAttributes& attributes,
470 const NodeId& variableType,
471 const NodeId& referenceType
472) noexcept {
473 return addNode(
474 connection,
476 parentId,
477 id,
478 browseName,
479 detail::wrapNodeAttributes(attributes),
480 variableType,
481 referenceType
482 );
483}
484
485/**
486 * @copydoc addVariable
487 * @param token @completiontoken{void(Result<NodeId>&)}
488 * @return @asyncresult{Result<NodeId>}
489 */
490template <typename CompletionToken>
492 Client& connection,
493 const NodeId& parentId,
494 const NodeId& id,
495 std::string_view browseName,
496 const VariableAttributes& attributes,
497 const NodeId& variableType,
498 const NodeId& referenceType,
499 CompletionToken&& token
500) {
501 return addNodeAsync(
502 connection,
504 parentId,
505 id,
506 browseName,
507 detail::wrapNodeAttributes(attributes),
508 variableType,
509 referenceType,
510 std::forward<CompletionToken>(token)
511 );
512}
513
514/**
515 * Add property.
516 * @param connection Instance of type Client (or Server)
517 * @param parentId Parent node
518 * @param id Requested NodeId of the node to add
519 * @param browseName Browse name
520 * @param attributes Property attributes
521 */
522template <typename T>
524 T& connection,
525 const NodeId& parentId,
526 const NodeId& id,
527 std::string_view browseName,
528 const VariableAttributes& attributes
529) noexcept {
530 return addVariable(
531 connection,
532 parentId,
533 id,
534 browseName,
535 attributes,
538 );
539}
540
541/**
542 * @copydoc addProperty
543 * @param token @completiontoken{void(Result<NodeId>&)}
544 * @return @asyncresult{Result<NodeId>}
545 */
546template <typename CompletionToken>
548 Client& connection,
549 const NodeId& parentId,
550 const NodeId& id,
551 std::string_view browseName,
552 const VariableAttributes& attributes,
553 CompletionToken&& token
554) {
555 return addVariableAsync(
556 connection,
557 parentId,
558 id,
559 browseName,
560 attributes,
563 std::forward<CompletionToken>(token)
564 );
565}
566
567#ifdef UA_ENABLE_METHODCALLS
568/**
569 * Method callback.
570 * @param input Input parameters
571 * @param output Output parameters
572 */
573using MethodCallback = std::function<void(Span<const Variant> input, Span<Variant> output)>;
574
575/**
576 * Add method.
577 * Callbacks can not be set by clients. Servers can assign callbacks to method nodes afterwards.
578 * @param connection Instance of type Client (or Server)
579 * @param parentId Parent node
580 * @param id Requested NodeId of the node to add
581 * @param browseName Browse name
582 * @param callback Method callback
583 * @param inputArguments Input arguments
584 * @param outputArguments Output arguments
585 * @param attributes Method attributes
586 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
587 * ReferenceTypeId::HasComponent
588 */
589template <typename T>
591 T& connection,
592 const NodeId& parentId,
593 const NodeId& id,
594 std::string_view browseName,
595 MethodCallback callback,
596 Span<const Argument> inputArguments,
597 Span<const Argument> outputArguments,
598 const MethodAttributes& attributes,
599 const NodeId& referenceType
600) noexcept;
601
602/**
603 * @copydoc addMethod
604 * @param token @completiontoken{void(Result<NodeId>&)}
605 * @return @asyncresult{Result<NodeId>}
606 */
607template <typename CompletionToken>
609 Client& connection,
610 const NodeId& parentId,
611 const NodeId& id,
612 std::string_view browseName,
613 [[maybe_unused]] MethodCallback callback, // NOLINT
614 [[maybe_unused]] Span<const Argument> inputArguments,
615 [[maybe_unused]] Span<const Argument> outputArguments,
616 const MethodAttributes& attributes,
617 const NodeId& referenceType,
618 CompletionToken&& token
619) {
620 return addNodeAsync(
621 connection,
623 parentId,
624 id,
625 browseName,
626 detail::wrapNodeAttributes(attributes),
627 {},
628 referenceType,
629 std::forward<CompletionToken>(token)
630 );
631}
632#endif
633
634/**
635 * Add object type.
636 * @param connection Instance of type Client (or Server)
637 * @param parentId Parent node
638 * @param id Requested NodeId of the node to add
639 * @param browseName Browse name
640 * @param attributes Object type attributes
641 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
642 * ReferenceTypeId::HasSubtype
643 */
644template <typename T>
646 T& connection,
647 const NodeId& parentId,
648 const NodeId& id,
649 std::string_view browseName,
650 const ObjectTypeAttributes& attributes,
651 const NodeId& referenceType
652) noexcept {
653 return addNode(
654 connection,
656 parentId,
657 id,
658 browseName,
659 detail::wrapNodeAttributes(attributes),
660 {},
661 referenceType
662 );
663}
664
665/**
666 * @copydoc addObjectType
667 * @param token @completiontoken{void(Result<NodeId>&)}
668 * @return @asyncresult{Result<NodeId>}
669 */
670template <typename CompletionToken>
672 Client& connection,
673 const NodeId& parentId,
674 const NodeId& id,
675 std::string_view browseName,
676 const ObjectTypeAttributes& attributes,
677 const NodeId& referenceType,
678 CompletionToken&& token
679) {
680 return addNodeAsync(
681 connection,
683 parentId,
684 id,
685 browseName,
686 detail::wrapNodeAttributes(attributes),
687 {},
688 referenceType,
689 std::forward<CompletionToken>(token)
690 );
691}
692
693/**
694 * Add variable type.
695 * @param connection Instance of type Client (or Server)
696 * @param parentId Parent node
697 * @param id Requested NodeId of the node to add
698 * @param browseName Browse name
699 * @param attributes Variable type attributes
700 * @param variableType NodeId of the variable type, e.g. VariableTypeId::BaseDataVariableType
701 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
702 * ReferenceTypeId::HasSubtype
703 */
704template <typename T>
706 T& connection,
707 const NodeId& parentId,
708 const NodeId& id,
709 std::string_view browseName,
710 const VariableTypeAttributes& attributes,
711 const NodeId& variableType,
712 const NodeId& referenceType
713) noexcept {
714 return addNode(
715 connection,
717 parentId,
718 id,
719 browseName,
720 detail::wrapNodeAttributes(attributes),
721 variableType,
722 referenceType
723 );
724}
725
726/**
727 * @copydoc addVariableType
728 * @param token @completiontoken{void(Result<NodeId>&)}
729 * @return @asyncresult{Result<NodeId>}
730 */
731template <typename CompletionToken>
733 Client& connection,
734 const NodeId& parentId,
735 const NodeId& id,
736 std::string_view browseName,
737 const VariableTypeAttributes& attributes,
738 const NodeId& variableType,
739 const NodeId& referenceType,
740 CompletionToken&& token
741) {
742 return addNodeAsync(
743 connection,
745 parentId,
746 id,
747 browseName,
748 detail::wrapNodeAttributes(attributes),
749 variableType,
750 referenceType,
751 std::forward<CompletionToken>(token)
752 );
753}
754
755/**
756 * Add reference type.
757 * @param connection Instance of type Client (or Server)
758 * @param parentId Parent node
759 * @param id Requested NodeId of the node to add
760 * @param browseName Browse name
761 * @param attributes Reference type attributes
762 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
763 * ReferenceTypeId::HasSubtype
764 */
765template <typename T>
767 T& connection,
768 const NodeId& parentId,
769 const NodeId& id,
770 std::string_view browseName,
771 const ReferenceTypeAttributes& attributes,
772 const NodeId& referenceType
773) noexcept {
774 return addNode(
775 connection,
777 parentId,
778 id,
779 browseName,
780 detail::wrapNodeAttributes(attributes),
781 {},
782 referenceType
783 );
784}
785
786/**
787 * @copydoc addReferenceType
788 * @param token @completiontoken{void(Result<NodeId>&)}
789 * @return @asyncresult{Result<NodeId>}
790 */
791template <typename CompletionToken>
793 Client& connection,
794 const NodeId& parentId,
795 const NodeId& id,
796 std::string_view browseName,
797 const ReferenceTypeAttributes& attributes,
798 const NodeId& referenceType,
799 CompletionToken&& token
800) {
801 return addNodeAsync(
802 connection,
804 parentId,
805 id,
806 browseName,
807 detail::wrapNodeAttributes(attributes),
808 {},
809 referenceType,
810 std::forward<CompletionToken>(token)
811 );
812}
813
814/**
815 * Add data type.
816 * @param connection Instance of type Client (or Server)
817 * @param parentId Parent node
818 * @param id Requested NodeId of the node to add
819 * @param browseName Browse name
820 * @param attributes Data type attributes
821 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
822 * ReferenceTypeId::HasSubtype
823 */
824template <typename T>
826 T& connection,
827 const NodeId& parentId,
828 const NodeId& id,
829 std::string_view browseName,
830 const DataTypeAttributes& attributes,
831 const NodeId& referenceType
832) noexcept {
833 return addNode(
834 connection,
836 parentId,
837 id,
838 browseName,
839 detail::wrapNodeAttributes(attributes),
840 {},
841 referenceType
842 );
843}
844
845/**
846 * @copydoc addDataType
847 * @param token @completiontoken{void(Result<NodeId>&)}
848 * @return @asyncresult{Result<NodeId>}
849 */
850template <typename CompletionToken>
852 Client& connection,
853 const NodeId& parentId,
854 const NodeId& id,
855 std::string_view browseName,
856 const DataTypeAttributes& attributes,
857 const NodeId& referenceType,
858 CompletionToken&& token
859) {
860 return addNodeAsync(
861 connection,
863 parentId,
864 id,
865 browseName,
866 detail::wrapNodeAttributes(attributes),
867 {},
868 referenceType,
869 std::forward<CompletionToken>(token)
870 );
871}
872
873/**
874 * Add view.
875 * @param connection Instance of type Client (or Server)
876 * @param parentId Parent node
877 * @param id Requested NodeId of the node to add
878 * @param browseName Browse name
879 * @param attributes View attributes
880 * @param referenceType Hierarchical reference type from the parent node to the new node, e.g.
881 * ReferenceTypeId::Organizes
882 */
883template <typename T>
885 T& connection,
886 const NodeId& parentId,
887 const NodeId& id,
888 std::string_view browseName,
889 const ViewAttributes& attributes,
890 const NodeId& referenceType
891) noexcept {
892 return addNode(
893 connection,
895 parentId,
896 id,
897 browseName,
898 detail::wrapNodeAttributes(attributes),
899 {},
900 referenceType
901 );
902}
903
904/**
905 * @copydoc addView
906 * @param token @completiontoken{void(Result<NodeId>&)}
907 * @return @asyncresult{Result<NodeId>}
908 */
909template <typename CompletionToken>
911 Client& connection,
912 const NodeId& parentId,
913 const NodeId& id,
914 std::string_view browseName,
915 const ViewAttributes& attributes,
916 const NodeId& referenceType,
917 CompletionToken&& token
918) {
919 return addNodeAsync(
920 connection,
922 parentId,
923 id,
924 browseName,
925 detail::wrapNodeAttributes(attributes),
926 {},
927 referenceType,
928 std::forward<CompletionToken>(token)
929 );
930}
931
932/**
933 * @}
934 * @addtogroup AddReferences
935 * @{
936 */
937
938/**
939 * Add modelling rule.
940 * @param connection Instance of type Client (or Server)
941 * @param id Node
942 * @param rule Modelling rule to add
943 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/6.4.4
944 */
945template <typename T>
946StatusCode addModellingRule(T& connection, const NodeId& id, ModellingRule rule) noexcept {
947 return addReference(
948 connection, id, {0, static_cast<uint32_t>(rule)}, ReferenceTypeId::HasModellingRule, true
949 );
950}
951
952/**
953 * @copydoc addModellingRule
954 * @param token @completiontoken{void(StatusCode)}
955 * @return @asyncresult{StatusCode}
956 */
957template <typename CompletionToken>
959 Client& connection, const NodeId& id, ModellingRule rule, CompletionToken&& token
960) {
961 return addReferenceAsync(
962 connection,
963 id,
964 {0, static_cast<uint32_t>(rule)},
966 true,
967 std::forward<CompletionToken>(token)
968 );
969}
970
971/**
972 * @}
973 * @}
974 */
975
976} // namespace opcua::services
UA_AddNodesRequest wrapper class.
UA_AddNodesResponse wrapper class.
UA_AddReferencesRequest wrapper class.
UA_AddReferencesResponse wrapper class.
High-level client class.
Definition client.hpp:121
UA_DataTypeAttributes wrapper class.
UA_DeleteNodesRequest wrapper class.
UA_DeleteNodesResponse wrapper class.
UA_DeleteReferencesRequest wrapper class.
UA_DeleteReferencesResponse wrapper class.
UA_ExtensionObject wrapper class.
Definition types.hpp:1664
UA_MethodAttributes wrapper class.
UA_NodeId wrapper class.
Definition types.hpp:590
UA_ObjectAttributes wrapper class.
UA_ObjectTypeAttributes wrapper class.
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
UA_StatusCode wrapper class.
Definition types.hpp:44
UA_VariableAttributes wrapper class.
UA_VariableAttributes wrapper class.
UA_ViewAttributes wrapper class.
Result< NodeId > addNode(T &connection, NodeClass nodeClass, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ExtensionObject &nodeAttributes, const NodeId &typeDefinition, const NodeId &referenceType) noexcept
Add a node.
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 addNodesAsync(Client &connection, const AddNodesRequest &request, CompletionToken &&token)
Add one or more nodes (client only).
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 addNodeAsync(Client &connection, NodeClass nodeClass, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ExtensionObject &nodeAttributes, const NodeId &typeDefinition, const NodeId &referenceType, CompletionToken &&token)
Add a node.
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.
AddNodesResponse addNodes(Client &connection, const AddNodesRequest &request) noexcept
Add one or more nodes (client only).
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.
AddReferencesResponse addReferences(Client &connection, const AddReferencesRequest &request) noexcept
Add one or more references (client only).
auto addReferencesAsync(Client &connection, const AddReferencesRequest &request, CompletionToken &&token)
Add one or more references (client only).
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.
DeleteNodesResponse deleteNodes(Client &connection, const DeleteNodesRequest &request) noexcept
Delete one or more nodes (client only).
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 deleteNodesAsync(Client &connection, const DeleteNodesRequest &request, CompletionToken &&token)
Delete one or more nodes (client only).
auto deleteReferencesAsync(Client &connection, const DeleteReferencesRequest &request, CompletionToken &&token)
Delete one or more references (client only).
DeleteReferencesResponse deleteReferences(Client &connection, const DeleteReferencesRequest &request) noexcept
Delete one or more references (client only).
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.
UA_AddReferencesItem createAddReferencesItem(const NodeId &sourceId, const NodeId &referenceType, bool forward, const NodeId &targetId) noexcept
UA_DeleteReferencesItem createDeleteReferencesItem(const NodeId &sourceId, const NodeId &referenceType, bool isForward, const NodeId &targetId, bool deleteBidirectional) noexcept
Result< NodeId > getAddedNodeId(UA_AddNodesResult &result) noexcept
UA_AddReferencesRequest createAddReferencesRequest(UA_AddReferencesItem &item) noexcept
UA_AddNodesItem createAddNodesItem(const NodeId &parentId, const NodeId &referenceType, const NodeId &id, std::string_view browseName, NodeClass nodeClass, const ExtensionObject &nodeAttributes, const NodeId &typeDefinition) noexcept
StatusCode getSingleStatus(const Response &response) noexcept
UA_DeleteNodesItem createDeleteNodesItem(const NodeId &id, bool deleteReferences) noexcept
UA_AddNodesRequest createAddNodesRequest(UA_AddNodesItem &item) noexcept
auto sendRequestAsync(Client &client, const Request &request, CompletionToken &&token)
Async client service requests.
UA_DeleteNodesRequest createDeleteNodesRequest(UA_DeleteNodesItem &item) noexcept
UA_DeleteReferencesRequest createDeleteReferencesRequest(UA_DeleteReferencesItem &item) noexcept
ExtensionObject wrapNodeAttributes(const T &attributes) noexcept
auto getSingleResultRef(Response &response) noexcept
OPC UA services as free functions.
Definition attribute.hpp:22
NodeClass
Node class.
Definition common.hpp:138
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
ModellingRule
Modelling rules.
Definition common.hpp:257
Special token to transform async results within the completion handler.