C++ UA Server SDK  1.5.0.318
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages

Wrapper class for the UA stack structure OpcUa_NodeId. More...

#include <uanodeid.h>

Public Member Functions

 UaNodeId ()
 Creates a null NodeId with NS=0, IdentifierType=Numeric, Identifier=0. More...
 
 UaNodeId (const UaNodeId &other)
 Constructs a copy of other. More...
 
 UaNodeId (const OpcUa_NodeId &other)
 Constructs a copy of the native OpcUa_NodeId structure. More...
 
 UaNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0)
 Creates a new NodeId with a numeric identifier. More...
 
 UaNodeId (const UaString &sId, OpcUa_UInt16 NsIdx)
 Creates a new NodeId with a string identifier. More...
 
 UaNodeId (const UaGuid &guid, OpcUa_UInt16 NsIdx)
 Creates a new NodeId with a GUID identifier. More...
 
 UaNodeId (const UaByteString &data, OpcUa_UInt16 NsIdx)
 Creates a new NodeId with a ByteString identifier. More...
 
 ~UaNodeId ()
 Destroys the UaNodeId object. More...
 
OpcUa_Boolean isNull () const
 Checks whether the NodeId is Null or not. More...
 
void clear ()
 Clears the content of the UaNodeId object and sets it to a null NodeId. More...
 
void attach (const OpcUa_NodeId *pOther)
 Attaches to the native NodeId structure. More...
 
OpcUa_NodeIddetach (OpcUa_NodeId *pDst)
 Detaches the internal NodeId structure from this class. More...
 
void setNamespaceIndex (OpcUa_UInt16 NsIdx)
 Assigns a new namespace index to the NodeId. More...
 
void setNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0)
 Sets the NodeId with a numeric identifier and namespace index. More...
 
void setNodeId (const UaString &sId, OpcUa_UInt16 NsIdx=1)
 Sets the NodeId with a string identifier and namespace index. More...
 
void setNodeId (const UaGuid &id, OpcUa_UInt16 NsIdx)
 Sets the NodeId with a GUID identifier and namespace index. More...
 
void setNodeId (const UaByteString &id, OpcUa_UInt16 NsIdx)
 Sets the NodeId with a ByteString identifier and namespace index. More...
 
 operator const OpcUa_NodeId * () const
 Returns the OpcUa_NodeId pointer to the internal data structure. More...
 
OpcUa_NodeIdcopy () const
 Allocates a NodeId structure and copies the internal NodeId. More...
 
void copyTo (OpcUa_NodeId *pDst) const
 Copies the internal NodeId to an allocated and initialized NodeId structure. More...
 
UaNodeIdoperator= (const UaNodeId &other)
 Assigns another NodeId to the current instance. More...
 
bool operator< (const UaNodeId &other) const
 Returns true if this NodeId is less than NodeId other; otherwise returns false. More...
 
bool operator== (const UaNodeId &other) const
 Is equal operator for two NodeIds. More...
 
bool operator!= (const UaNodeId &other) const
 Is not equal operator for two NodeIds. More...
 
bool nodeIdCompare (OpcUa_NodeId *pNodeId) const
 Compares this NodeId with a NodeId structure and returns true if they are equal. More...
 
UaString toString () const
 Converts the identifier of the NodeId to a UaString. More...
 
UaString toFullString () const
 Converts all elements of a NodeId to a human readable string. More...
 
UaString toXmlString () const
 Converts all elements of a NodeId to a string where the syntax is defined by the OPC UA XML Schema. More...
 
OpcUa_IdentifierType identifierType () const
 Gets the identifier type of a NodeId. More...
 
OpcUa_UInt16 namespaceIndex () const
 Returns the namespace index of the NodeId. More...
 
OpcUa_UInt32 identifierNumeric () const
 Returns the Numeric identifier of the NodeId. More...
 
const OpcUa_StringidentifierString () const
 Returns the String identifier of the NodeId. More...
 
void toVariant (UaVariant &variant) const
 Initializes a UaVariant with the NodeId. More...
 
void toVariant (OpcUa_Variant &variant) const
 Initializes an OpcUa_Variant structure with the NodeId. More...
 
void toVariant (UaVariant &variant, OpcUa_Boolean bDetach)
 Detach the NodeId to a UaVariant. More...
 
void toVariant (OpcUa_Variant &variant, OpcUa_Boolean bDetach)
 Detach the NodeId to an OpcUa_Variant structure. More...
 
void toDataValue (UaDataValue &dataValue, OpcUa_Boolean updateTimeStamps) const
 Initializes a UaDataValue with the NodeId. More...
 
void toDataValue (OpcUa_DataValue &dataValue, OpcUa_Boolean updateTimeStamps) const
 Initializes an OpcUa_DataValue structure with the NodeId. More...
 
void toDataValue (UaDataValue &dataValue, OpcUa_Boolean bDetach, OpcUa_Boolean updateTimeStamps)
 Detaches the NodeId to a UaDataValue. More...
 
void toDataValue (OpcUa_DataValue &dataValue, OpcUa_Boolean bDetach, OpcUa_Boolean updateTimeStamps)
 Detaches the NodeId to an OpcUa_DataValue structure. More...
 

Static Public Member Functions

static OpcUa_NodeIdclone (const OpcUa_NodeId &source)
 Static method that allocates a NodeId structure and copies the source NodeId. More...
 
static void cloneTo (const OpcUa_NodeId &source, OpcUa_NodeId &copy)
 Static method that copies the source NodeId structure to the copy NodeId structure. More...
 
static bool compare (const OpcUa_NodeId &, const OpcUa_NodeId &)
 Compares two NodeId structures and returns true if they are equal. More...
 
static UaNodeId fromXmlString (UaString xmlString)
 Creates a NodeId to from a string where the syntax is defined by the OPC UA XML Schema. More...
 

Friends

UABASE_EXPORT UaDataStream & operator<< (UaDataStream &, const UaNodeId &)
 Writes a NodeId to the stream. More...
 
UABASE_EXPORT UaDataStream & operator>> (UaDataStream &, UaNodeId &)
 Reads a NodeId from the stream. More...
 

Detailed Description

Wrapper class for the UA stack structure OpcUa_NodeId.

Helper class for handling the OPC UA built-in data type NodeId. It provides conversion and comparison functions and handles memory allocation and cleanup.

UaNodeId uses implicit sharing to avoid needless copying and to boost the performance. Only if you modify a shared NodeId, it creates a copy for that (copy-on-write). So assigning another UaNodeId or passing it as parameter is as fast as assigning a pointer.

NodeId as defined by OPC UA

A Server shall persist the NodeId of a Node, that is, it is not allowed to generate new NodeIds when rebooting. The server is not allowed to change the namespace index for a namespace URI as long as the server is not restarted but new namespaces can be added. The namespace index for a namespace URI may change after a server restart.

Clients must be prepared for changes of the namespace index in a NodeId and must persist their own namespace table together with the stored NodeIds for a server.

Structure of the NodeId

The NodeId data type is a structure with the following elements

Name Type Description
namespaceIndex UInt16 The index for a namespace URI used in an OPC UA server
identifierType enum The format and data type of the identifier
identifier * The identifier for a node in the address space of an OPC UA server

NamespaceIndex

The namespace is a URI that identifies the naming authority responsible for assigning the identifier element of the NodeId. Naming authorities include the local server, the underlying system, standards bodies and consortia. It is expected that most nodes will use the URI of the server or of the underlying system.

Using a namespace URI allows multiple OPC UA servers attached to the same underlying system to use the same identifier to identify the same object. This enables clients that connect to those Servers to recognise Objects that they have in common. The namespace URI is case sensitive. Namespace URIs are identified by numeric values in OPC UA services to permit more efficient transfer and processing (e.g. table lookups). The numeric values used to identify namespaces correspond to the index into the NamespaceArray. The NamespaceArray is a variable that is part of the Server object in the address space.

The URI for the OPC UA namespace is “http://opcfoundation.org/UA/”. Its corresponding index in the namespace table is 0.

The Namespace URI is case sensitive.

IdentifierType

The following IdentifierTypes are available:

Value Description
OpcUa_IdentifierType_Numeric Numeric value
OpcUa_IdentifierType_String String value
OpcUa_IdentifierType_Guid Globally Unique Identifier
OpcUa_IdentifierType_Opaque Namespace specific format in a ByteString

Identifier value

The identifier value element is used within the context of the first two elements to identify a node. Its data type and format is defined by the identifierType.

Numeric identifiers are typically used for static namespaces or for NodeIds in generated code. Such identifiers in generated code have typically defines generated which makes them easy to use and read in code.

// Construct NodeId with numeric identifier from namespace 0
// Namespace index 0 is default value for constructor with numeric value
UaNodeId nodeId1(OpcUaId_Server_NamespaceArray);
// Get current namespace index for namespace URI
OpcUa_UInt16 namespaceIndex = 0;
// Server: Get index from NodeManager
// Client: Get namespace index by reading the NamespaceArray from server, search for URI, use index of URI
// Construct NodeId from numeric identifier from other namespace
UaNodeId nodeId2(OpcUaDiId_DeviceSet, namespaceIndex);

String identifiers are typically used for nodes that are dynamically generated during system configuration. The string is either a path of nodes with a server specific delimiters or a server specific addressing schema contained in the string.

String identifiers are case sensitive. That is, clients shall consider them case sensitive. Servers are allowed to provide alternative NodeIds and using this mechanism severs can handle NodeIds as case insensitive.

// Construct NodeId from string identifier
UaNodeId nodeId2("MyNode", namespaceIndex);

Normally the scope of NodeIds is the server in which they are defined. For certain types of NodeIds, NodeIds can uniquely identify a Node within a system, or across systems (e.g. GUIDs). System-wide and globally-unique identifiers allow clients to track Nodes, such as work orders, as they move between OPC UA servers as they progress through the system.

// Create GUID for new node
UaGuid guidIdentifier = UaGuid::create();
// Or get GUID from configuration file
guidIdentifier.fromString(myGuidString);
// Construct NodeId from GUID identifier
UaNodeId nodeId2(guidIdentifier, namespaceIndex);

Opaque identifiers are identifiers that are free-format byte strings that might or might not be human interpretable.

Identifier values of IdentifierType STRING are restricted to 4096 characters. Identifier values of IdentifierType OPAQUE are restricted to 4096 bytes.

A null NodeId has special meaning. For example, many services define special behaviour if a null NodeId is passed as a parameter. A node in the address space cannot have a null NodeId.

Constructor & Destructor Documentation

UaNodeId::UaNodeId ( )

Creates a null NodeId with NS=0, IdentifierType=Numeric, Identifier=0.

UaNodeId::UaNodeId ( const UaNodeId other)

Constructs a copy of other.

This operation takes constant time, because UaNodeId is implicitly shared. This makes returning a UaNodeId from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.

Parameters
otherthe UaNodeId.
UaNodeId::UaNodeId ( const OpcUa_NodeId other)

Constructs a copy of the native OpcUa_NodeId structure.

This creates a copy of the native data and doesn't modify other. You can also attach the native structure, so that no copying is needed.

Parameters
otherthe OpcUa_NodeId.
See also
attach
UaNodeId::UaNodeId ( OpcUa_UInt32  id,
OpcUa_UInt16  NsIdx = 0 
)

Creates a new NodeId with a numeric identifier.

// Construct NodeId with numeric identifier from namespace 0
// Namespace index 0 is default value for constructor with numeric value
UaNodeId nodeId1(OpcUaId_Server_NamespaceArray);
// Get current namespace index for namespace URI
OpcUa_UInt16 namespaceIndex = 0;
// Server: Get index from NodeManager
// Client: Get namespace index by reading the NamespaceArray from server, search for URI, use index of URI
// Construct NodeId from numeric identifier from other namespace
UaNodeId nodeId2(OpcUaDiId_DeviceSet, namespaceIndex);
Parameters
idThe numeric identifier.
NsIdxThe namespace index. The default value for the namespace index is 0 to allow simple assignment of OPC UA defined numeric NodeIds.
UaNodeId::UaNodeId ( const UaString sId,
OpcUa_UInt16  NsIdx 
)

Creates a new NodeId with a string identifier.

// Get current namespace index for namespace URI
OpcUa_UInt16 namespaceIndex = 0;
// Server: Get index from NodeManager
namespaceIndex = pMyNodeManager->getNamespaceIndex();
// Client: Get namespace index by reading the NamespaceArray from server, search for URI, use index of URI
// Construct NodeId from string identifier
UaNodeId nodeId2("MyNode", namespaceIndex);
Parameters
sIdThe string identifier.
NsIdxThe namespace index.
UaNodeId::UaNodeId ( const UaGuid guid,
OpcUa_UInt16  NsIdx 
)

Creates a new NodeId with a GUID identifier.

// Get current namespace index for namespace URI
OpcUa_UInt16 namespaceIndex = 0;
// Server: Get index from NodeManager
namespaceIndex = pMyNodeManager->getNamespaceIndex();
// Client: Get namespace index by reading the NamespaceArray from server, search for URI, use index of URI
// Construct NodeId from GUID identifier
UaGuid guidIdentifier = UaGuid::create();
guidIdentifier.fromString(myGuidString);
UaNodeId nodeId3(guidIdentifier, namespaceIndex);
Parameters
guidThe GUID identifier.
NsIdxThe namespace index.
UaNodeId::UaNodeId ( const UaByteString data,
OpcUa_UInt16  NsIdx 
)

Creates a new NodeId with a ByteString identifier.

Parameters
dataThe ByteString identifier.
NsIdxThe namespace index.
UaNodeId::~UaNodeId ( )

Destroys the UaNodeId object.

If you want to prevent deleting the internal OpcUa_NodeId structure, you can also detach it before deleting the UaNodeId instance.

See also
detach

Member Function Documentation

void UaNodeId::attach ( const OpcUa_NodeId pOther)

Attaches to the native NodeId structure.

This means UaNodeId takes ownership of the NodeId data and automatically clears it in the destructor.

It does not clear the OpcUa_NodeId structure itself. This must be done by the caller.

Parameters
pOtherPointer to native OpcUa_NodeId structure.
void UaNodeId::clear ( )

Clears the content of the UaNodeId object and sets it to a null NodeId.

OpcUa_NodeId * UaNodeId::clone ( const OpcUa_NodeId source)
static

Static method that allocates a NodeId structure and copies the source NodeId.

This method allocates a new OpcUa_NodeId structure and copies the content of the source NodeId the new structure.

The caller must use OpcUa_NodeId_Clear to clear the allocated data in the structure and must use OpcUa_Memory_Free to free the allocated memory for the structure.

Parameters
sourceSource NodeId to clone.
Returns
a new copy of source NodeId.
void UaNodeId::cloneTo ( const OpcUa_NodeId source,
OpcUa_NodeId copy 
)
static

Static method that copies the source NodeId structure to the copy NodeId structure.

This method copies the NodeId data for source to an existing OpcUa_NodeId structure.

The caller must use OpcUa_NodeId_Clear to clear the allocated data in the structure.

Parameters
sourceSource NodeId to clone.
copyNew copy of source NodeId.
bool UaNodeId::compare ( const OpcUa_NodeId nodeId1,
const OpcUa_NodeId nodeId2 
)
static

Compares two NodeId structures and returns true if they are equal.

Parameters
nodeId1The source to compare to.
nodeId2The destination to compare to.
Returns
true if the two nodeIds are equal.
See also
operator==
OpcUa_NodeId * UaNodeId::copy ( ) const

Allocates a NodeId structure and copies the internal NodeId.

This method allocates a new OpcUa_NodeId structure and copies the content of the UaNodeId object to the new structure.

The caller must use OpcUa_NodeId_Clear to clear the allocated data in the structure and must use OpcUa_Memory_Free to free the allocated memory for the structure.

Returns
a copy of this NodeId.
void UaNodeId::copyTo ( OpcUa_NodeId pDst) const

Copies the internal NodeId to an allocated and initialized NodeId structure.

This method copies the UaNodeId data to an existing OpcUa_NodeId structure.

The caller must use OpcUa_NodeId_Clear to clear the allocated data in the structure.

Parameters
pDstThe destination of this copy operation.
Returns
a new copy.
OpcUa_NodeId * UaNodeId::detach ( OpcUa_NodeId pDst)

Detaches the internal NodeId structure from this class.

This way the caller takes over the ownership of the structure data and is responsible for clearing the NodeId data.

The caller can only detach the data if not more than one reference exists.

Parameters
pDstPointer to OpcUa_NodeId structure that receives the NodeId data.
Returns
If the function succeeds, pDst is returned, otherwise 0 is returned.
UaNodeId UaNodeId::fromXmlString ( UaString  xmlString)
static

Creates a NodeId to from a string where the syntax is defined by the OPC UA XML Schema.

The reverse function is

See also
toXmlString()

The format of the string is
ns=<namespaceindex>;<identifier type>=<identifier>

with the fields

<namespace index>
The namespace index formatted as a base 10 number. If the index is 0, then the entire 'ns=0;' clause is omitted.
<identifier type>
A flag that specifies the identifier type. The flag has the following values:
Flag Identifier Type
i NUMERIC (UInteger)
s STRING (String)
g GUID (Guid)
b OPAQUE (ByteString)
<identifier>
The identifier encoded as string. The identifier is formatted using the XML data type mapping for the identifier type. Note that the identifier may contain any non-null UTF8 character including whitespace.
UaNodeId myNodeId;
UaString sNodeId("ns=2;s=MyNode");
myNodeId = UaNodeId::fromXmlString(sNodeId);
OpcUa_UInt32 UaNodeId::identifierNumeric ( ) const

Returns the Numeric identifier of the NodeId.

Returns
the numeric identifier as numeric value.
const OpcUa_String * UaNodeId::identifierString ( ) const

Returns the String identifier of the NodeId.

Returns
the string identifier as string value.
OpcUa_IdentifierType UaNodeId::identifierType ( ) const

Gets the identifier type of a NodeId.

Possible values are

  • OpcUa_IdentifierType_Numeric = 0x00
  • OpcUa_IdentifierType_String = 0x01
  • OpcUa_IdentifierType_Guid = 0x02
  • OpcUa_IdentifierType_Opaque = 0x03
Returns
the identifier type of the NodeId
OpcUa_Boolean UaNodeId::isNull ( ) const

Checks whether the NodeId is Null or not.

Returns
true if Null, false if not.
OpcUa_UInt16 UaNodeId::namespaceIndex ( ) const

Returns the namespace index of the NodeId.

Returns
the namespace index of the NodeId.
bool UaNodeId::nodeIdCompare ( OpcUa_NodeId pNodeId) const

Compares this NodeId with a NodeId structure and returns true if they are equal.

Parameters
pNodeIdThe node id of the actual node.
Returns
true if the nodeIds are equal.
See also
operator==
UaNodeId::operator const OpcUa_NodeId * ( ) const

Returns the OpcUa_NodeId pointer to the internal data structure.

Returns
OpcUa_NodeId pointer to the internal data structure.
bool UaNodeId::operator!= ( const UaNodeId other) const

Is not equal operator for two NodeIds.

See also
operator==
Parameters
otherThe UaString to compare.
Returns
true if other is not equal to this.
bool UaNodeId::operator< ( const UaNodeId other) const

Returns true if this NodeId is less than NodeId other; otherwise returns false.

The comparison is executed step by step for the different NodeId fields. If the IdentifierType is different, true is returned if the IdentifierType of this is lesser than other. If the NamespaceIndex is different, true is returned if the NamespaceIndex of this is lesser than other. The checks are executed in sequence and the identifier comparison is only executed if IdentifierType and NamespaceIndex are equal.

If the numeric identifier of this is lesser than other, true is returned. For string NodeIds a string compare is executed. For GUID and Opaque a memory compare is executed.

This is used to sort NodeIds, e.g. to use it as key in a map.

Parameters
otherThe UaNodeId to compare.
Returns
true if less, false if not.
UaNodeId & UaNodeId::operator= ( const UaNodeId other)

Assigns another NodeId to the current instance.

Parameters
otherThe UaNodeId to assign.
Returns
another NodeId for the current instance.
bool UaNodeId::operator== ( const UaNodeId other) const

Is equal operator for two NodeIds.

Parameters
otherThe UaNodeId to compare.
Returns
true if the two nodeIds are equal
void UaNodeId::setNamespaceIndex ( OpcUa_UInt16  NsIdx)

Assigns a new namespace index to the NodeId.

Parameters
NsIdxThe namespace index.
void UaNodeId::setNodeId ( OpcUa_UInt32  id,
OpcUa_UInt16  NsIdx = 0 
)

Sets the NodeId with a numeric identifier and namespace index.

Parameters
idThe numeric identifier.
NsIdxThe namespace index.
void UaNodeId::setNodeId ( const UaString sId,
OpcUa_UInt16  NsIdx = 1 
)

Sets the NodeId with a string identifier and namespace index.

Parameters
sIdThe string identifier.
NsIdxThe namespace index.
void UaNodeId::setNodeId ( const UaGuid id,
OpcUa_UInt16  NsIdx 
)

Sets the NodeId with a GUID identifier and namespace index.

Parameters
idThe GUID identifier.
NsIdxThe namespace index.
void UaNodeId::setNodeId ( const UaByteString id,
OpcUa_UInt16  NsIdx 
)

Sets the NodeId with a ByteString identifier and namespace index.

Parameters
idThe ByteString identifier.
NsIdxThe namespace index.
void UaNodeId::toDataValue ( UaDataValue dataValue,
OpcUa_Boolean  updateTimeStamps 
) const

Initializes a UaDataValue with the NodeId.

Parameters
dataValueThe UaDataValue to initialize with the NodeId.
updateTimeStampsFlag indicating if the timestamp of the UaDataValue should be updated.
void UaNodeId::toDataValue ( OpcUa_DataValue dataValue,
OpcUa_Boolean  updateTimeStamps 
) const

Initializes an OpcUa_DataValue structure with the NodeId.

Parameters
dataValueThe OpcUa_DataValue structure to initialize with the NodeId.
updateTimeStampsFlag indicating if the timestamp of the UaDataValue should be updated.
void UaNodeId::toDataValue ( UaDataValue dataValue,
OpcUa_Boolean  bDetach,
OpcUa_Boolean  updateTimeStamps 
)

Detaches the NodeId to a UaDataValue.

Parameters
dataValueThe UaDataValue where the NodeId should be detached to.
bDetachDetaches the NodeId if true.
updateTimeStampsFlag indicating if the timestamp of the UaDataValue should be updated.
void UaNodeId::toDataValue ( OpcUa_DataValue dataValue,
OpcUa_Boolean  bDetach,
OpcUa_Boolean  updateTimeStamps 
)

Detaches the NodeId to an OpcUa_DataValue structure.

Parameters
dataValueThe OpcUa_DataValue structure where the NodeId should be detached to.
bDetachDetaches the NodeId if true.
updateTimeStampsFlag indicating if the timestamp of the UaDataValue should be updated.
UaString UaNodeId::toFullString ( ) const

Converts all elements of a NodeId to a human readable string.

The format of the string is
NS<namespace index>|<identifier type>|<identifier>s

with the fields

<namespace index>
is the namespace index in the NodeId as numeric value
<identifier type>
is Numeric, String, Guid or Opaque
<identifier>
is the string representation of the Identifier field of the NodeId

There is no reverse function available for toFullString. If you want to create a string that can be used later to create a UaNodeId from this string, toXmlString() must be used.

Examples are

'NS0|Numeric|13'
namespace index 0, numeric identifier
'NS10|Numeric|5001'
namespace index 10, numeric identifier
'NS10|String|Hello:World'
namespace index 10, string identifier
'NS1|Guid|{09087e75-8e5e-499b-954f-f2a9603db28a}'
namespace index 1, GUID identifier
'NS1|Opaque|0x61626364'
namespace index 1, Opaque/ByteString identifier
Returns
the converted NodeId.
UaString UaNodeId::toString ( ) const

Converts the identifier of the NodeId to a UaString.

Only the identifier part of the NodeId is returned as UaString. The namespace index and the identifier type is not contained. Use toFullString() or toXmlString() to get all information contained in the NodeId.

There is no reverse function available for toString. If you want to create a string that can be used later to create a UaNodeId from this string, toXmlString() must be used.

Returns
the identifier as UaString
void UaNodeId::toVariant ( UaVariant variant) const

Initializes a UaVariant with the NodeId.

Parameters
variantThe UaVariant to initialize with the NodeId.
void UaNodeId::toVariant ( OpcUa_Variant variant) const

Initializes an OpcUa_Variant structure with the NodeId.

Parameters
variantThe OpcUa_Variant structure to initialize with the NodeId.
void UaNodeId::toVariant ( UaVariant variant,
OpcUa_Boolean  bDetach 
)

Detach the NodeId to a UaVariant.

Parameters
variantThe UaVariant where the NodeId should be detached to.
bDetachDetaches the NodeId if true.
void UaNodeId::toVariant ( OpcUa_Variant variant,
OpcUa_Boolean  bDetach 
)

Detach the NodeId to an OpcUa_Variant structure.

Parameters
variantThe OpcUa_Variant structure where the NodeId should be detached to.
bDetachDetaches the NodeId if true.
UaString UaNodeId::toXmlString ( ) const

Converts all elements of a NodeId to a string where the syntax is defined by the OPC UA XML Schema.

The reverse function is

See also
fromXmlString()

The format of the string is
ns=<namespaceindex>;<identifier type>=<identifier>

with the fields

<namespace index>
The namespace index formatted as a base 10 number. If the index is 0, then the entire 'ns=0;' clause is omitted.
<identifier type>
A flag that specifies the identifier type. The flag has the following values:
Flag Identifier Type
i NUMERIC (UInteger)
s STRING (String)
g GUID (Guid)
b OPAQUE (ByteString)
<identifier>
The identifier encoded as string. The identifier is formatted using the XML data type mapping for the identifier type. Note that the identifier may contain any non-null UTF8 character including whitespace.

Examples are

'i=13'
namespace index 0, numeric identifier
'ns=10;i=5001'
namespace index 10, numeric identifier
'ns=10;s=Hello:World'
namespace index 10, string identifier
'ns=1;g=09087e75-8e5e-499b-954f-f2a9603db28a'
namespace index 1, GUID identifier
'ns=1;b=M/RbKBsRVkePCePcx24oRA=='
namespace index 1, Opaque/ByteString identifier
Returns
the converted NodeId.

Friends And Related Function Documentation

UABASE_EXPORT UaDataStream& operator<< ( UaDataStream &  ,
const UaNodeId  
)
friend

Writes a NodeId to the stream.

UABASE_EXPORT UaDataStream& operator>> ( UaDataStream &  ,
UaNodeId  
)
friend

Reads a NodeId from the stream.


The documentation for this class was generated from the following files: