IDS peak genericC++ v1.13.0
Loading...
Searching...
No Matches
peak_enumeration_entry_node.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
13
15#include <peak/dll_interface/peak_dll_interface_util.hpp>
17
18#include <cstddef>
19#include <cstdint>
20#include <string>
21#include <type_traits>
22
23
24namespace peak
25{
26namespace core
27{
28namespace nodes
29{
30
37{
38public:
40 using NodeDataType = std::string;
41 using NodeHasRange = std::false_type;
42
44 ~EnumerationEntryNode() override = default;
49
60 bool IsSelfClearing() const;
61
71 std::string SymbolicValue() const;
72
74 std::string StringValue() const
75 {
76 return SymbolicValue();
77 }
78
88 int64_t Value() const;
89
91 int64_t NumericValue() const
92 {
93 return Value();
94 }
95
96private:
97 friend ClassCreator<EnumerationEntryNode>;
98 friend EnumerationNode;
100 PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap);
102};
103
104} /* namespace nodes */
105} /* namespace core */
106} /* namespace peak */
107
108/* Implementation */
109namespace peak
110{
111namespace core
112{
113namespace nodes
114{
115
117 PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap)
118 : Node(QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* nodeHandle) {
119 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_ToNode(enumerationEntryNodeHandle, nodeHandle);
120 }),
121 parentNodeMap)
122 , m_backendHandle(enumerationEntryNodeHandle)
123{}
124
126{
127 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isSelfClearing) {
128 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetIsSelfClearing(m_backendHandle, isSelfClearing);
129 }) > 0;
130}
131
132inline std::string EnumerationEntryNode::SymbolicValue() const
133{
134 return QueryStringFromCInterfaceFunction([&](char* symbolicValue, size_t* symbolicValueSize) {
136 m_backendHandle, symbolicValue, symbolicValueSize);
137 });
138}
139
140inline int64_t EnumerationEntryNode::Value() const
141{
142 return QueryNumericFromCInterfaceFunction<int64_t>([&](int64_t* value) {
143 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetValue(m_backendHandle, value);
144 });
145}
146
147} /* namespace nodes */
148} /* namespace core */
149} /* namespace peak */
EnumerationEntryNode()=delete
int64_t NumericValue() const
Returns the numeric value of the enum entry.
Definition peak_enumeration_entry_node.hpp:91
EnumerationEntryNode & operator=(const EnumerationEntryNode &other)=delete
std::string StringValue() const
Returns the symbolic value (i.e. name/string value) of the enum entry.
Definition peak_enumeration_entry_node.hpp:74
EnumerationEntryNode(EnumerationEntryNode &&other)=delete
static constexpr auto NodeType
Definition peak_enumeration_entry_node.hpp:39
bool IsSelfClearing() const
Checks whether the node is self clearing.
Definition peak_enumeration_entry_node.hpp:125
~EnumerationEntryNode() override=default
EnumerationEntryNode(const EnumerationEntryNode &other)=delete
EnumerationEntryNode & operator=(EnumerationEntryNode &&other)=delete
std::false_type NodeHasRange
Definition peak_enumeration_entry_node.hpp:41
std::string SymbolicValue() const
Returns the symbolic value (i.e. name/string value) of the enum entry.
Definition peak_enumeration_entry_node.hpp:132
std::string NodeDataType
Definition peak_enumeration_entry_node.hpp:40
int64_t Value() const
Returns the numeric value of the enum entry.
Definition peak_enumeration_entry_node.hpp:140
Represents a GenAPI enumeration node.
Definition peak_enumeration_node.hpp:40
Represents a GenAPI node.
Definition peak_node.hpp:128
@ EnumerationEntry
Definition peak_node.hpp:100
The "nodes" namespace contains all GenAPI node types.
Definition peak_boolean_node.hpp:26
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:34
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:33
PEAK_C_API PEAK_EnumerationEntryNode_ToNode(PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, PEAK_NODE_HANDLE *nodeHandle)
Casts the given enumeration entry node to a node.
struct PEAK_NODE * PEAK_NODE_HANDLE
Definition peak_backend.h:429
PEAK_C_API PEAK_EnumerationEntryNode_GetValue(PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, int64_t *value)
Asks the given enumeration entry node for its value.
int8_t PEAK_BOOL8
Definition peak_backend.h:43
PEAK_C_API PEAK_EnumerationEntryNode_GetSymbolicValue(PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, char *symbolicValue, size_t *symbolicValueSize)
Asks the given enumeration entry node for its symbolic value.
struct PEAK_ENUMERATION_ENTRY_NODE * PEAK_ENUMERATION_ENTRY_NODE_HANDLE
Definition peak_backend.h:465
PEAK_C_API PEAK_EnumerationEntryNode_GetIsSelfClearing(PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, PEAK_BOOL8 *isSelfClearing)
Asks the given enumeration entry node whether it is self clearing.
#define PEAK_C_ABI_PREFIX
Definition peak_dll_defines.h:16