CVB++ 14.0
string_node.hpp
1#pragma once
2
3#include "../global.hpp"
4
5#include "opcua.hpp"
6#include "exception.hpp"
7
8#include "variable_node.hpp"
9
10namespace Cvb
11{
12
13CVB_BEGIN_INLINE_NS
14
15namespace OpcUa
16{
25{
26 friend class Client;
27 friend class Server;
28
29public:
30
46 static StringNodePtr Create(std::uint16_t namespaceIndex, const Cvb::String & name, const OpcUa::NodeID & parentNodeID, Cvb::String value)
47 {
48 std::function<CExports::CVOPCNODE(void)> maker = [&](void)
49 {
50 auto node = CExports::__CreateCVOPCStringNode(static_cast<CExports::cvbuint16_t>(namespaceIndex), name.c_str(), parentNodeID.Handle(), CExports::CVOPC_VT_DataVariable, CExports::TCVOPCDataType::CVOPC_DT_String, value.c_str());
51 if (node)
52 return node;
54 };
55 auto vnode(new VariableNode(std::move(*OpcUa::BaseNode::CreateHelper(maker))));
56 auto fnode = StringNodePtr(new StringNode(std::move(*vnode)));
57 if (!fnode)
59 return fnode;
60 }
61
68 {
70 }
71
77 void SetValue(const Cvb::String & value)
78 {
80 }
81
82protected:
84 explicit StringNode(VariableNode && variableNode) noexcept
85 : VariableNode(std::move(variableNode))
86 {
87 }
89};
90}
91
92
93CVB_END_INLINE_NS
94
95}
String GetAttributeAsString(AttributeID attributeID) const
Return specific Information about a Opcua::BaseNode.
Definition: decl_base_node.hpp:224
void SetAttributeAsString(AttributeID attributeID, const String &value)
Set specific Information about a Opcua::BaseNode.
Definition: decl_base_node.hpp:251
An OPCUA Client object. This class handles the client side of the OPCUA client/server interaction.
Definition: decl_client.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
void * Handle() const noexcept
Return the C-API handle.
Definition: node_id.hpp:171
Special runtime exception to carry a native error code.
Definition: exception.hpp:25
An OPCUA server object.
Definition: decl_server.hpp:34
A node object with string values, provides an interface for storage and manipulation of strings (defa...
Definition: string_node.hpp:25
Cvb::String Value() const
Returns the saved value of the node.
Definition: string_node.hpp:67
static StringNodePtr Create(std::uint16_t namespaceIndex, const Cvb::String &name, const OpcUa::NodeID &parentNodeID, Cvb::String value)
Creates an OPCUA Variable with the specified parameter, data type and set its value as astring.
Definition: string_node.hpp:46
void SetValue(const Cvb::String &value)
Set value of the node to the given value.
Definition: string_node.hpp:77
An OPCUA VariableNode object. It handles the data modeling acording to the OPCUA specification.
Definition: variable_node.hpp:26
const int CVB_ERROR
Generic unspecified error.
Definition: exception.hpp:24
@ Value
Value of the node (VariableNode (See OpcUa::DataType))
std::shared_ptr< StringNode > StringNodePtr
Convenience shared pointer for StringNode.
Definition: opcua.hpp:95
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24