CVB++ 14.0
float_reg_node.hpp
1#pragma once
2
3#include "../global.hpp"
4
5#include "float_base_node.hpp"
6
8#include "_detail/iconfigurable_int_reg_node.hpp"
10
11namespace Cvb
12{
13 CVB_BEGIN_INLINE_NS
14 namespace GevServer
15 {
17
20 : public FloatBaseNode
22 , public Private::IConfigurableIntRegNode
24 {
25 public:
26 FloatRegNode(HandleGuard<Node>&& guard) noexcept : FloatBaseNode(std::move(guard)) {}
27
32 {
33 return static_cast<GenApi::AccessMode>(GetInfoAsInt(NodeInfo::AccessMode));
34 }
35
45 {
46 SetInfoAsInt(NodeInfo::AccessMode, static_cast<std::int64_t>(value));
47 }
48
50
54 std::int64_t Address() const { return GetInfoAsInt(NodeInfo::RegisterAddress); }
55
74 {
75 return GetDependentNodes<IntegerBaseNode>(NodeList::Addresses);
76 }
77
82 {
83 return static_cast<GenApi::CacheMode>(GetInfoAsInt(NodeInfo::CachingMode));
84 }
85
95 {
96 SetInfoAsInt(NodeInfo::CachingMode, static_cast<std::int64_t>(value));
97 }
98
109 std::vector<NodePtr> InvalidatorNodes() const noexcept { return GetDependentNodes<Node>(NodeList::Invalidator); }
110
114 bool IsSigned() const { return GetInfoAsInt(NodeInfo::Sign) != 0; }
115
124 void SetIsSigned(const bool& value) { SetInfoAsInt(NodeInfo::Sign, value ? 1 : 0); }
125
127
131 std::int64_t Length() const { return GetInfoAsInt(NodeInfo::RegisterLength); }
132
140 template <class Rep, class Period> std::chrono::duration<Rep, Period> PollingTime() const
141 {
142 auto timespan = GetInfoAsInt(NodeInfo::PollingTime);
143 if (timespan > 0)
144 return std::chrono::duration<Rep, Period>(timespan);
145 else
147 }
148
160 template <class Rep, class Period> void SetPollingTime(const std::chrono::duration<Rep, Period>& timespan)
161 {
163 SetInfoAsInt(NodeInfo::PollingTime, -1);
164 else
165 SetInfoAsInt(NodeInfo::PollingTime, std::chrono::duration_cast<std::chrono::milliseconds>(timespan).count());
166 }
167 };
168 }
169 CVB_END_INLINE_NS
170}
Represents a floating point number.
Definition: float_base_node.hpp:24
Floating point value register.
Definition: float_reg_node.hpp:24
std::vector< IntegerBaseNodePtr > AddressNodes() const
Gets the collection of nodes which define the nodes address.
Definition: float_reg_node.hpp:73
void SetIsSigned(const bool &value)
Sets whether this integer register is signed.
Definition: float_reg_node.hpp:124
void SetPollingTime(const std::chrono::duration< Rep, Period > &timespan)
Sets the polling time of this value.
Definition: float_reg_node.hpp:160
bool IsSigned() const
Gets whether this integer register is signed.
Definition: float_reg_node.hpp:114
void SetCacheMode(const Cvb::GenApi::CacheMode &value)
Sets the caching mode of this register node.
Definition: float_reg_node.hpp:94
GenApi::CacheMode CacheMode() const override
Gets the caching mode of this register node.
Definition: float_reg_node.hpp:81
GenApi::AccessMode AccessMode() const override
Gets the GenApi::AccessMode of this node.
Definition: float_reg_node.hpp:31
std::int64_t Length() const
Gets the number of bytes the register occupies.
Definition: float_reg_node.hpp:131
std::int64_t Address() const
Gets the registers address.
Definition: float_reg_node.hpp:54
void SetAccessMode(const GenApi::AccessMode &value)
Sets the GenApi::AccessMode of this node.
Definition: float_reg_node.hpp:44
std::vector< NodePtr > InvalidatorNodes() const noexcept
Gets the collection of nodes which, when changed, invalidate this node's cache.
Definition: float_reg_node.hpp:109
std::chrono::duration< Rep, Period > PollingTime() const
Gets the polling time of this value.
Definition: float_reg_node.hpp:140
CacheMode
Defines how the value is cached.
Definition: genapi.hpp:220
AccessMode
Access possibility of the node.
Definition: genapi.hpp:185
@ AccessMode
Gets the access mode of the node.
@ PollingTime
Gets the polling time in ms.
@ Sign
Accesses the signed or unsigned state of integer registers.
@ CachingMode
Gets the caching mode.
@ RegisterAddress
Gets the current address of the register (can change).
@ RegisterLength
Gets the register nodes length in bytes.
@ Addresses
Node accesses the register address nodes (not constants).
@ Invalidator
Node accesses the invalidator nodes.
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24