5#include "../global.hpp"
8#include "exception.hpp"
16inline 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));
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));
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_;
269inline std::uint32_t NodeID::Identifier<std::uint32_t>()
const
271 return NumericIdentifier();
280inline String NodeID::Identifier<String>()
const
282 return StringIdentifier();
Special runtime exception to carry a native error code.
Definition: exception.hpp:139
An OPCUA BaseNode. This is the base for all other node classes. For instantiation of a specific node ...
Definition: decl_base_node.hpp:35
An OPCUA NodeID object. NodeIDs provide a unique identifier for OPCUA nodes, i.e. they help with node...
Definition: node_id.hpp:38
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
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
std::string ExpandedText() const
Returns expanded text of the node id.
Definition: node_id.hpp:98
std::uint16_t NamespaceIndex() const
Returns namespace index.
Definition: node_id.hpp:82
static NodeIDPtr Create(Namespace0NodeID id)
Creates an id based on a predefined Namespace0 node id.
Definition: node_id.hpp:48
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
void * Handle() const noexcept
Return the C-API handle.
Definition: node_id.hpp:171
NodeIDType Type() const
Returns type of the node id.
Definition: node_id.hpp:118
Special runtime exception to carry a native error code.
Definition: exception.hpp:25
const int CVB_ERROR
Generic unspecified error.
Definition: exception.hpp:24
const int CVB_NOTSUPPORTED
A certain feature is not supported.
Definition: exception.hpp:60
@ NodeID
NodeID of the node (BaseNode (integer, See OpcUa::DataType))
NodeIDType
Describes the representation of a OpcUa::NodeID.
Definition: opcua.hpp:125
@ String
String representation of NodeID.
@ Numeric
Numeric representation of NodeID.
Namespace0NodeID
Lists "Namespace0" node ids Namespace0 node ids are a collection of mandatory and common nodeIDs....
Definition: opcua.hpp:316
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
char Char
Character type for wide characters or unicode characters.
Definition: string.hpp:59
std::string String
String for wide characters or unicode characters.
Definition: string.hpp:45