CVB++ 15.0
enum_entry_node.hpp
1#pragma once
2
3#include "../global.hpp"
4
5#include "selector_node.hpp"
6
7namespace Cvb
8{
9 CVB_BEGIN_INLINE_NS
10 namespace GevServer
11 {
13
17 class EnumEntryNode : public ValueNode
18 {
19 public:
20 explicit EnumEntryNode(HandleGuard<Node> &&guard)
21 : ValueNode(std::move(guard))
22 {
23 }
24
35 static EnumEntryNodePtr Create(const String &name, const GevServer::Namespace &nameSpace)
36 {
37 String okName = EnsureNodeNameOnly(name);
38 return std::make_shared<EnumEntryNode>(HandleGuard<Node>(
39 CreateGSEnumEntryNodeTyped(okName.data(), static_cast<CExports::TGSNamespace>(nameSpace))));
40 }
41
56 static EnumEntryNodePtr Create(const String &name)
57 {
58 return Create(ParseName(name), ParseNamespace(name));
59 }
60
66 {
68 }
69
74 GenApi::CacheMode CacheMode() const noexcept override
75 {
77 }
78
82 bool IsStreamable() const override
83 {
84 return false;
85 }
86
90 [[noreturn]] void SetIsStreamable(const std::int64_t & /*value*/) override
91 {
92 throw std::runtime_error("EnumEntry nodes cannot be streamed");
93 }
94
99 template <class Rep, class Period>
104
107 {
108 return GetInfoAsInt(NodeInfo::Value);
109 }
110
112 void SetNumericValue(const std::int64_t &value)
113 {
114 SetInfoAsInt(NodeInfo::Value, value);
115 }
116
119 {
120 return GetInfoAsString(NodeInfo::Value);
121 }
122
124 void SetSymbolicValue(const String &value)
125 {
126 SetInfo(NodeInfo::Value, value);
127 }
128
133 void FromString(const String & /*value*/) override
134 {
135 throw std::runtime_error("Symbolic values cannot be set as value");
136 }
137
142 String ToString() const override
143 {
144 return SymbolicValue();
145 }
146 };
147 } // namespace GevServer
148 CVB_END_INLINE_NS
149} // namespace Cvb
void SetNumericValue(const std::int64_t &value)
Sets the numeric value of this entry.
Definition enum_entry_node.hpp:112
void SetSymbolicValue(const String &value)
Sets the symbolic value of this entity.
Definition enum_entry_node.hpp:124
void FromString(const String &) override
Not supported.
Definition enum_entry_node.hpp:133
bool IsStreamable() const override
EnumEntry nodes are never streamable.
Definition enum_entry_node.hpp:82
static EnumEntryNodePtr Create(const String &name)
Creates a new EnumEntryNode with the given name .
Definition enum_entry_node.hpp:56
GenApi::CacheMode CacheMode() const noexcept override
Nothing to cache here.
Definition enum_entry_node.hpp:74
void SetIsStreamable(const std::int64_t &) override
EnumEntry nodes are never streamable.
Definition enum_entry_node.hpp:90
GenApi::AccessMode AccessMode() const override
Enum entries are always read only.
Definition enum_entry_node.hpp:65
static EnumEntryNodePtr Create(const String &name, const GevServer::Namespace &nameSpace)
Creates a new EnumEntryNode with the given name and nameSpace .
Definition enum_entry_node.hpp:35
std::int64_t NumericValue() const
Gets the numeric value of this entry.
Definition enum_entry_node.hpp:106
String ToString() const override
Returns SymbolicValue.
Definition enum_entry_node.hpp:142
String SymbolicValue() const
Gets the symbolic value of this entry.
Definition enum_entry_node.hpp:118
std::chrono::duration< Rep, Period > PollingTime() const
Nothing to poll.
Definition enum_entry_node.hpp:100
static GevServer::Namespace ParseNamespace(const String &name)
Gets the Namespace from the given name .
Definition decl_node.hpp:591
static String EnsureNodeNameOnly(const String &name)
Throws if the given name has a namespace prefix.
Definition decl_node.hpp:564
static String ParseName(const String &name)
Gets the name part of the given node name .
Definition decl_node.hpp:611
T make_shared(T... args)
T move(T... args)
CacheMode
Defines how the value is cached.
Definition genapi.hpp:218
@ NoCache
No caching used.
Definition genapi.hpp:220
AccessMode
Access possibility of the node.
Definition genapi.hpp:183
@ ReadOnly
Node can only be read.
Definition genapi.hpp:209
Describes a GenICam Pixel Format Naming Convention (PFNC) compatible image memory buffer with possibl...
Definition decl_int_swiss_knife_node.hpp:11
Namespace
The possible name spaces a node can be in.
Definition gevserver.hpp:147
std::shared_ptr< EnumEntryNode > EnumEntryNodePtr
Convenience shared pointer for EnumEntryNode.
Definition gevserver.hpp:100
@ Value
Accesses the value configuration.
Definition gevserver.hpp:210
@ String
Node is a string node (no reg).
Definition gevserver.hpp:168
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17