IDS peak genericC++ v1.11.1
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
36{
37public:
39 using NodeDataType = std::string;
40 using NodeHasRange = std::false_type;
41
43 ~EnumerationEntryNode() override = default;
48
59 bool IsSelfClearing() const;
60
70 std::string SymbolicValue() const;
71
73 std::string StringValue() const
74 {
75 return SymbolicValue();
76 }
77
87 int64_t Value() const;
88
90 int64_t NumericValue() const
91 {
92 return Value();
93 }
94
95private:
96 friend ClassCreator<EnumerationEntryNode>;
97 friend EnumerationNode;
99 PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap);
101};
102
103} /* namespace nodes */
104} /* namespace core */
105} /* namespace peak */
106
107/* Implementation */
108namespace peak
109{
110namespace core
111{
112namespace nodes
113{
114
116 PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap)
117 : Node(QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* nodeHandle) {
118 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_ToNode(enumerationEntryNodeHandle, nodeHandle);
119 }),
120 parentNodeMap)
121 , m_backendHandle(enumerationEntryNodeHandle)
122{}
123
125{
126 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isSelfClearing) {
127 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetIsSelfClearing(m_backendHandle, isSelfClearing);
128 }) > 0;
129}
130
131inline std::string EnumerationEntryNode::SymbolicValue() const
132{
133 return QueryStringFromCInterfaceFunction([&](char* symbolicValue, size_t* symbolicValueSize) {
135 m_backendHandle, symbolicValue, symbolicValueSize);
136 });
137}
138
139inline int64_t EnumerationEntryNode::Value() const
140{
141 return QueryNumericFromCInterfaceFunction<int64_t>([&](int64_t* value) {
142 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetValue(m_backendHandle, value);
143 });
144}
145
146} /* namespace nodes */
147} /* namespace core */
148} /* namespace peak */
EnumerationEntryNode()=delete
int64_t NumericValue() const
Returns the numeric value of the enum entry.
Definition peak_enumeration_entry_node.hpp:90
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:73
EnumerationEntryNode(EnumerationEntryNode &&other)=delete
static constexpr auto NodeType
Definition peak_enumeration_entry_node.hpp:38
bool IsSelfClearing() const
Checks whether the node is self clearing.
Definition peak_enumeration_entry_node.hpp:124
~EnumerationEntryNode() override=default
EnumerationEntryNode(const EnumerationEntryNode &other)=delete
EnumerationEntryNode & operator=(EnumerationEntryNode &&other)=delete
std::false_type NodeHasRange
Definition peak_enumeration_entry_node.hpp:40
std::string SymbolicValue() const
Returns the symbolic value (i.e. name/string value) of the enum entry.
Definition peak_enumeration_entry_node.hpp:131
std::string NodeDataType
Definition peak_enumeration_entry_node.hpp:39
int64_t Value() const
Returns the numeric value of the enum entry.
Definition peak_enumeration_entry_node.hpp:139
Represents a GenAPI enumeration node.
Definition peak_enumeration_node.hpp:39
Represents a GenAPI node.
Definition peak_node.hpp:122
The "nodes" namespace contains all GenAPI node types.
Definition peak_boolean_node.hpp:26
@ EnumerationEntry
Definition peak_node.hpp:96
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:31
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