IDS peak genericC++  v1.4.3
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;
67  std::string StringValue() const
68  {
69  return SymbolicValue();
70  }
80  int64_t Value() const;
82  int64_t NumericValue() const
83  {
84  return Value();
85  }
86 
87 private:
88  friend ClassCreator<EnumerationEntryNode>;
89  friend EnumerationNode;
91  PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap);
92  PEAK_ENUMERATION_ENTRY_NODE_HANDLE m_backendHandle;
93 };
94 
95 } /* namespace nodes */
96 } /* namespace core */
97 } /* namespace peak */
98 
99 /* Implementation */
100 namespace peak
101 {
102 namespace core
103 {
104 namespace nodes
105 {
106 
108  PEAK_ENUMERATION_ENTRY_NODE_HANDLE enumerationEntryNodeHandle, const std::weak_ptr<NodeMap>& parentNodeMap)
109  : Node(QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* nodeHandle) {
110  return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_ToNode(enumerationEntryNodeHandle, nodeHandle);
111  }),
112  parentNodeMap)
113  , m_backendHandle(enumerationEntryNodeHandle)
114 {}
115 
117 {
118  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isSelfClearing) {
119  return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetIsSelfClearing(m_backendHandle, isSelfClearing);
120  }) > 0;
121 }
122 
123 inline std::string EnumerationEntryNode::SymbolicValue() const
124 {
125  return QueryStringFromCInterfaceFunction([&](char* symbolicValue, size_t* symbolicValueSize) {
127  m_backendHandle, symbolicValue, symbolicValueSize);
128  });
129 }
130 
131 inline int64_t EnumerationEntryNode::Value() const
132 {
133  return QueryNumericFromCInterfaceFunction<int64_t>([&](int64_t* value) {
134  return PEAK_C_ABI_PREFIX PEAK_EnumerationEntryNode_GetValue(m_backendHandle, value);
135  });
136 }
137 
138 } /* namespace nodes */
139 } /* namespace core */
140 } /* 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:123
struct PEAK_NODE * PEAK_NODE_HANDLE
Definition: peak_backend.h:409
bool IsSelfClearing() const
Checks whether the node is self clearing.
Definition: peak_enumeration_entry_node.hpp:116
struct PEAK_ENUMERATION_ENTRY_NODE * PEAK_ENUMERATION_ENTRY_NODE_HANDLE
Definition: peak_backend.h:445
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:82
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:131
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:67