IDS peak genericC++ v1.7.3
Loading...
Searching...
No Matches
peak_enumeration_entry_node.hpp
Go to the documentation of this file.
1
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
22
23namespace peak
24{
25namespace core
26{
27namespace nodes
28{
29
35{
36public:
38 ~EnumerationEntryNode() override = default;
43
54 bool IsSelfClearing() const;
55
65 std::string SymbolicValue() const;
66
68 std::string StringValue() const
69 {
70 return SymbolicValue();
71 }
72
82 int64_t Value() const;
83
85 int64_t NumericValue() const
86 {
87 return Value();
88 }
89
90private:
91 friend ClassCreator<EnumerationEntryNode>;
92 friend EnumerationNode;
94 PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap);
96};
97
98} /* namespace nodes */
99} /* namespace core */
100} /* namespace peak */
101
102/* Implementation */
103namespace peak
104{
105namespace core
106{
107namespace nodes
108{
109
111 PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap)
112 : Node(QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* nodeHandle) {
113 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_ToNode(enumerationEntryNodeHandle, nodeHandle);
114 }),
115 parentNodeMap)
116 , m_backendHandle(enumerationEntryNodeHandle)
117{}
118
120{
121 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isSelfClearing) {
122 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetIsSelfClearing(m_backendHandle, isSelfClearing);
123 }) > 0;
124}
125
126inline std::string EnumerationEntryNode::SymbolicValue() const
127{
128 return QueryStringFromCInterfaceFunction([&](char* symbolicValue, size_t* symbolicValueSize) {
130 m_backendHandle, symbolicValue, symbolicValueSize);
131 });
132}
133
134inline int64_t EnumerationEntryNode::Value() const
135{
136 return QueryNumericFromCInterfaceFunction<int64_t>([&](int64_t* value) {
137 return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetValue(m_backendHandle, value);
138 });
139}
140
141} /* namespace nodes */
142} /* namespace core */
143} /* namespace peak */
Represents a GenAPI enumeration entry node.
Definition peak_enumeration_entry_node.hpp:35
EnumerationEntryNode()=delete
int64_t NumericValue() const
Returns the numeric value of the enum entry.
Definition peak_enumeration_entry_node.hpp:85
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:68
EnumerationEntryNode(EnumerationEntryNode &&other)=delete
bool IsSelfClearing() const
Checks whether the node is self clearing.
Definition peak_enumeration_entry_node.hpp:119
~EnumerationEntryNode() override=default
EnumerationEntryNode(const EnumerationEntryNode &other)=delete
EnumerationEntryNode & operator=(EnumerationEntryNode &&other)=delete
std::string SymbolicValue() const
Returns the symbolic value (i.e. name/string value) of the enum entry.
Definition peak_enumeration_entry_node.hpp:126
int64_t Value() const
Returns the numeric value of the enum entry.
Definition peak_enumeration_entry_node.hpp:134
Represents a GenAPI enumeration node.
Definition peak_enumeration_node.hpp:37
Represents a GenAPI node.
Definition peak_node.hpp:122
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:32
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:411
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:26
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:447
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