UA Server SDK C++ Bundle
1.3.2.200
|
This class encapsulates the native OpcUa_NodeId structure and handles memory allocation and cleanup for you. More...
#include <uanodeid.h>
Public Member Functions | |
UaNodeId () | |
Creates an empty NodeId with NS=0, IdentifierType=Numeric, Identifier=0. | |
UaNodeId (const UaNodeId &other) | |
Constructs a copy of other. | |
UaNodeId (const OpcUa_NodeId &other) | |
Construct a copy of the native OpcUa_NodeId structure. | |
UaNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0) | |
Creates a new numeric NodeId. | |
UaNodeId (const UaString &sId, OpcUa_UInt16 NsIdx) | |
Creates a new string NodeId. | |
UaNodeId (const UaGuid &guid, OpcUa_UInt16 NsIdx) | |
Creates a new GUID NodeId. | |
UaNodeId (const UaByteString &data, OpcUa_UInt16 NsIdx) | |
Creates a new opaque NodeId. | |
~UaNodeId () | |
Cleans up everything. | |
OpcUa_Boolean | isNull () const |
Checks whether a value is Null or not. | |
void | clear () |
Clear data. | |
void | attach (const OpcUa_NodeId *pOther) |
Attaches to the native NodeId structure. | |
OpcUa_NodeId * | detach (OpcUa_NodeId *pDst) |
Reset OpcUa_NodeId structure without clearing the data. | |
void | setNamespaceIndex (OpcUa_UInt16 NsIdx) |
Set the namespace index. | |
void | setNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0) |
Set the actual used node id. | |
void | setNodeId (const UaString &sId, OpcUa_UInt16 NsIdx=1) |
Set the actual used node id. | |
void | setNodeId (const UaGuid &id, OpcUa_UInt16 NsIdx) |
Set the actual used node id. | |
void | setNodeId (const UaByteString &id, OpcUa_UInt16 NsIdx) |
Set the actual used node id. | |
operator const OpcUa_NodeId * () const | |
Returns the OpcUa_NodeId pointer to the internal data structure. | |
OpcUa_NodeId * | copy () const |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId. | |
void | copyTo (OpcUa_NodeId *pDst) const |
Copy a value to a new destination. | |
UaNodeId & | operator= (const UaNodeId &other) |
Assigns another NodeId to the current instance. | |
bool | operator< (const UaNodeId &other) const |
Is lower than operator. | |
bool | operator== (const UaNodeId &other) const |
Compares another NodeId to the current instance. | |
bool | operator!= (const UaNodeId &other) const |
Compares another NodeId to the current instance. | |
bool | nodeIdCompare (OpcUa_NodeId *pNodeId) const |
Compares another NodeId to the current instance. | |
UaString | toString () const |
Converts the identifier of the NodeId to a string. | |
UaString | toFullString () const |
Converts all elements of a NodeId to a human readable string. | |
UaString | toXmlString () const |
Converts all elements of a NodeId to a string where the syntax is defined by the OPC UA XML Schema. | |
OpcUa_IdentifierType | identifierType () const |
Returns the identifier type of the NodeId. | |
OpcUa_UInt16 | namespaceIndex () const |
Returns the namespace index as numeric value. | |
OpcUa_UInt32 | identifierNumeric () const |
Returns the numeric identifier as numeric value. | |
const OpcUa_String * | identifierString () const |
Returns the string identifier as string value. |
Static Public Member Functions | |
static OpcUa_NodeId * | clone (const OpcUa_NodeId &source) |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId. | |
static void | cloneTo (const OpcUa_NodeId &source, OpcUa_NodeId ©) |
Creates a copy of the source NodeId. | |
static bool | compare (const OpcUa_NodeId &, const OpcUa_NodeId &) |
Compares two nodeIds and returns true if they are equal. | |
static UaNodeId | fromXmlString (UaString xmlString) |
Creates a NodeId to from a string where the syntax is defined by the OPC UA XML Schema. |
This class encapsulates the native OpcUa_NodeId structure and handles memory allocation and cleanup for you.
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.
UaNodeId::UaNodeId | ( | ) |
Creates an empty NodeId with NS=0, IdentifierType=Numeric, Identifier=0.
UaNodeId::UaNodeId | ( | const UaNodeId & | other | ) |
UaNodeId::UaNodeId | ( | const OpcUa_NodeId & | other | ) |
Construct 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 no copying is needed
other | the OpcUa_NodeId. |
UaNodeId::UaNodeId | ( | OpcUa_UInt32 | id, |
OpcUa_UInt16 | NsIdx = 0 |
||
) |
Creates a new numeric NodeId.
id | The numeric identifier. |
NsIdx | The 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 string NodeId.
sId | The string identifier. |
NsIdx | The namespace index. |
UaNodeId::UaNodeId | ( | const UaGuid & | guid, |
OpcUa_UInt16 | NsIdx | ||
) |
Creates a new GUID NodeId.
guid | The GUID identifier. |
NsIdx | The namespace index. |
UaNodeId::UaNodeId | ( | const UaByteString & | data, |
OpcUa_UInt16 | NsIdx | ||
) |
Creates a new opaque NodeId.
data | The opaque data identifier. |
NsIdx | The namespace index. |
UaNodeId::~UaNodeId | ( | ) |
void UaNodeId::attach | ( | const OpcUa_NodeId * | pOther | ) |
Attaches to the native NodeId structure.
This means UaNodeId takes ownership of the NodeId data and clears this in the destructor automatically. It does not clear the OpcUa_NodeId structure itself.
pOther | Pointer to native OpcUa_NodeId structure. |
void UaNodeId::clear | ( | ) |
Clear data.
Clears the current NodeId.
|
static |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId.
Creates a copy of the source NodeId.
source | the source of this operation. |
This method creates a complete new OpcUa_NodeId structure. You have to call OpcUa_NodeId_Clear to clear the NodeId contents and you have to free the structure itself using OpcUa_Memory_Free.
source | Source NodeId to clone. |
|
static |
Creates a copy of the source NodeId.
This method copies the NodeId data into an existing OpcUa_NodeId structure. You have to call OpcUa_NodeId_Clear to clear the NodeId contents.
source | Source NodeId to clone. |
copy | New copy of source NodeId. |
|
static |
Compares two nodeIds and returns true if they are equal.
nodeId1 | the source to compare to. |
nodeId2 | the destination to compare to. |
OpcUa_NodeId * UaNodeId::copy | ( | ) | const |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId.
Creates a copy of the internal NodeId.
This method creates a complete new OpcUa_NodeId structure. You have to call OpcUa_NodeId_Clear to clear the NodeId contents and you have to free the structure itself using OpcUa_Memory_Free.
void UaNodeId::copyTo | ( | OpcUa_NodeId * | pDst | ) | const |
Copy a value to a new destination.
Creates a copy of the internal NodeId.
pDst | the destination of this operation |
This method copies the NodeId data into an existing OpcUa_NodeId structure. You have to call OpcUa_NodeId_Clear to clear the NodeId contents.
pDst | the destination of this copy operation. |
OpcUa_NodeId * UaNodeId::detach | ( | OpcUa_NodeId * | pDst | ) |
Reset OpcUa_NodeId structure without clearing the data.
Detaches the internal NodeId structure from this class.
pDst | the destination of this operation |
This way you take over the control of releasing the NodeId data. You can only detach the data if not more than one references exists.
pDst | Pointer to OpcUa_NodeId structure that receives the NodeId data. |
Creates a NodeId to from a string where the syntax is defined by the OPC UA XML Schema.
The format of the string is
ns=<namespaceindex>;<type>=<identifier>
with the fields
OpcUa_UInt32 UaNodeId::identifierNumeric | ( | ) | const |
Returns the numeric identifier as numeric value.
Get an identifier as numeric.
const OpcUa_String * UaNodeId::identifierString | ( | ) | const |
Returns the string identifier as string value.
Get an identifier as sting.
OpcUa_IdentifierType UaNodeId::identifierType | ( | ) | const |
Returns the identifier type of the NodeId.
Get the identifier type.
Possible values are
OpcUa_Boolean UaNodeId::isNull | ( | ) | const |
Checks whether a value is Null or not.
Checks if the NodeId is NULL or not.
OpcUa_UInt16 UaNodeId::namespaceIndex | ( | ) | const |
Returns the namespace index as numeric value.
Get the namespace index.
bool UaNodeId::nodeIdCompare | ( | OpcUa_NodeId * | pNodeId | ) | const |
Compares another NodeId to the current instance.
Compares two nodeIds and returns true if they are equal.
pNodeId | the UaNodeId to assign. |
pNodeId | the node id of the actual node. |
UaNodeId::operator const OpcUa_NodeId * | ( | ) | const |
Returns the OpcUa_NodeId pointer to the internal data structure.
bool UaNodeId::operator!= | ( | const UaNodeId & | other | ) | const |
bool UaNodeId::operator< | ( | const UaNodeId & | other | ) | const |
Is lower than operator.
This is used to sort NodeIds e.g. to use it as key in map
other | the UaNodeId to append. |
Assigns another NodeId to the current instance.
other | the UaNodeId to assign. |
bool UaNodeId::operator== | ( | const UaNodeId & | other | ) | const |
void UaNodeId::setNamespaceIndex | ( | OpcUa_UInt16 | NsIdx | ) |
Set the namespace index.
Assigns a new namespace index to the NodeId.
NsIdx | The namespace index. |
void UaNodeId::setNodeId | ( | OpcUa_UInt32 | id, |
OpcUa_UInt16 | NsIdx = 0 |
||
) |
Set the actual used node id.
Assigns a new NodeId.
id | The numeric identifier. |
NsIdx | The namespace index. The default value for the namespace index is 0 to allow simple assignment of OPC UA defined numeric NodeIds |
id | The numeric identifier. |
NsIdx | The namespace index. |
void UaNodeId::setNodeId | ( | const UaString & | sId, |
OpcUa_UInt16 | NsIdx = 1 |
||
) |
Set the actual used node id.
Assigns a new NodeId.
sId | The string identifier. |
NsIdx | The namespace index. The default value for the namespace index is 1. Namespace 0 can only have numeric NodeIds. |
sId | The string identifier. |
NsIdx | The namespace index. |
void UaNodeId::setNodeId | ( | const UaGuid & | id, |
OpcUa_UInt16 | NsIdx | ||
) |
Set the actual used node id.
Assigns a new NodeId.
id | The guid identifier. |
NsIdx | The namespace index. |
id | The GUID identifier. |
NsIdx | The namespace index. |
void UaNodeId::setNodeId | ( | const UaByteString & | id, |
OpcUa_UInt16 | NsIdx | ||
) |
Set the actual used node id.
Assigns a new NodeId.
id | The byte string identifier. |
NsIdx | The namespace index. |
id | The ByteString identifier. |
NsIdx | The namespace index. |
UaString UaNodeId::toFullString | ( | ) | const |
Converts all elements of a NodeId to a human readable string.
The format of the string is
NS<namespace index>|<indentifier type>|<identifier>
with the fields
UaString UaNodeId::toString | ( | ) | const |
Converts the identifier of the NodeId to a string.
Converts the NodeId into a UaString.
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 format of the string is
ns=<namespaceindex>;<type>=<identifier>
with the fields