RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
fitsColumnFormat.hpp
Go to the documentation of this file.
1
11#ifndef RTCTK_COMPONENTFRAMEWORK_FITSCOLUMNFORMAT_HPP
12#define RTCTK_COMPONENTFRAMEWORK_FITSCOLUMNFORMAT_HPP
13
14#include <cstddef>
15#include <fmt/core.h>
16#include <fmt/format.h>
17#include <gsl/span>
18#include <limits>
19#include <optional>
20#include <string>
21#include <vector>
22
24
29template <class T, typename _ = void>
31
35template <class T>
36std::string GetFitsType(const std::optional<size_t> length = FitsColumnFormat<T>::COUNT) {
38 // ignore overide setting for scalar values
39 return std::string{FitsColumnFormat<T>::TYPE};
40 } else if (length == 1) {
41 return std::string{FitsColumnFormat<T>::TYPE};
42 } else if (length == std::nullopt) {
43 return std::string{FitsColumnFormat<T>::PREFIX} + std::string{FitsColumnFormat<T>::TYPE};
44 } else {
45 return fmt::format_int(length.value()).str() + std::string{FitsColumnFormat<T>::TYPE};
46 }
47}
48
53template <class T, class... Args>
54void GetFITSTForm(std::vector<std::string>& input);
55
61template <class T, class... Args>
62void GetFITSTFormWithLength(std::vector<std::string>& input,
63 const gsl::span<std::optional<size_t>, sizeof...(Args) + 1> sizes);
64
65} // namespace rtctk::componentFramework
66
68
69#endif // RTCTK_COMPONENTFRAMEWORK_FITSCOLUMNFORMAT_HPP
fitscolumnFormat is used to get a fits type from a C++ type.
Definition commandReplier.cpp:21
std::string GetFitsType(const std::optional< size_t > length=FitsColumnFormat< T >::COUNT)
Get the TFORM value for a type.
Definition fitsColumnFormat.hpp:36
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:157
void GetFITSTForm(std::vector< std::string > &input)
Get a vactor of TFORM strings for a list of types.
Definition fitsColumnFormat.ipp:149
Type that stores type information for a FITS TFORM string.
Definition fitsColumnFormat.hpp:30