RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
fitsColumnFormat.ipp
Go to the documentation of this file.
1
13// Note this is a template implementation file and should not be included directly.
14// The typical header protection macro is not added to avoid it showing up in Doxygen API
15// documentation.
16#pragma once
17
21
22#include <array>
23#include <limits>
24#include <optional>
25#include <type_traits>
26
28
29template <class T>
30struct FitsColumnFormat<T, typename std::enable_if<IS_STD_ARRAY_TYPE<T>>::type> {
31 static constexpr std::string_view PREFIX = "";
32 static constexpr std::string_view TYPE = FitsColumnFormat<typename T::value_type>::TYPE;
33 static constexpr std::optional<size_t> COUNT = std::tuple_size<T>::value;
34};
35
36template <class T>
37struct FitsColumnFormat<T, typename std::enable_if<IS_STATIC_SPAN_TYPE<T>>::type> {
38 static constexpr std::string_view PREFIX = "";
39 static constexpr std::string_view TYPE = FitsColumnFormat<typename T::value_type>::TYPE;
40 static constexpr std::optional<size_t> COUNT = static_cast<size_t>(T::extent);
41};
42
43template <class T>
44struct FitsColumnFormat<T, typename std::enable_if<IS_DYNAMIC_SPAN_TYPE<T>>::type> {
45 static constexpr std::string_view PREFIX = "P";
46 static constexpr std::string_view TYPE = FitsColumnFormat<typename T::value_type>::TYPE;
47 static constexpr std::optional<size_t> COUNT = std::nullopt;
48};
49
50template <class T>
51struct FitsColumnFormat<T, typename std::enable_if<IS_VECTOR_TYPE<T>>::type> {
52 static constexpr std::string_view PREFIX = "P";
53 static constexpr std::string_view TYPE = FitsColumnFormat<typename T::value_type>::TYPE;
54 static constexpr std::optional<size_t> COUNT = std::nullopt;
55};
56
57template <class T>
58struct FitsColumnFormat<T, typename std::enable_if<IS_MATRIX_BUFFER_TYPE<T>>::type> {
59 static constexpr std::string_view PREFIX = "P";
60 static constexpr std::string_view TYPE = FitsColumnFormat<typename T::value_type>::TYPE;
61 static constexpr std::optional<size_t> COUNT = std::nullopt;
62};
63
64// Disabled: string type is a variable length type
65template <>
66struct FitsColumnFormat<std::string> {
67 static constexpr std::string_view PREFIX = "";
68 static constexpr std::string_view TYPE = "A";
69 static constexpr std::optional<size_t> COUNT = std::nullopt;
70};
71
72template <>
74 static constexpr std::string_view PREFIX = "";
75 static constexpr std::string_view TYPE = "L";
76 static constexpr size_t COUNT = 1;
77};
78
79template <>
81 static constexpr std::string_view PREFIX = "";
82 static constexpr std::string_view TYPE = "B";
83 static constexpr size_t COUNT = 1;
84};
85
86template <>
88 static constexpr std::string_view PREFIX = "";
89 static constexpr std::string_view TYPE = "S";
90 static constexpr size_t COUNT = 1;
91};
92
93template <>
95 static constexpr std::string_view PREFIX = "";
96 static constexpr std::string_view TYPE = "I";
97 static constexpr size_t COUNT = 1;
98};
99
100template <>
102 static constexpr std::string_view PREFIX = "";
103 static constexpr std::string_view TYPE = "U";
104 static constexpr size_t COUNT = 1;
105};
106
107template <>
109 static constexpr std::string_view PREFIX = "";
110 static constexpr std::string_view TYPE = "J";
111 static constexpr size_t COUNT = 1;
112};
113
114template <>
116 static constexpr std::string_view PREFIX = "";
117 static constexpr std::string_view TYPE = "V";
118 static constexpr size_t COUNT = 1;
119};
120
121template <>
123 static constexpr std::string_view PREFIX = "";
124 static constexpr std::string_view TYPE = "K";
125 static constexpr size_t COUNT = 1;
126};
127
128template <>
130 static constexpr std::string_view PREFIX = "";
131 static constexpr std::string_view TYPE = "W";
132 static constexpr size_t COUNT = 1;
133};
134
135template <>
137 static constexpr std::string_view PREFIX = "";
138 static constexpr std::string_view TYPE = "E";
139 static constexpr size_t COUNT = 1;
140};
141
142template <>
144 static constexpr std::string_view PREFIX = "";
145 static constexpr std::string_view TYPE = "D";
146 static constexpr size_t COUNT = 1;
147};
148
149template <class T, class... Args>
150void GetFITSTForm(std::vector<std::string>& input) {
151 input.push_back(GetFitsType<T>());
152 if constexpr (sizeof...(Args) != 0) {
154 }
155}
156
157template <class T, class... Args>
158void GetFITSTFormWithLength(std::vector<std::string>& input,
159 const gsl::span<std::optional<size_t>, sizeof...(Args) + 1> sizes) {
160 if (sizes[0].has_value() and sizes[0].value() > 0) {
161 input.push_back(GetFitsType<T>(sizes[0].value()));
162 } else {
163 input.push_back(GetFitsType<T>());
164 }
165 if constexpr (sizeof...(Args) != 0) {
166 // template disambiguator needed
168 }
169}
170
171} // namespace rtctk::componentFramework
Class used to parse default command line arguments.
Definition rtcComponentArgs.hpp:33
fitscolumnFormat is used to get a fits type from a C++ type.
Definition commandReplier.cpp:22
void GetFITSTFormWithLength(std::vector< std::string > &input, const gsl::span< std::optional< size_t >, sizeof...(Args)+1 > sizes)
Get a vactor of TFORM strings for a list of types using the custom sizes provided.
Definition fitsColumnFormat.ipp:158
void GetFITSTForm(std::vector< std::string > &input)
Get a vactor of TFORM strings for a list of types.
Definition fitsColumnFormat.ipp:150
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
FitsRecorder allows to write ColumnData to into fits files in a specified directory.
Type that stores type information for a FITS TFORM string.
Definition fitsColumnFormat.hpp:31
Provides useful mechanisms to test various type traits.