IDS peak genericC++ v1.17.0
Loading...
Searching...
No Matches
peak_common_metadata_traits.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
10#include <array>
11#include <cstdint>
12
13namespace peak
14{
15namespace common
16{
17namespace detail
18{
20
21template <MetadataKey metadataKey>
22struct MetadataKeyTraits;
23
25
29template <>
30struct MetadataKeyTraits<MetadataKey::DeviceTimestamp>
31{
32 using type = uint64_t;
33
37 static constexpr const char* Name()
38 {
39 return "DeviceTimestamp";
40 }
41};
42
46template <>
47struct MetadataKeyTraits<MetadataKey::DeviceFrameID>
48{
49 using type = uint64_t;
50
54 static constexpr const char* Name()
55 {
56 return "DeviceFrameID";
57 }
58};
59
63template <>
64struct MetadataKeyTraits<MetadataKey::BinningHorizontal>
65{
66 using type = uint64_t;
67
71 static constexpr const char* Name()
72 {
73 return "BinningHorizontal";
74 }
75};
76
80template <>
81struct MetadataKeyTraits<MetadataKey::BinningVertical>
82{
83 using type = uint64_t;
84
88 static constexpr const char* Name()
89 {
90 return "BinningVertical";
91 }
92};
93
97template <>
98struct MetadataKeyTraits<MetadataKey::Roi>
99{
101
105 static constexpr const char* Name()
106 {
107 return "Roi";
108 }
109};
110
114template <>
115struct MetadataKeyTraits<MetadataKey::DeviceExposureTime>
116{
117 using type = double;
118
122 static constexpr const char* Name()
123 {
124 return "DeviceExposureTime";
125 }
126};
127
131template <>
132struct MetadataKeyTraits<MetadataKey::DeviceExposureTimeSequence>
133{
134 using type = std::vector<double>;
135
139 static constexpr const char* Name()
140 {
141 return "DeviceExposureTimeSequence";
142 }
143};
144
148template <>
149struct MetadataKeyTraits<MetadataKey::SystemTimestamp>
150{
151 using type = uint64_t;
152
156 static constexpr const char* Name()
157 {
158 return "SystemTimestamp";
159 }
160};
161
165template <>
166struct MetadataKeyTraits<MetadataKey::DeviceGain>
167{
168 using type = double;
169
173 static constexpr const char* Name()
174 {
175 return "DeviceGain";
176 }
177};
178
182template <>
183struct MetadataKeyTraits<MetadataKey::DeviceGainSequence>
184{
185 using type = std::vector<double>;
186
190 static constexpr const char* Name()
191 {
192 return "DeviceGainSequence";
193 }
194};
195
202
204template <typename T, typename Tuple>
205struct is_in_tuple;
206
207template <typename T>
208struct is_in_tuple<T, std::tuple<>> : std::false_type
209{};
210
211template <typename T, typename First, typename... Rest>
212struct is_in_tuple<T, std::tuple<First, Rest...>>
213 : std::integral_constant<bool, std::is_same<T, First>::value || is_in_tuple<T, std::tuple<Rest...>>::value>
214{};
215
216template <typename T, typename Enable = void>
217struct NormalizeType
218{
219 using type = T;
220};
221
222template <typename T>
223struct NormalizeType<T, typename std::enable_if_t<!std::is_same<T, bool>::value && std::is_integral<T>::value && std::is_signed<T>::value>>
224{
225 using type = int64_t;
226};
227
228template <typename T>
229struct NormalizeType<T, typename std::enable_if_t<std::is_floating_point<T>::value>>
230{
231 using type = double;
232};
233
234template <typename T>
235struct NormalizeType<T, typename std::enable_if_t<!std::is_same<T, bool>::value && std::is_integral<T>::value && !std::is_signed<T>::value>>
236{
237 using type = uint64_t;
238};
239
240template <typename T>
241using normalize_t = typename NormalizeType<typename std::decay_t<T>>::type;
243
244} // namespace detail
245} // namespace common
246} // namespace peak
detail::RectangleT< uint32_t, uint32_t > RectangleU
Rectangle with unsigned coordinates and unsigned dimensions.
Definition peak_common_rectangle.hpp:262
Namespace for internal implementation details and low-level types.
Definition peak_common_math.hpp:19
constexpr std::array< MetadataKey, 10 > allMetadataKeys
Definition peak_common_metadata_traits.hpp:199
Root namespace for common types and interfaces shared across multiple libraries.
Definition peak_common_math.hpp:17
MetadataKey
Enumerates all compile-time known metadata keys.
Definition peak_common_metadata_key.hpp:26
@ Roi
Region of interest applied to the image.
Definition peak_common_metadata_key.hpp:80
@ DeviceGain
Device gain the image was captured with.
Definition peak_common_metadata_key.hpp:126
@ DeviceExposureTime
Device exposure time the image was captured with.
Definition peak_common_metadata_key.hpp:89
@ BinningHorizontal
Horizontal pixel binning factor.
Definition peak_common_metadata_key.hpp:60
@ DeviceExposureTimeSequence
Device exposure time sequence the image was captured with.
Definition peak_common_metadata_key.hpp:119
@ DeviceTimestamp
Device-provided image acquisition timestamp in nanoseconds.
Definition peak_common_metadata_key.hpp:38
@ SystemTimestamp
Timestamp of the system since unix epoch in nanoseconds.
Definition peak_common_metadata_key.hpp:105
@ DeviceGainSequence
Device gain sequence the image was captured with.
Definition peak_common_metadata_key.hpp:138
@ BinningVertical
Vertical pixel binning factor.
Definition peak_common_metadata_key.hpp:69
@ DeviceFrameID
A sequentially incremented identifier for the frame.
Definition peak_common_metadata_key.hpp:51
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_buffer.hpp:29
uint64_t type
Definition peak_common_metadata_traits.hpp:66
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:71
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:88
uint64_t type
Definition peak_common_metadata_traits.hpp:83
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:122
double type
Definition peak_common_metadata_traits.hpp:117
std::vector< double > type
Definition peak_common_metadata_traits.hpp:134
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:139
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:54
uint64_t type
Definition peak_common_metadata_traits.hpp:49
double type
Definition peak_common_metadata_traits.hpp:168
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:173
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:190
std::vector< double > type
Definition peak_common_metadata_traits.hpp:185
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:37
uint64_t type
Definition peak_common_metadata_traits.hpp:32
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:105
RectangleU type
Definition peak_common_metadata_traits.hpp:100
uint64_t type
Definition peak_common_metadata_traits.hpp:151
static constexpr const char * Name()
Definition peak_common_metadata_traits.hpp:156