RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
fitsColumnFormat.hpp
Go to the documentation of this file.
1
12#ifndef RTCTK_COMPONENTFRAMEWORK_FITSCOLUMNFORMAT_HPP
13#define RTCTK_COMPONENTFRAMEWORK_FITSCOLUMNFORMAT_HPP
14
15#include <cstddef>
16#include <fmt/core.h>
17#include <fmt/format.h>
18#include <gsl/span>
19#include <limits>
20#include <optional>
21#include <string>
22#include <vector>
23
25
30template <class T, typename _ = void>
32
36template <class T>
37std::string GetFitsType(const std::optional<size_t> length = FitsColumnFormat<T>::COUNT) {
38 // fixed length strings have a suffix instead of a prefix
39 if (std::is_same_v<T, std::string> and length.has_value()) {
40 return std::string{FitsColumnFormat<T>::TYPE} + fmt::format_int(length.value()).str();
41 }
43 // ignore overide setting for scalar values
44 return std::string{FitsColumnFormat<T>::TYPE};
45 } else if (length == 1) {
46 return std::string{FitsColumnFormat<T>::TYPE};
47 } else if (length == std::nullopt) {
48 return std::string{FitsColumnFormat<T>::PREFIX} + std::string{FitsColumnFormat<T>::TYPE};
49 } else {
50 return fmt::format_int(length.value()).str() + std::string{FitsColumnFormat<T>::TYPE};
51 }
52}
53
58template <class T, class... Args>
59void GetFITSTForm(std::vector<std::string>& input);
60
66template <class T, class... Args>
67void GetFITSTFormWithLength(std::vector<std::string>& input,
68 const gsl::span<std::optional<size_t>, sizeof...(Args) + 1> sizes);
69
70} // namespace rtctk::componentFramework
71
73
74#endif // RTCTK_COMPONENTFRAMEWORK_FITSCOLUMNFORMAT_HPP
fitscolumnFormat is used to get a fits type from a C++ type.
Definition commandReplier.cpp:22
std::string GetFitsType(const std::optional< size_t > length=FitsColumnFormat< T >::COUNT)
Get the TFORM value for a type.
Definition fitsColumnFormat.hpp:37
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
Type that stores type information for a FITS TFORM string.
Definition fitsColumnFormat.hpp:31