27#ifndef ioutils_fits_fitsUtils_hpp
28#define ioutils_fits_fitsUtils_hpp
37#include "../stringUtils.hpp"
45#define stdValWidth ( 20 )
59 explicit fitsCommentType(
char *v )
61 static_cast<void>( v );
64 explicit fitsCommentType(
const char *v )
66 static_cast<void>( v );
78 explicit fitsHistoryType(
char *v )
80 static_cast<void>( v );
83 explicit fitsHistoryType(
const char *v )
85 static_cast<void>( v );
89struct fitsContinueType
95 explicit fitsContinueType(
char *v )
97 static_cast<void>( v );
100 explicit fitsContinueType(
const char *v )
102 static_cast<void>( v );
120template <
typename scalarT>
127constexpr int fitsType<char *>()
133constexpr int fitsType<std::string>()
139constexpr int fitsType<bool>()
145constexpr int fitsType<char>()
151constexpr int fitsType<unsigned char>()
157constexpr int fitsType<short>()
163constexpr int fitsType<unsigned short>()
169constexpr int fitsType<int>()
175constexpr int fitsType<unsigned int>()
181constexpr int fitsType<long>()
187constexpr int fitsType<unsigned long>()
193constexpr int fitsType<long long>()
199constexpr int fitsType<unsigned long long>()
205constexpr int fitsType<float>()
211constexpr int fitsType<std::complex<float>>()
217constexpr int fitsType<double>()
223constexpr int fitsType<std::complex<double>>()
229constexpr int fitsType<fitsUnknownType>()
235constexpr int fitsType<fitsCommentType>()
241constexpr int fitsType<fitsHistoryType>()
247constexpr int fitsType<fitsContinueType>()
258template <
typename scalarT>
262constexpr int fitsBITPIX<char>()
268constexpr int fitsBITPIX<signed char>()
274constexpr int fitsBITPIX<unsigned char>()
280constexpr int fitsBITPIX<short>()
286constexpr int fitsBITPIX<unsigned short>()
292constexpr int fitsBITPIX<int>()
298constexpr int fitsBITPIX<unsigned int>()
304constexpr int fitsBITPIX<long>()
310constexpr int fitsBITPIX<unsigned long>()
312 return ULONGLONG_IMG;
316constexpr int fitsBITPIX<long long>()
322constexpr int fitsBITPIX<unsigned long long>()
324 return ULONGLONG_IMG;
328constexpr int fitsBITPIX<float>()
334constexpr int fitsBITPIX<double>()
355void fitsPopulateCard(
char headStr[81],
char *keyword,
char *value,
char *comment );
371template <
typename typeT>
376 fits_write_key( fptr, fitsType<typeT>(), keyword, value, comment, &fstatus );
382mx::error_t fits_write_key<char *>( fitsfile *fptr,
char *keyword,
void *value,
char *comment );
385mx::error_t fits_write_key<std::string>( fitsfile *fptr,
char *keyword,
void *value,
char *comment );
394mx::error_t fits_write_key<fitsUnknownType>( fitsfile *fptr,
char *keyword,
void *value,
char *comment );
396mx::error_t fits_write_comment( fitsfile *fptr,
char *comment );
398mx::error_t fits_write_history( fitsfile *fptr,
char *history );
error_t
The mxlib error codes.
constexpr int fitsType()
Return the cfitsio constant for a given data type.
int fitsStripApost(std::string &s)
Strip the apostrophes from a FITS value string.
mx::error_t fits_write_key< bool >(fitsfile *fptr, char *keyword, void *value, char *comment)
Specialization to handle the case bool.
constexpr int fitsBITPIX()
static constexpr error_t fits_status2error_t(const int &err)
Convert a FITS status code to error_t.
void fitsPopulateCard(char headStr[81], char *keyword, char *value, char *comment)
Populate a fits header card with the value string copied verbatim.
mx::error_t fits_write_key(fitsfile *fptr, char *keyword, void *value, char *comment)
Write a header card to a file.