CVB++ 14.0
object_node.hpp
1#pragma once
2
3#include "../global.hpp"
4
5#include "opcua.hpp"
6#include "exception.hpp"
7
8#include "base_node.hpp"
9
10namespace Cvb
11{
12CVB_BEGIN_INLINE_NS
13
14template <>
15inline HandleGuard<OpcUa::ObjectNode>::HandleGuard(void * handle) noexcept
16 : HandleGuard<OpcUa::ObjectNode>(handle, [](void* handle)
17{
18 CVB_CALL_CAPI(ReleaseObject(handle));
19})
20{
21}
22namespace OpcUa
23{
24
36{
37public:
50 const std::uint16_t NameSpaceIndex, const Cvb::String & Name, const OpcUa::NodeID & Parent, const OpcUa::NodeID & TypeDefinition
51 )
52 {
53 std::function<CExports::CVOPCNODE(void)> maker = [&](void)
54 {
55 auto node = CExports::__CreateCVOPCObjectFromTypeNode(
56 static_cast<CExports::cvbuint16_t>(NameSpaceIndex), Name.c_str(), Parent.Handle(), TypeDefinition.Handle());
57 if (node)
58 return node;
60 };
61 HandleGuard<BaseNode> guard(maker());
62
63 if (!guard.Handle())
65
66 return ObjectNodePtr(new ObjectNode(std::move(guard)));
67 }
68protected:
69
70
71 explicit ObjectNode(OpcUa::BaseNode && node) noexcept
72 : OpcUa::BaseNode(std::move(node))
73 {
74 }
75
76
77};
78
79CVB_END_INLINE_NS
80}
81}
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
An OPCUA Object Node object. This is the "base" of many more complex node. However the defining featu...
Definition: object_node.hpp:36
static ObjectNodePtr CreateFromType(const std::uint16_t NameSpaceIndex, const Cvb::String &Name, const OpcUa::NodeID &Parent, const OpcUa::NodeID &TypeDefinition)
Creates a OPCUA object node with a given type definition.
Definition: object_node.hpp:49
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
std::shared_ptr< ObjectNode > ObjectNodePtr
Convenience shared pointer for ObjectNode.
Definition: opcua.hpp:75
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24