UA Server SDK C++ Bundle
1.4.0.258
|
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. More... | |
UaNodeId (const UaNodeId &other) | |
Constructs a copy of other. More... | |
UaNodeId (const OpcUa_NodeId &other) | |
Construct a copy of the native OpcUa_NodeId structure. More... | |
UaNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0) | |
Creates a new numeric NodeId. More... | |
UaNodeId (const UaString &sId, OpcUa_UInt16 NsIdx) | |
Creates a new string NodeId. More... | |
UaNodeId (const UaGuid &guid, OpcUa_UInt16 NsIdx) | |
Creates a new GUID NodeId. More... | |
UaNodeId (const UaByteString &data, OpcUa_UInt16 NsIdx) | |
Creates a new opaque NodeId. More... | |
~UaNodeId () | |
Cleans up everything. More... | |
OpcUa_Boolean | isNull () const |
Checks whether a value is Null or not. More... | |
void | clear () |
Clear data. More... | |
void | attach (const OpcUa_NodeId *pOther) |
Attaches to the native NodeId structure. More... | |
OpcUa_NodeId * | detach (OpcUa_NodeId *pDst) |
Reset OpcUa_NodeId structure without clearing the data. More... | |
void | setNamespaceIndex (OpcUa_UInt16 NsIdx) |
Set the namespace index. More... | |
void | setNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0) |
Set the actual used node id. More... | |
void | setNodeId (const UaString &sId, OpcUa_UInt16 NsIdx=1) |
Set the actual used node id. More... | |
void | setNodeId (const UaGuid &id, OpcUa_UInt16 NsIdx) |
Set the actual used node id. More... | |
void | setNodeId (const UaByteString &id, OpcUa_UInt16 NsIdx) |
Set the actual used node id. More... | |
operator const OpcUa_NodeId * () const | |
Returns the OpcUa_NodeId pointer to the internal data structure. More... | |
OpcUa_NodeId * | copy () const |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId. More... | |
void | copyTo (OpcUa_NodeId *pDst) const |
Copy a value to a new destination. More... | |
UaNodeId & | operator= (const UaNodeId &other) |
Assigns another NodeId to the current instance. More... | |
bool | operator< (const UaNodeId &other) const |
Is lower than operator. More... | |
bool | operator== (const UaNodeId &other) const |
Compares another NodeId to the current instance. More... | |
bool | operator!= (const UaNodeId &other) const |
Compares another NodeId to the current instance. More... | |
bool | nodeIdCompare (OpcUa_NodeId *pNodeId) const |
Compares another NodeId to the current instance. 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 |
Returns the identifier type of the NodeId. More... | |
OpcUa_UInt16 | namespaceIndex () const |
Returns the namespace index as numeric value. More... | |
OpcUa_UInt32 | identifierNumeric () const |
Returns the numeric identifier as numeric value. More... | |
const OpcUa_String * | identifierString () const |
Returns the string identifier as string value. More... | |
void | toVariant (UaVariant &variant) const |
void | toVariant (OpcUa_Variant &variant) const |
void | toVariant (UaVariant &variant, OpcUa_Boolean bDetach) |
void | toVariant (OpcUa_Variant &variant, OpcUa_Boolean bDetach) |
void | toDataValue (UaDataValue &dataValue, OpcUa_Boolean updateTimeStamps) const |
void | toDataValue (OpcUa_DataValue &dataValue, OpcUa_Boolean updateTimeStamps) const |
void | toDataValue (UaDataValue &dataValue, OpcUa_Boolean bDetach, OpcUa_Boolean updateTimeStamps) |
void | toDataValue (OpcUa_DataValue &dataValue, OpcUa_Boolean bDetach, OpcUa_Boolean updateTimeStamps) |
Static Public Member Functions | |
static OpcUa_NodeId * | clone (const OpcUa_NodeId &source) |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId. More... | |
static void | cloneTo (const OpcUa_NodeId &source, OpcUa_NodeId ©) |
Creates a copy of the source NodeId. More... | |
static bool | compare (const OpcUa_NodeId &, const OpcUa_NodeId &) |
Compares two nodeIds 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 &) |
define UaDataStream operators for UaNodeId. More... | |
UABASE_EXPORT UaDataStream & | operator>> (UaDataStream &, UaNodeId &) |
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 reverse function is
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
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
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.
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
The format of the string is
ns=<namespaceindex>;<type>=<identifier>
with the fields
Examples are
|
friend |
define UaDataStream operators for UaNodeId.