CVB++ 14.0
float_node.hpp
1
2#pragma once
3
4#include "../global.hpp"
5
6#include "opcua.hpp"
7#include "exception.hpp"
8
9#include "variable_node.hpp"
10
11namespace Cvb
12{
13CVB_BEGIN_INLINE_NS
14
15namespace OpcUa
16{
24{
25 friend class OpcUa::Client;
26 friend class OpcUa::Server;
27
28public:
29
45 static FloatNodePtr Create(std::uint16_t namespaceIndex, const Cvb::String & name, const OpcUa::NodeID & parentNodeID, double value)
46 {
47 std::function<CExports::CVOPCNODE(void)> maker = [&](void)
48 {
49 auto node = CExports::__CreateCVOPCFloatNode(static_cast<CExports::cvbuint16_t>(namespaceIndex), name.c_str(), parentNodeID.Handle(), CExports::CVOPC_VT_DataVariable, CExports::TCVOPCDataType::CVOPC_DT_Float, value);
50 if (node)
51 return node;
53 };
54 auto vnode(new VariableNode(std::move(*OpcUa::BaseNode::CreateHelper(maker))));
55 FloatNodePtr fnode = FloatNodePtr(new FloatNode(std::move(*vnode)));
56 if (!fnode)
58 return fnode;
59 }
60
66 double Value() const
67 {
69 }
70
76 void SetValue(double value)
77 {
79 }
80
81protected:
83 explicit FloatNode(VariableNode && variableNode) noexcept
84 : VariableNode(std::move(variableNode))
85 {
86 }
88};
89}
90
91
92CVB_END_INLINE_NS
93
94}
void SetAttributeAsFloat(AttributeID attributeID, double value)
Set specific Information about a Opcua::BaseNode.
Definition: decl_base_node.hpp:209
double GetAttributeAsFloat(AttributeID attributeID) const
Return specific Information about a Opcua::BaseNode.
Definition: decl_base_node.hpp:193
An OPCUA Client object. This class handles the client side of the OPCUA client/server interaction.
Definition: decl_client.hpp:35
A FloatNode object provides an interface for storage and manipulation of floating point numbers.
Definition: float_node.hpp:24
static FloatNodePtr Create(std::uint16_t namespaceIndex, const Cvb::String &name, const OpcUa::NodeID &parentNodeID, double value)
Creates an OPCUA Variable with the specified parameter, data type and set its value as double.
Definition: float_node.hpp:45
void SetValue(double value)
Sets value of the node to the given value.
Definition: float_node.hpp:76
double Value() const
Returns the saved value of the node.
Definition: float_node.hpp:66
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
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< FloatNode > FloatNodePtr
Convenience shared pointer for FloatNode.
Definition: opcua.hpp:90
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24