IDS peak AFL v2.0.2
Loading...
Searching...
No Matches
peak_common_metadata_traits.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
15#include <array>
16#include <cstdint>
17
18namespace peak
19{
20namespace common
21{
22namespace detail
23{
25
26template <MetadataKey metadataKey>
27struct MetadataKeyTraits;
28
30
34template <>
35struct MetadataKeyTraits<MetadataKey::DeviceTimestamp>
36{
37 using type = uint64_t;
38
42 static constexpr const char* Name()
43 {
44 return "DeviceTimestamp";
45 }
46};
47
51template <>
52struct MetadataKeyTraits<MetadataKey::DeviceFrameID>
53{
54 using type = uint64_t;
55
59 static constexpr const char* Name()
60 {
61 return "DeviceFrameID";
62 }
63};
64
68template <>
69struct MetadataKeyTraits<MetadataKey::BinningHorizontal>
70{
71 using type = uint64_t;
72
76 static constexpr const char* Name()
77 {
78 return "BinningHorizontal";
79 }
80};
81
85template <>
86struct MetadataKeyTraits<MetadataKey::BinningVertical>
87{
88 using type = uint64_t;
89
93 static constexpr const char* Name()
94 {
95 return "BinningVertical";
96 }
97};
98
102template <>
103struct MetadataKeyTraits<MetadataKey::Roi>
104{
105 using type = RectangleU;
106
110 static constexpr const char* Name()
111 {
112 return "Roi";
113 }
114};
115
119template <>
120struct MetadataKeyTraits<MetadataKey::DeviceExposureTime>
121{
122 using type = double;
123
127 static constexpr const char* Name()
128 {
129 return "DeviceExposureTime";
130 }
131};
132
136template <>
137struct MetadataKeyTraits<MetadataKey::DeviceExposureTimeSequence>
138{
139 using type = std::vector<double>;
140
144 static constexpr const char* Name()
145 {
146 return "DeviceExposureTimeSequence";
147 }
148};
149
153template <>
154struct MetadataKeyTraits<MetadataKey::SystemTimestamp>
155{
156 using type = uint64_t;
157
161 static constexpr const char* Name()
162 {
163 return "SystemTimestamp";
164 }
165};
166
170template <>
171struct MetadataKeyTraits<MetadataKey::DeviceGain>
172{
173 using type = double;
174
178 static constexpr const char* Name()
179 {
180 return "DeviceGain";
181 }
182};
183
187template <>
188struct MetadataKeyTraits<MetadataKey::DeviceGainSequence>
189{
190 using type = std::vector<double>;
191
195 static constexpr const char* Name()
196 {
197 return "DeviceGainSequence";
198 }
199};
200
207
209template <typename T, typename Tuple>
210struct is_in_tuple;
211
212template <typename T>
213struct is_in_tuple<T, std::tuple<>> : std::false_type
214{};
215
216template <typename T, typename First, typename... Rest>
217struct is_in_tuple<T, std::tuple<First, Rest...>>
218 : std::integral_constant<bool, std::is_same<T, First>::value || is_in_tuple<T, std::tuple<Rest...>>::value>
219{};
220
221template <typename T, typename Enable = void>
222struct NormalizeType
223{
224 using type = T;
225};
226
227template <typename T>
228struct NormalizeType<T, typename std::enable_if_t<!std::is_same<T, bool>::value && std::is_integral<T>::value && std::is_signed<T>::value>>
229{
230 using type = int64_t;
231};
232
233template <typename T>
234struct NormalizeType<T, typename std::enable_if_t<std::is_floating_point<T>::value>>
235{
236 using type = double;
237};
238
239template <typename T>
240struct NormalizeType<T, typename std::enable_if_t<!std::is_same<T, bool>::value && std::is_integral<T>::value && !std::is_signed<T>::value>>
241{
242 using type = uint64_t;
243};
244
245template <typename T>
246using normalize_t = typename NormalizeType<typename std::decay_t<T>>::type;
248
249} // namespace detail
250} // namespace common
251} // namespace peak
detail::RectangleT< uint32_t, uint32_t > RectangleU
Rectangle with unsigned coordinates and unsigned dimensions.
Definition peak_common_rectangle.hpp:267
Namespace for internal implementation details and low-level types.
Definition peak_common_math.hpp:24
constexpr std::array< MetadataKey, 10 > allMetadataKeys
Definition peak_common_metadata_traits.hpp:204
Root namespace for common types and interfaces shared across multiple libraries.
Definition peak_common_math.hpp:22
MetadataKey
Enumerates all compile-time known metadata keys.
Definition peak_common_metadata_key.hpp:31
@ Roi
Region of interest applied to the image.
Definition peak_common_metadata_key.hpp:85
@ DeviceGain
Device gain the image was captured with.
Definition peak_common_metadata_key.hpp:131
@ DeviceExposureTime
Device exposure time the image was captured with.
Definition peak_common_metadata_key.hpp:94
@ BinningHorizontal
Horizontal pixel binning factor.
Definition peak_common_metadata_key.hpp:65
@ DeviceExposureTimeSequence
Device exposure time sequence the image was captured with.
Definition peak_common_metadata_key.hpp:124
@ DeviceTimestamp
Device-provided image acquisition timestamp in nanoseconds.
Definition peak_common_metadata_key.hpp:43
@ SystemTimestamp
Timestamp of the system since unix epoch in nanoseconds.
Definition peak_common_metadata_key.hpp:110
@ DeviceGainSequence
Device gain sequence the image was captured with.
Definition peak_common_metadata_key.hpp:143
@ BinningVertical
Vertical pixel binning factor.
Definition peak_common_metadata_key.hpp:74
@ DeviceFrameID
A sequentially incremented identifier for the frame.
Definition peak_common_metadata_key.hpp:56
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:76
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:93
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:127
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:144
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:59
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:178
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:195
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:42
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:110
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:161