8 #ifndef DAQ_OCM_DAQ_FITS_CFITSIO_HPP_
9 #define DAQ_OCM_DAQ_FITS_CFITSIO_HPP_
14 #include <cfitsio/fitsio.h>
33 using UniqueFitsFile = std::unique_ptr<fitsfile, void (*)(fitsfile*) noexcept>;
69 return std::move(m_file);
75 FitsMemory(
size_t initial_size);
76 ~FitsMemory() noexcept;
81 std::unique_ptr<FitsMemory> m_memory;
98 int GetStatus()
const noexcept;
168 std::vector<LiteralKeyword>
ReadKeywords(fitsfile* ptr,
int hdu_num);
188 std::vector<LiteralKeyword>
205 std::vector<LiteralKeyword>
const& keywords,
206 std::optional<ssize_t>* remaining_size =
nullptr);
Represents errors from cfitsio.
MemoryFitsFile(MemoryFitsFile &&other) noexcept=default
UniqueFitsFile GetOwnedFile() &&
Move out ptr.
MemoryFitsFile & operator=(MemoryFitsFile &&other) noexcept=default
MemoryFitsFile() noexcept
Creates empty file.
fitsfile * GetFile() const noexcept
Get fits pointer.
Contains data structure for FITS keywords.
void SelectHduNum(fitsfile *ptr, int hdu_num)
Select current HDU number.
UniqueFitsFile Open(char const *filename, OpenMode mode)
Open file.
std::unique_ptr< fitsfile, void(*)(fitsfile *) noexcept > UniqueFitsFile
Defines unique ownership type to cfitsio fitsfile.
void WriteKeywords(fitsfile *ptr, int hdu_num, std::vector< LiteralKeyword > const &keywords, std::optional< ssize_t > *remaining_size)
Write keywords to HDU identified by number hdu_num.
void WriteChecksum(fitsfile *ptr, int hdu_num)
Write or update checksum keywords DATASUM and CHECKSUM to HDU specified by hdu_num.
void DefaultClose(fitsfile *ptr) noexcept
Default close function that is used by UniqueFitsFile as a deleter.
void DeleteAllKeywords(fitsfile *ptr, int hdu_num)
Delete all keywords from HDU.
void InitPrimaryHduNoImage(fitsfile *ptr)
Initializes an empty FITS file with a primary HDU.
std::vector< LiteralKeyword > ReadKeywords(fitsfile *ptr, int hdu_num)
Read keywords from HDU identifed by absolute position hdu_num.
UniqueFitsFile CreateEmpty(char const *filename)
Creates empty FITS file using fits_create_file and returns a pointer with a deleter that will close t...
void InitPrimaryHduEmpty(fitsfile *ptr)
Initializes an empty FITS file with an empty primary HDU (no keywords)