IDS peak genericC++  v1.7.0
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 
23 namespace peak
24 {
25 namespace core
26 {
27 namespace nodes
28 {
29 
34 class EnumerationEntryNode : public Node
35 {
36 public:
37  EnumerationEntryNode() = delete;
38  ~EnumerationEntryNode() override = default;
39  EnumerationEntryNode(const EnumerationEntryNode& other) = delete;
40  EnumerationEntryNode& operator=(const EnumerationEntryNode& other) = delete;
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 
90 private:
91  friend ClassCreator<EnumerationEntryNode>;
92  friend EnumerationNode;
94  PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap);
95  PEAK_ENUMERATION_ENTRY_NODE_HANDLE m_backendHandle;
96 };
97 
98 } /* namespace nodes */
99 } /* namespace core */
100 } /* namespace peak */
101 
102 /* Implementation */
103 namespace peak
104 {
105 namespace core
106 {
107 namespace 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 
126 inline std::string EnumerationEntryNode::SymbolicValue() const
127 {
128  return QueryStringFromCInterfaceFunction([&](char* symbolicValue, size_t* symbolicValueSize) {
130  m_backendHandle, symbolicValue, symbolicValueSize);
131  });
132 }
133 
134 inline 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:34
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.
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
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition: peak_dynamic_loader.h:32
std::string SymbolicValue() const
Returns the symbolic value (i.e. name/string value) of the enum entry.
Definition: peak_enumeration_entry_node.hpp:126
struct PEAK_NODE * PEAK_NODE_HANDLE
Definition: peak_backend.h:411
bool IsSelfClearing() const
Checks whether the node is self clearing.
Definition: peak_enumeration_entry_node.hpp:119
struct PEAK_ENUMERATION_ENTRY_NODE * PEAK_ENUMERATION_ENTRY_NODE_HANDLE
Definition: peak_backend.h:447
EnumerationEntryNode()=delete
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.
#define PEAK_C_ABI_PREFIX
Definition: peak_dll_defines.h:16
~EnumerationEntryNode() override=default
int64_t NumericValue() const
Returns the numeric value of the enum entry.
Definition: peak_enumeration_entry_node.hpp:85
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.
int64_t Value() const
Returns the numeric value of the enum entry.
Definition: peak_enumeration_entry_node.hpp:134
Represents a GenAPI node.
Definition: peak_node.hpp:121
EnumerationEntryNode & operator=(const EnumerationEntryNode &other)=delete
Represents a GenAPI enumeration node.
Definition: peak_enumeration_node.hpp:36
std::string StringValue() const
Returns the symbolic value (i.e. name/string value) of the enum entry.
Definition: peak_enumeration_entry_node.hpp:68