File Information
Library: IoT/OPC
Package: OPCCore
Header: IoT/OPC/NodeId.h
Description
This class represents an OPC-UA Node Identifier.
In OPC-UA, node identifiers can take different form. Generally, they consist of a namespace index part and an identifier part. The namespace index is an integer, representing an index into the client's namespace table. The identifier can be an integer, a string, a GUID/UUID or an opaque byte string.
A Node ID can also be represented as a string.
The string consists of an optional namespace part (if omitted, corresponds to namespace index 0) and an identifier part. The namespace part can be specified as namespace index (e.g., "ns=0") or as namespace URI (e.g., "nsu=http://opcfoundation.org/UA/").
Namespace part and identifier are delimited with a semicolon.
The identifier can be specified as numeric ID (e.g., "i=2253"), string (e.g., "s=Server"), UUID/GUID in common 8-4-4-4-12 grouped hexadecimal representation (e.g., "g=bb2ec8a2-6b02-44a3-927e-a54182f84b58") or opaque byte string, Base64-encoded (e.g., "b=U2VydmVy").
Valid examples for NodeID strings are:
- "ns=0;i=2253"
- "i=2253" (implies namespace ID 0)
- "nsu=http://opcfoundation.org/UA/;i=2253"
- "ns=0;s=Server"
Member Summary
Member Functions: formatNodeType, guidIdentifier, internal, isNull, namespaceIndex, numericIdentifier, opaqueIdentifier, operator !=, operator =, operator ==, parse, stringIdentifier, toString, type
Enumerations
Type
NODEID_NUMERIC = 0
NODEID_STRING = 3
NODEID_GUID = 4
NODEID_OPAQUE = 5
Constructors
NodeId
NodeId();
Creates an empty NodeId.
NodeId
explicit NodeId(
const std::string & nodeIdString
);
Creates the NodeId from a string.
NodeId
explicit NodeId(
const UA_NodeId & uaNodeId
);
Creates the NodeId from an open62541 UA_NodeId structure, which it takes ownership of.
NodeId
NodeId(
const NodeId & other
);
Creates the NodeId by copying another one.
NodeId
Creates the NodeId by moving another one.
NodeId
NodeId(
const std::string & nodeIdString,
const std::vector < std::string > & namespaces
);
Creates the NodeId from a string that may contain a namespace URI instead of a namespace index.
NodeId
NodeId(
Poco::UInt16 namespaceIndex,
Poco::UInt32 numericIdentifier
);
Creates the NodeId from a namespaceIndex and a numeric identifier.
NodeId
NodeId(
Poco::UInt16 namespaceIndex,
const std::string & utf8StringIdentifier
);
Creates the NodeId from a namespaceIndex and a string identifier.
NodeId
NodeId(
Poco::UInt16 namespaceIndex,
const Poco::UUID & guidIdentifier
);
Creates the NodeId from a namespaceIndex and a GUID/UUID.
NodeId
NodeId(
Poco::UInt16 namespaceIndex,
const std::vector < char > & opaqueIdentifier
);
Creates the NodeId from a namespaceIndex and a byte string.
Destructor
~NodeId
~NodeId();
Destroys the NodeId.
Member Functions
guidIdentifier
Poco::UUID guidIdentifier() const;
If the type is NODEID_GUID, returns the GUID identifier.
Otherwise, throws a Poco::InvalidAccessException.
internal
const UA_NodeId * internal() const;
Returns a pointer to the internal UA_NodeId.
isNull
bool isNull() const;
Returns true if the NodeId is empty or null.
namespaceIndex
Poco::UInt16 namespaceIndex() const;
Returns the namespace index.
numericIdentifier
Poco::UInt32 numericIdentifier() const;
If the type is NODEID_NUMERIC, returns the numeric identifier.
Otherwise, throws a Poco::InvalidAccessException.
opaqueIdentifier
std::vector < char > opaqueIdentifier() const;
If the type is NODEID_OPAQUE returns the GUID identifier.
Otherwise, throws a Poco::InvalidAccessException.
operator !=
bool operator != (
const NodeId & other
) const;
Comparison for inequality.
operator =
NodeId & operator = (
const NodeId & other
);
Assignment operator.
operator =
NodeId & operator = (
NodeId && other
);
Assignment operator.
operator ==
bool operator == (
const NodeId & other
) const;
Comparison for equality.
parse
void parse(
const std::string & nodeIdString
);
Parses the NodeId from its string representation.
parse
void parse(
const std::string & nodeIdString,
const std::vector < std::string > & namespaces
);
Parses the NodeId from its string representation.
The namespace may be specified as URI instead of index.
stringIdentifier
std::string stringIdentifier() const;
If the type is NODEID_STRING, returns the string identifier.
Otherwise, throws a Poco::InvalidAccessException.
toString
std::string toString() const;
Returns a string representation of the NodeId.
toString
std::string toString(
const std::vector < std::string > & namespaces
) const;
Returns a string representation of the NodeId, with the namespace specified as URI instead of an index.
type
Type type() const;
Returns the type of the NodeId.
formatNodeType
void formatNodeType(
std::string & result
) const;