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.
More...
#include <uanodeid.h>
List of all members.
Public Member Functions |
| UaNodeId () |
| UaNodeId (const UaNodeId &other) |
| UaNodeId (const OpcUa_NodeId &other) |
| UaNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0) |
| UaNodeId (const UaString &sId, OpcUa_UInt16 NsIdx) |
| UaNodeId (const UaGuid &guid, OpcUa_UInt16 NsIdx) |
| UaNodeId (const UaByteString &data, OpcUa_UInt16 NsIdx) |
| ~UaNodeId () |
OpcUa_Boolean | isNull () const |
void | clear () |
void | attach (const OpcUa_NodeId *pOther) |
OpcUa_NodeId * | detach (OpcUa_NodeId *pDst) |
void | setNamespaceIndex (OpcUa_UInt16 NsIdx) |
void | setNodeId (OpcUa_UInt32 id, OpcUa_UInt16 NsIdx=0) |
void | setNodeId (const UaString &sId, OpcUa_UInt16 NsIdx=1) |
void | setNodeId (const UaGuid &id, OpcUa_UInt16 NsIdx) |
void | setNodeId (const UaByteString &id, OpcUa_UInt16 NsIdx) |
| operator const OpcUa_NodeId * () const |
OpcUa_NodeId * | copy () const |
void | copyTo (OpcUa_NodeId *pDst) const |
UaNodeId & | operator= (const UaNodeId &other) |
bool | operator< (const UaNodeId &other) const |
bool | operator== (const UaNodeId &other) const |
bool | operator!= (const UaNodeId &other) const |
bool | nodeIdCompare (OpcUa_NodeId *pNodeId) const |
UaString | toString () const |
UaString | toFullString () const |
UaString | toXmlString () const |
OpcUa_IdentifierType | identifierType () const |
OpcUa_UInt16 | namespaceIndex () const |
OpcUa_UInt32 | identifierNumeric () const |
const OpcUa_String * | identifierString () const |
Static Public Member Functions |
static OpcUa_NodeId * | clone (const OpcUa_NodeId &source) |
static void | cloneTo (const OpcUa_NodeId &source, OpcUa_NodeId ©) |
static bool | compare (const OpcUa_NodeId &, const OpcUa_NodeId &) |
static UaNodeId | fromXmlString (UaString xmlString) |
Detailed Description
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.
Constructor & Destructor Documentation
Creates an empty 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:
-
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 stucture so no copying is needed
- Parameters:
-
- See also:
- attach
UaNodeId::UaNodeId |
( |
OpcUa_UInt32 |
id, |
|
|
OpcUa_UInt16 |
NsIdx = 0 |
|
) |
| |
Creates a new numeric NodeId.
- Parameters:
-
id | The numeric identifier. |
NsIdx | The namespace index. |
UaNodeId::UaNodeId |
( |
const UaString & |
sId, |
|
|
OpcUa_UInt16 |
NsIdx |
|
) |
| |
Creates a new string NodeId.
- Parameters:
-
sId | The string identifier. |
NsIdx | The namespace index. |
UaNodeId::UaNodeId |
( |
const UaGuid & |
guid, |
|
|
OpcUa_UInt16 |
NsIdx |
|
) |
| |
Creates a new GUID NodeId.
- Parameters:
-
guid | The GUID identifier. |
NsIdx | The namespace index. |
UaNodeId::UaNodeId |
( |
const UaByteString & |
data, |
|
|
OpcUa_UInt16 |
NsIdx |
|
) |
| |
Creates a new opaque NodeId.
- Parameters:
-
data | The opqaque data identifier. |
NsIdx | The namespace index. |
Cleans up everything. If you want to prevent deleting the internal OpcUa_NodeId structure you can also detach it before deleting the UaNodeId intance.
- 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 clears this in the destructor automatically. It does not clear the OpcUa_NodeId structure itself.
- Parameters:
-
pOther | Pointer to native OpcUa_NodeId structure. |
Clear data.
Clears the current NodeId.
OpcUa_NodeId * UaNodeId::clone |
( |
const OpcUa_NodeId & |
source ) |
[static] |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId.
- Parameters:
-
source | the source of this operation. |
- Returns:
- a newly allocated OpcUa_NodeId.
Creates a copy of the source 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.
- Parameters:
-
source | Source NodeId to clone. |
- Returns:
- New copy of source NodeId.
void UaNodeId::cloneTo |
( |
const OpcUa_NodeId & |
source, |
|
|
OpcUa_NodeId & |
copy |
|
) |
| [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.
- Parameters:
-
source | Source NodeId to clone. |
copy | New copy of source NodeId. |
bool UaNodeId::compare |
( |
const OpcUa_NodeId & |
nodeId1, |
|
|
const OpcUa_NodeId & |
nodeId2 |
|
) |
| [static] |
Compares two nodeIds and returns true if they are equal.
- Parameters:
-
nodeId1 | the source to compare to. |
nodeId2 | the destination to comapre to. |
- Returns:
- true if the two nodeIds are equal.
- See also:
- operator==
OpcUa_NodeId * UaNodeId::copy |
( |
) |
const |
Copy OpcUa_NodeId data to a newly allocated OpcUa_NodeId.
- Returns:
- 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.
- Returns:
- copy of this NodeId.
void UaNodeId::copyTo |
( |
OpcUa_NodeId * |
pDst ) |
const |
Copy a value to a new destination.
- Parameters:
-
pDst | the destination of this operation |
- Returns:
- a new copy.
Creates a copy of the internal 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.
- Parameters:
-
pDst | the destination of this copyoperation. |
OpcUa_NodeId * UaNodeId::detach |
( |
OpcUa_NodeId * |
pDst ) |
|
Reset OpcUa_NodeId structure without clearing the data.
- Parameters:
-
pDst | the destination of this operation |
Detaches the internal NodeId structure from this class. 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.
- Parameters:
-
pDst | Pointer to OpcUa_NodeId structure that receives the NodeId data. |
- Returns:
- If the functions succeeds pDst is returned, otherwise 0 is returned.
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
- <namespaceindex> The namespace index formatted as a base 10 number. If the index is 0 then the entire 'ns=0;' clause is omitted.
- <type> A flag that specifies the identifier type. The flag has the following values:
- 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.
OpcUa_UInt32 UaNodeId::identifierNumeric |
( |
) |
const |
Returns the numeric identifier as numeric value.
Get an identifier as numeric.
- Returns:
- an identifier as numeric.
const OpcUa_String * UaNodeId::identifierString |
( |
) |
const |
Returns the string identifier as string value.
Get an identifier as sting.
- Returns:
- an identifier as sting.
OpcUa_IdentifierType UaNodeId::identifierType |
( |
) |
const |
Returns the identifier type of the NodeId. Possible values are
- OpcUa_IdentifierType_Numeric = 0x00
- OpcUa_IdentifierType_String = 0x01
- OpcUa_IdentifierType_Guid = 0x02
- OpcUa_IdentifierType_Opaque = 0x03
Get the identifier type.
- Returns:
- the identifier type.
OpcUa_Boolean UaNodeId::isNull |
( |
) |
const |
Checks wether a value is Null or not.
- Returns:
- true if Null false if not.
Checks if the NodeId is NULL or not.
- Returns:
- true if it is NULL false if not.
OpcUa_UInt16 UaNodeId::namespaceIndex |
( |
) |
const |
Returns the namespace index as numeric value.
Get the namespace index.
- Returns:
- the namespace index.
bool UaNodeId::nodeIdCompare |
( |
OpcUa_NodeId * |
pNodeId ) |
const |
Compares another NodeId to the current instance.
- Parameters:
-
- Returns:
- another NodeId to the current instance.
Compares two nodeIds and returns true if they are equal.
- Parameters:
-
pNodeId | the 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 |
Compares another NodeId to the current instance.
- Parameters:
-
- Returns:
- another NodeId to the current instance.
Returns true if other is not equal to this.
- See also:
- operator==
- Parameters:
-
- Returns:
- true if other is not equal to this.
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
- Parameters:
-
- Returns:
- true if appended false if not.
Assigns another NodeId to the current instance.
- Parameters:
-
- Returns:
- another NodeId to the current instance.
bool UaNodeId::operator== |
( |
const UaNodeId & |
other ) |
const |
Compares another NodeId to the current instance.
- Parameters:
-
- Returns:
- another NodeId to the current instance.
Is equal operator.
- Parameters:
-
- Returns:
- true if the two nodeIds are equal
void UaNodeId::setNamespaceIndex |
( |
OpcUa_UInt16 |
NsIdx ) |
|
Set the namespace index.
- Parameters:
-
NsIdx | The namespace index. |
Assigns a new namespace index to the NodeId.
- Parameters:
-
NsIdx | The namespace index. |
void UaNodeId::setNodeId |
( |
const UaGuid & |
id, |
|
|
OpcUa_UInt16 |
NsIdx |
|
) |
| |
Set the actual used node id.
- Parameters:
-
id | The guid identifier. |
NsIdx | The namespace index. |
Assigns a new NodeId.
- Parameters:
-
id | The GUID identifier. |
NsIdx | The namespace index. |
void UaNodeId::setNodeId |
( |
const UaByteString & |
id, |
|
|
OpcUa_UInt16 |
NsIdx |
|
) |
| |
Set the actual used node id.
- Parameters:
-
id | The bytestring identifier. |
NsIdx | The namespace index. |
Assigns a new NodeId.
- Parameters:
-
id | The ByteString identifier. |
NsIdx | The namespace index. |
void UaNodeId::setNodeId |
( |
const UaString & |
sId, |
|
|
OpcUa_UInt16 |
NsIdx = 1 |
|
) |
| |
Set the actual used node id.
- Parameters:
-
sId | The string identifier. |
NsIdx | The namespace index. |
Assigns a new NodeId.
- Parameters:
-
sId | The string identifier. |
NsIdx | The namespace index. |
void UaNodeId::setNodeId |
( |
OpcUa_UInt32 |
id, |
|
|
OpcUa_UInt16 |
NsIdx = 0 |
|
) |
| |
Set the actual used node id.
- Parameters:
-
id | The numeric identifier. |
NsIdx | The namespace index. |
Assigns a new NodeId.
- Parameters:
-
id | The numeric 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
- <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
Converts the identifier of the NodeId to a string.
Converts the NodeId into a UaString.
- Returns:
- the converted NodeId.
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
- <namespaceindex> The namespace index formatted as a base 10 number. If the index is 0 then the entire 'ns=0;' clause is omitted.
- <type> A flag that specifies the identifier type. The flag has the following values:
- 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.
The documentation for this class was generated from the following files:
- /home/buildbot/work/uasdkcpp/src/uabase/uabasecpp/uanodeid.h
- /home/buildbot/work/uasdkcpp/src/uabase/uabasecpp/uanodeid.cpp