5 #include "../global.hpp" 8 #include "exception.hpp" 16 inline HandleGuard<OpcUa::NodeID>::HandleGuard(
void * handle) noexcept
17 : HandleGuard<OpcUa::NodeID>(handle, [](
void* handle)
19 CVB_CALL_CAPI(ReleaseObject(handle));
84 CExports::cvbuint16_t namesapceIndex = 0;
85 int ret = CVB_CALL_CAPI(CVOPCGetNamespaceIndex(
Handle(), namesapceIndex));
88 return static_cast<std::uint16_t>(namesapceIndex);
101 int ret = CVB_CALL_CAPI(CVOPCGetNodeIdExpandedText(
Handle(), reinterpret_cast<char*>(0), bufferSize));
106 ret = CVB_CALL_CAPI(CVOPCGetNodeIdExpandedText(
Handle(), buffer.data(), bufferSize));
120 CExports::TCVOPCNodeIdType type;
121 int ret = CVB_CALL_CAPI(CVOPCIdType(
Handle(), type));
125 return static_cast<NodeIDType>(type);
140 ret = CVB_CALL_CAPI(CVOPCNodeIdAsInteger(
Handle(), retVal));
145 ret = CVB_CALL_CAPI(CVOPCNodeIdAsStringTyped(
Handle(), reinterpret_cast<Cvb::Char*>(
nullptr), size));
151 ret = CVB_CALL_CAPI(CVOPCNodeIdAsStringTyped(
Handle(), data.data(), size));
152 retVal = T(data.data());
173 return handle_.Handle();
178 static NodeIDPtr FromHandle(
void * handle)
186 HandleGuard<NodeID> guard(CExports::CreateCVOPCNodeId(static_cast<CExports::TCVOpc_NS0_NodeId>(
id)));
197 HandleGuard<NodeID> guard(CExports::CreateCVOPCNodeIdNumeric(namespaceIndex, identifier));
208 HandleGuard<NodeID> guard(CExports::CreateCVOPCNodeIdTyped(namespaceIndex, identifier.c_str()));
216 explicit NodeID(HandleGuard<NodeID> && guard) noexcept
217 : handle_(std::move(guard))
228 void NativeCall(
std::function<CExports::cvbres_t()> fn)
const 235 String StringIdentifier()
const 238 int ret = CVB_CALL_CAPI(CVOPCNodeIdAsStringTyped(
Handle(), reinterpret_cast<Char*>(0), bufferSize));
240 throw OpcUaException(ret);
243 ret = CVB_CALL_CAPI(CVOPCNodeIdAsStringTyped(
Handle(), buffer.data(), bufferSize));
245 throw OpcUaException(ret);
247 return String(buffer.data());
252 CExports::cvbuint32_t tmpIdentifier = 0;
253 int ret = CVB_CALL_CAPI(CVOPCNodeIdAsInteger(
Handle(), tmpIdentifier));
255 throw OpcUaException(ret);
256 return tmpIdentifier;
259 HandleGuard<NodeID> handle_;
269 inline std::uint32_t NodeID::Identifier<std::uint32_t>()
const 271 return NumericIdentifier();
280 inline String NodeID::Identifier<String>()
const 282 return StringIdentifier();
NodeIDType
Describes the representation of a OpcUa::NodeID.
Definition: opcua.hpp:124
Namespace0NodeID
Lists "Namespace0" node ids Namespace0 node ids are a collection of mandatory and common nodeIDs....
Definition: opcua.hpp:315
T Identifier() const
Returns the id of the node id. For determining the type of the id, see OpcUa::NodeID::Type().
Definition: node_id.hpp:134
An OPCUA NodeID object. NodeIDs provide a unique identifier for OPCUA nodes, i.e. they help with node...
Definition: node_id.hpp:37
std::uint16_t NamespaceIndex() const
Returns namespace index.
Definition: node_id.hpp:82
const int CVB_ERROR
Generic unspecified error.
Definition: exception.hpp:24
Root namespace for the Image Manager interface.
Definition: version.hpp:11
NodeIDType Type() const
Returns type of the node id.
Definition: node_id.hpp:118
static NodeIDPtr Create(std::uint16_t namespaceIndex, const Cvb::String &identifier)
Creates a NodeID based on a namespace index and an identifier.
Definition: node_id.hpp:72
const int CVB_NOTSUPPORTED
A certain feature is not supported.
Definition: exception.hpp:60
NodeID of the node (BaseNode (integer, See OpcUa::DataType))
void * Handle() const noexcept
Return the C-API handle.
Definition: node_id.hpp:171
std::string ExpandedText() const
Returns expanded text of the node id.
Definition: node_id.hpp:98
static NodeIDPtr Create(Namespace0NodeID id)
Creates an id based on a predefined Namespace0 node id.
Definition: node_id.hpp:48
Special runtime exception to carry a native error code.
Definition: exception.hpp:137
Special runtime exception to carry a native error code.
Definition: exception.hpp:24
String representation of NodeID.
static NodeIDPtr Create(std::uint16_t namespaceIndex, std::uint32_t identifier)
Creates an id based on a namespace id and an identifier.
Definition: node_id.hpp:60
An OPCUA BaseNode. This is the base for all other node classes. For instantiation of a specific node ...
Definition: decl_base_node.hpp:34
Numeric representation of NodeID.