41template <
typename Connection>
65 [[deprecated(
"Use connection() instead")]]
71 [[deprecated(
"Use connection() instead")]]
82 [[deprecated(
"Use id() instead")]]
95 std::string_view browseName,
100 connection_, id_,
id, browseName, attributes, referenceType
102 return {connection_, result.value()};
108 std::string_view browseName,
114 connection_, id_,
id, browseName, attributes, objectType, referenceType
116 return {connection_, result.value()};
122 std::string_view browseName,
128 connection_, id_,
id, browseName, attributes, variableType, referenceType
130 return {connection_, result.value()};
138 return {connection_, result.value()};
141#ifdef UA_ENABLE_METHODCALLS
145 std::string_view browseName,
163 return {connection_, result.value()};
170 std::string_view browseName,
175 connection_, id_,
id, browseName, attributes, referenceType
177 return {connection_, result.value()};
183 std::string_view browseName,
189 connection_, id_,
id, browseName, attributes, variableType, referenceType
191 return {connection_, result.value()};
197 std::string_view browseName,
202 connection_, id_,
id, browseName, attributes, referenceType
204 return {connection_, result.value()};
210 std::string_view browseName,
215 connection_, id_,
id, browseName, attributes, referenceType
217 return {connection_, result.value()};
223 std::string_view browseName,
228 connection_, id_,
id, browseName, attributes, referenceType
230 return {connection_, result.value()};
253 const NodeId& referenceType,
255 bool deleteBidirectional
258 connection_, id_, targetId, referenceType, isForward, deleteBidirectional
268 bool includeSubtypes =
true,
286 bool includeSubtypes =
true,
298 std::vector<Node> nodes;
299 nodes.reserve(refs.size());
300 for (
auto&& ref : refs) {
301 if (ref.getNodeId().isLocal()) {
302 nodes.emplace_back(connection_, std::move(ref.getNodeId().getNodeId()));
321 for (
auto&& target : result.getTargets()) {
322 if (target.getTargetId().isLocal()) {
323 return {connection_, std::move(target.getTargetId().getNodeId())};
345#ifdef UA_ENABLE_METHODCALLS
350 return services::call(connection_, id_, methodId, inputArguments).value();
420 template <
typename T>
422 return readValue().template getScalarCopy<T>();
426 template <
typename T>
428 return readValue().template getArrayCopy<T>();
479 return browseObjectProperty(propertyName).
readValue();
549 template <
typename T>
552 writeValue(Variant::fromScalar<VariantPolicy::ReferenceIfPossible>(
const_cast<T&
>(value)));
557 template <
typename ArrayLike>
560 Variant::fromArray<VariantPolicy::ReferenceIfPossible>(std::forward<ArrayLike>(array))
566 template <
typename InputIt>
568 writeValue(Variant::fromArray<VariantPolicy::ReferenceIfPossible>(first, last));
580 template <
typename T>
582 return writeDataType(asWrapper<NodeId>(getDataType<T>().typeId));
637 browseObjectProperty(propertyName).
writeValue(value);
648 result.getStatusCode().throwIfBad();
649 for (
auto&& target : result.getTargets()) {
650 if (target.getTargetId().isLocal()) {
651 return {connection_, std::move(target.getTargetId().getNodeId())};
654 throw BadStatus(UA_STATUSCODE_BADNOTFOUND);
657 Connection& connection_;
663template <
typename Connection>
665 return (lhs.connection() == rhs.connection()) && (lhs.id() == rhs.id());
668template <
typename Connection>
670 return !(lhs == rhs);
Exception for bad status codes from open62541 UA_STATUSCODE_*.
Bitmask using (scoped) enums.
UA_BrowseDescription wrapper class.
UA_DataTypeAttributes wrapper class.
UA_DataValue wrapper class.
UA_LocalizedText wrapper class.
UA_MethodAttributes wrapper class.
High-level node class to access node attribute, browse and populate address space.
double readMinimumSamplingInterval()
Read the AttributeId::MinimumSamplingInterval attribute of a node.
bool readIsAbstract()
Read the AttributeId::IsAbstract attribute of a node.
Node & writeUserAccessLevel(Bitmask< AccessLevel > mask)
Write the AttributeId::UserAccessLevel attribute of a node.
QualifiedName readBrowseName()
Read the AttributeId::BrowseName attribute of a node.
Bitmask< AccessLevel > readUserAccessLevel()
Read the AttributeId::UserAccessLevel attribute of a node.
Variant readObjectProperty(const QualifiedName &propertyName)
Read the value of an object property.
LocalizedText readDisplayName()
Read the AttributeId::DisplayName attribute of a node.
Node & writeArrayDimensions(Span< const uint32_t > dimensions)
Write the AttributeId::ArrayDimensions attribute of a node.
Node & writeUserWriteMask(Bitmask< WriteMask > mask)
Write the AttributeId::WriteMask attribute of a node.
const Connection & getConnection() const noexcept
Node & writeDisplayName(const LocalizedText &name)
Write the AttributeId::DisplayName attribute of a node.
Node & writeInverseName(const LocalizedText &name)
Write the AttributeId::InverseName attribute of a node.
Node addView(const NodeId &id, std::string_view browseName, const ViewAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::Organizes)
Add view.
Node & writeValueScalar(const T &value)
Write scalar to variable node.
Node & writeContainsNoLoops(bool containsNoLoops)
Write the AttributeId::ContainsNoLoops attribute of a node.
DataValue readDataValue()
Read the AttributeId::Value attribute of a node as a DataValue object.
Node & addModellingRule(ModellingRule rule)
Add modelling rule.
Node addObjectType(const NodeId &id, std::string_view browseName, const ObjectTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype)
Add object type.
std::vector< Variant > callMethod(const NodeId &methodId, Span< const Variant > inputArguments)
Call a server method and return results.
Node addProperty(const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={})
Add property.
Connection & connection() noexcept
Get the server/client instance.
Node & writeValueArray(ArrayLike &&array)
Write array value to variable node.
Node & writeUserExecutable(bool userExecutable)
Write the AttributeId::UserExecutable attribute of a node.
Node & writeObjectProperty(const QualifiedName &propertyName, const Variant &value)
Write the value of an object property.
std::vector< Node > browseChildren(const NodeId &referenceType=ReferenceTypeId::HierarchicalReferences, Bitmask< NodeClass > nodeClassMask=NodeClass::Unspecified)
Browse child nodes (only local nodes).
Node(Connection &connection, const NodeId &id)
Create a Node object.
void deleteNode(bool deleteReferences=true)
Delete node.
Node & writeHistorizing(bool historizing)
Write the AttributeId::Historizing attribute of a node.
LocalizedText readInverseName()
Read the AttributeId::InverseName attribute of a node.
NodeClass readNodeClass()
Read the AttributeId::NodeClass attribute of a node.
Node & writeSymmetric(bool symmetric)
Write the AttributeId::Symmetric attribute of a node.
bool exists() noexcept
Check if the Node exists in the most efficient manner.
Node addFolder(const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add folder.
std::vector< uint32_t > readArrayDimensions()
Read the AttributeId::ArrayDimensions attribute of a node.
Node & writeDataValue(const DataValue &value)
Write the AttributeId::Value attribute of a node as a DataValue object.
Node addObject(const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &objectType=ObjectTypeId::BaseObjectType, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add object.
const NodeId & getNodeId() const noexcept
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).
Node addDataType(const NodeId &id, std::string_view browseName, const DataTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype)
Add data type.
std::vector< ReferenceDescription > browseReferences(BrowseDirection browseDirection=BrowseDirection::Both, const NodeId &referenceType=ReferenceTypeId::References, bool includeSubtypes=true, Bitmask< NodeClass > nodeClassMask=NodeClass::Unspecified)
Browse references.
T readValueScalar()
Read scalar value from variable node.
bool readExecutable()
Read the AttributeId::Executable attribute of a node.
bool readContainsNoLoops()
Read the AttributeId::ContainsNoLoops attribute of a node.
Bitmask< AccessLevel > readAccessLevel()
Read the AttributeId::AccessLevel attribute of a node.
Node addReferenceType(const NodeId &id, std::string_view browseName, const ReferenceTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype)
Add reference type.
Variant readValue()
Read the AttributeId::Value attribute of a node.
Node & writeValueRank(ValueRank valueRank)
Write the AttributeId::ValueRank attribute of a node.
Node(Connection &connection, NodeId &&id)
Create a Node object.
bool readSymmetric()
Read the AttributeId::Symmetric attribute of a node.
Node & writeDataType(const NodeId &typeId)
Write the AttributeId::DataType attribute of a node.
Node & writeIsAbstract(bool isAbstract)
Write the AttributeId::IsAbstract attribute of a node.
Node & deleteReference(const NodeId &targetId, const NodeId &referenceType, bool isForward, bool deleteBidirectional)
Delete reference.
LocalizedText readDescription()
Read the AttributeId::Description attribute of a node.
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.
Bitmask< WriteMask > readUserWriteMask()
Read the AttributeId::UserWriteMask attribute of a node.
Node & writeDataType()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Connection & getConnection() noexcept
Node & writeValue(const Variant &value)
Write the AttributeId::Value attribute of a node.
bool readHistorizing()
Read the AttributeId::Historizing attribute of a node.
ValueRank readValueRank()
Read the AttributeId::ValueRank attribute of a node.
Node & writeExecutable(bool executable)
Write the AttributeId::Executable attribute of a node.
Node & writeWriteMask(Bitmask< WriteMask > mask)
Write the AttributeId::WriteMask attribute of a node.
Node & writeEventNotifier(Bitmask< EventNotifier > mask)
Write the AttributeId::EventNotifier attribute of a node.
Node & addReference(const NodeId &targetId, const NodeId &referenceType, bool forward=true)
Add reference.
NodeId readDataType()
Read the AttributeId::DataType attribute of a node.
std::vector< T > readValueArray()
Read array value from variable node.
const Connection & connection() const noexcept
Get the server/client instance.
Node addVariable(const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasComponent)
Add variable.
Node & writeValueArray(InputIt first, InputIt last)
Write range of elements as array value to variable node.
Node & writeAccessLevel(Bitmask< AccessLevel > mask)
Write the AttributeId::AccessLevel attribute of a node.
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.
Node browseParent()
Browse parent node.
Bitmask< WriteMask > readWriteMask()
Read the AttributeId::WriteMask attribute of a node.
Node & writeDescription(const LocalizedText &desc)
Write the AttributeId::Description attribute of a node.
bool readUserExecutable()
Read the AttributeId::UserExecutable attribute of a node.
const NodeId & id() const noexcept
Get the node id.
Bitmask< EventNotifier > readEventNotifier()
Read the AttributeId::EventNotifier attribute of a node.
Node & writeMinimumSamplingInterval(double milliseconds)
Write the AttributeId::MinimumSamplingInterval attribute of a node.
Node browseChild(Span< const QualifiedName > path)
Browse child node specified by its relative path from this node (only local nodes).
UA_ObjectAttributes wrapper class.
UA_ObjectTypeAttributes wrapper class.
UA_QualifiedName wrapper class.
UA_ReferenceTypeAttributes wrapper class.
constexpr void value() const
Get the value of the Result.
View to a contiguous sequence of objects, similar to std::span in C++20.
UA_VariableAttributes wrapper class.
UA_VariableAttributes wrapper class.
UA_Variant wrapper class.
UA_ViewAttributes wrapper class.
Result< NodeId > addReferenceType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ReferenceTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype) noexcept
Add reference type.
Result< NodeId > addVariableType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableTypeAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasSubtype) noexcept
Add variable type.
Result< NodeId > addObject(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &objectType=ObjectTypeId::BaseObjectType, const NodeId &referenceType=ReferenceTypeId::HasComponent) noexcept
Add object.
std::function< void(Span< const Variant > input, Span< Variant > output)> MethodCallback
Method callback.
Result< NodeId > addView(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ViewAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::Organizes) noexcept
Add view.
Result< NodeId > addProperty(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={}) noexcept
Add property.
Result< NodeId > addDataType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const DataTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype) noexcept
Add data type.
Result< NodeId > addVariable(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const VariableAttributes &attributes={}, const NodeId &variableType=VariableTypeId::BaseDataVariableType, const NodeId &referenceType=ReferenceTypeId::HasComponent) noexcept
Add variable.
Result< NodeId > addObjectType(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectTypeAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasSubtype) noexcept
Add object type.
Result< NodeId > addFolder(T &connection, const NodeId &parentId, const NodeId &id, std::string_view browseName, const ObjectAttributes &attributes={}, const NodeId &referenceType=ReferenceTypeId::HasComponent) noexcept
Add folder.
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=ReferenceTypeId::HasComponent) noexcept
Add method.
Result< void > addReference(T &connection, const NodeId &sourceId, const NodeId &targetId, const NodeId &referenceType, bool forward=true) noexcept
Add reference.
Result< void > addModellingRule(T &connection, const NodeId &id, ModellingRule rule) noexcept
Add modelling rule.
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).
CallResponse call(Client &connection, const CallRequest &request) noexcept
Call server methods.
Result< void > deleteNode(T &connection, const NodeId &id, bool deleteReferences=true) noexcept
Delete node.
Result< void > deleteReference(T &connection, const NodeId &sourceId, const NodeId &targetId, const NodeId &referenceType, bool isForward, bool deleteBidirectional) noexcept
Delete reference.
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.
Result< Bitmask< EventNotifier > > readEventNotifier(T &connection, const NodeId &id) noexcept
Read the AttributeId::EventNotifier 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.
Result< LocalizedText > readDisplayName(T &connection, const NodeId &id) noexcept
Read the AttributeId::DisplayName attribute of a node.
Result< QualifiedName > readBrowseName(T &connection, const NodeId &id) noexcept
Read the AttributeId::BrowseName attribute of a node.
Result< bool > readExecutable(T &connection, const NodeId &id) noexcept
Read the AttributeId::Executable attribute of a node.
Result< Bitmask< WriteMask > > readWriteMask(T &connection, const NodeId &id) noexcept
Read the AttributeId::WriteMask 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.
Result< ValueRank > readValueRank(T &connection, const NodeId &id) noexcept
Read the AttributeId::ValueRank attribute of a node.
Result< bool > readIsAbstract(T &connection, const NodeId &id) noexcept
Read the AttributeId::IsAbstract 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.
Result< BrowsePathResult > browseSimplifiedBrowsePath(T &connection, const NodeId &origin, Span< const QualifiedName > browsePath)
A simplified version of translateBrowsePathToNodeIds.
Result< BrowsePathResult > translateBrowsePathToNodeIds(T &connection, const BrowsePath &browsePath) noexcept
Translate a browse path to NodeIds.
Result< void > writeEventNotifier(T &connection, const NodeId &id, Bitmask< EventNotifier > eventNotifier) noexcept
Write the AttributeId::EventNotifier attribute of a node.
Result< void > writeMinimumSamplingInterval(T &connection, const NodeId &id, double minimumSamplingInterval) noexcept
Write the AttributeId::MinimumSamplingInterval attribute of a node.
Result< void > writeHistorizing(T &connection, const NodeId &id, bool historizing) noexcept
Write the AttributeId::Historizing attribute of a node.
Result< void > writeDescription(T &connection, const NodeId &id, const LocalizedText &description) noexcept
Write the AttributeId::Description attribute of a node.
Result< void > writeAccessLevel(T &connection, const NodeId &id, Bitmask< AccessLevel > accessLevel) noexcept
Write the AttributeId::AccessLevel attribute of a node.
Result< void > writeContainsNoLoops(T &connection, const NodeId &id, const bool &containsNoLoops) noexcept
Write the AttributeId::ContainsNoLoops attribute of a node.
Result< void > writeValueRank(T &connection, const NodeId &id, ValueRank valueRank) noexcept
Write the AttributeId::ValueRank attribute of a node.
Result< void > writeWriteMask(T &connection, const NodeId &id, Bitmask< WriteMask > writeMask) noexcept
Write the AttributeId::WriteMask attribute of a node.
Result< void > writeDisplayName(T &connection, const NodeId &id, const LocalizedText &displayName) noexcept
Write the AttributeId::DisplayName attribute of a node.
Result< void > writeDataValue(T &connection, const NodeId &id, const DataValue &value) noexcept
Write the AttributeId::Value attribute of a node as a DataValue object.
Result< void > writeUserAccessLevel(T &connection, const NodeId &id, Bitmask< AccessLevel > userAccessLevel) noexcept
Write the AttributeId::UserAccessLevel attribute of a node.
Result< void > writeDataType(T &connection, const NodeId &id, const NodeId &dataType) noexcept
Write the AttributeId::DataType attribute of a node.
Result< void > writeUserWriteMask(T &connection, const NodeId &id, Bitmask< WriteMask > userWriteMask) noexcept
Write the AttributeId::UserWriteMask attribute of a node.
Result< void > writeInverseName(T &connection, const NodeId &id, const LocalizedText &inverseName) noexcept
Write the AttributeId::InverseName attribute of a node.
Result< void > writeExecutable(T &connection, const NodeId &id, bool executable) noexcept
Write the AttributeId::Executable attribute of a node.
Result< void > writeArrayDimensions(T &connection, const NodeId &id, Span< const uint32_t > arrayDimensions) noexcept
Write the AttributeId::ArrayDimensions attribute of a node.
Result< void > writeValue(T &connection, const NodeId &id, const Variant &value) noexcept
Write the AttributeId::Value attribute of a node.
Result< void > writeUserExecutable(T &connection, const NodeId &id, bool userExecutable) noexcept
Write the AttributeId::UserExecutable attribute of a node.
Result< void > writeIsAbstract(T &connection, const NodeId &id, bool isAbstract) noexcept
Write the AttributeId::IsAbstract attribute of a node.
Result< void > writeSymmetric(T &connection, const NodeId &id, bool symmetric) noexcept
Write the AttributeId::Symmetric attribute of a node.
BrowseDirection
Browse direction.
bool operator!=(const Client &lhs, const Client &rhs) noexcept
ModellingRule
Modelling rules.
bool operator==(const Client &lhs, const Client &rhs) noexcept
#define UA_STATUSCODE_BADNOTFOUND
#define UA_STATUSCODE_BADNOMATCH