27 #ifndef ioutils_fits_fitsUtils_hpp
28 #define ioutils_fits_fitsUtils_hpp
38 #include "../stringUtils.hpp"
46 #define stdValWidth (20)
49 struct fitsUnknownType
54 struct fitsCommentType
60 explicit fitsCommentType(
char * v)
65 explicit fitsCommentType(
const char * v)
73 struct fitsHistoryType
79 explicit fitsHistoryType(
char * v)
84 explicit fitsHistoryType(
const char * v)
106 template<
typename scalarT>
113 constexpr
int fitsType<char *>()
119 constexpr
int fitsType<std::string>()
125 constexpr
int fitsType<bool>()
131 constexpr
int fitsType<char>()
137 constexpr
int fitsType<unsigned char>()
143 constexpr
int fitsType<short>()
149 constexpr
int fitsType<unsigned short>()
155 constexpr
int fitsType<int>()
161 constexpr
int fitsType<unsigned int>()
167 constexpr
int fitsType<long>()
173 constexpr
int fitsType<unsigned long>()
179 constexpr
int fitsType<long long>()
185 constexpr
int fitsType<unsigned long long>()
191 constexpr
int fitsType<float>()
197 constexpr
int fitsType<std::complex<float>>()
203 constexpr
int fitsType<double>()
209 constexpr
int fitsType<std::complex<double>>()
215 constexpr
int fitsType<fitsUnknownType>()
221 constexpr
int fitsType<fitsCommentType>()
227 constexpr
int fitsType<fitsHistoryType>()
239 template<
typename scalarT>
243 constexpr
int fitsBITPIX<char>()
249 constexpr
int fitsBITPIX<signed char>()
255 constexpr
int fitsBITPIX<unsigned char>()
261 constexpr
int fitsBITPIX<short>()
267 constexpr
int fitsBITPIX<unsigned short>()
273 constexpr
int fitsBITPIX<int>()
279 constexpr
int fitsBITPIX<unsigned int>()
285 constexpr
int fitsBITPIX<long>()
291 constexpr
int fitsBITPIX<unsigned long>()
293 return ULONGLONG_IMG;
297 constexpr
int fitsBITPIX<long long>()
303 constexpr
int fitsBITPIX<unsigned long long>()
305 return ULONGLONG_IMG;
309 constexpr
int fitsBITPIX<float>()
315 constexpr
int fitsBITPIX<double>()
337 void fitsPopulateCard(
char headStr[81],
char *keyword,
char *value,
char *comment);
353 template<
typename typeT>
362 fits_write_key(fptr, fitsType<typeT>(), keyword, value, comment, &fstatus);
368 int fits_write_key<char *>( fitsfile * fptr,
375 int fits_write_key<std::string>( fitsfile * fptr,
392 int fits_write_key<fitsUnknownType>( fitsfile * fptr,
398 int fits_write_comment( fitsfile *fptr,
402 int fits_write_history( fitsfile *fptr,
408 const std::string & filename,
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.
void fitsErrText(std::string &explan, const std::string &filename, int fstatus)
Generate a rich error meesage from a FITS status code.
int fits_write_key(fitsfile *fptr, char *keyword, void *value, char *comment)
Write a header card to a file.
constexpr int fitsBITPIX()
void fitsPopulateCard(char headStr[81], char *keyword, char *value, char *comment)
Populate a fits header card with the value string copied verbatim.
int fits_write_key< bool >(fitsfile *fptr, char *keyword, void *value, char *comment)
Specialization to handle the case bool.