int_reg_node.hpp
1 #pragma once
2 
3 #include "../global.hpp"
4 
5 #include "integer_base_node.hpp"
6 
8 #include "_detail/iconfigurable_int_reg_node.hpp"
10 
11 namespace Cvb
12 {
13 CVB_BEGIN_INLINE_NS
14 namespace GevServer
15 {
17 
20  : public IntegerBaseNode
22  , public Private::IConfigurableIntRegNode
24 {
25 public:
26  IntRegNode(HandleGuard<Node> &&guard) noexcept : IntegerBaseNode(std::move(guard)) {}
27 
31  GenApi::AccessMode AccessMode() const override
32  {
33  return static_cast<GenApi::AccessMode>(GetInfoAsInt(NodeInfo::AccessMode));
34  }
35 
44  void SetAccessMode(const GenApi::AccessMode &value)
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 
81  GenApi::CacheMode CacheMode() const override
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 }
void SetCacheMode(const Cvb::GenApi::CacheMode &value)
Sets the caching mode of this register node.
Definition: int_reg_node.hpp:94
Accesses the signed or unsigned state of integer registers.
Gets the current address of the register (can change).
Root namespace for the Image Manager interface.
Definition: version.hpp:11
Node accesses the register address nodes (not constants).
Node accesses the invalidator nodes.
Gets the register nodes length in bytes.
void SetAccessMode(const GenApi::AccessMode &value)
Sets the GenApi::AccessMode of this node.
Definition: int_reg_node.hpp:44
Integer value register.
Definition: int_reg_node.hpp:19
std::int64_t Length() const
Gets the number of bytes the register occupies.
Definition: int_reg_node.hpp:131
void SetPollingTime(const std::chrono::duration< Rep, Period > &timespan)
Sets the polling time of this value.
Definition: int_reg_node.hpp:160
std::vector< IntegerBaseNodePtr > AddressNodes() const
Gets the collection of nodes which define the nodes address.
Definition: int_reg_node.hpp:73
STL class.
void SetIsSigned(const bool &value)
Sets whether this integer register is signed.
Definition: int_reg_node.hpp:124
Gets the access mode of the node.
std::chrono::duration< Rep, Period > PollingTime() const
Gets the polling time of this value.
Definition: int_reg_node.hpp:140
GenApi::AccessMode AccessMode() const override
Gets the GenApi::AccessMode of this node.
Definition: int_reg_node.hpp:31
Represents an integer number.
Definition: integer_base_node.hpp:19
GenApi::CacheMode CacheMode() const override
Gets the caching mode of this register node.
Definition: int_reg_node.hpp:81
CacheMode
Defines how the value is cached.
Definition: genapi.hpp:219
std::int64_t Address() const
Gets the registers address.
Definition: int_reg_node.hpp:54
AccessMode
Access possibility of the node.
Definition: genapi.hpp:184
Gets the polling time in ms.
std::vector< NodePtr > InvalidatorNodes() const noexcept
Gets the collection of nodes which, when changed, invalidate this node's cache.
Definition: int_reg_node.hpp:109
bool IsSigned() const
Gets whether this integer register is signed.
Definition: int_reg_node.hpp:114