Gyoto
GyotoFitsRW.h
Go to the documentation of this file.
1 
7 /*
8  Copyright 2019 Frederic Vincent, Thibaut Paumard, Nicolas Aimar
9 
10  This file is part of Gyoto.
11 
12  Gyoto is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  Gyoto is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef __GyotoFitsRW_H_
27 #define __GyotoFitsRW_H_
28 
29 #include <iostream>
30 #include <fstream>
31 #include <iomanip>
32 #ifdef GYOTO_USE_CFITSIO
33 #include <fitsio.h>
34 #endif
35 
36 namespace Gyoto {
37  class FitsRW;
38 }
39 
40 #ifdef GYOTO_USE_XERCES
41 #include <GyotoRegister.h>
42 #endif
43 
52 {
53  public:
54  FitsRW();
55  FitsRW(const FitsRW&);
56  virtual FitsRW* clone() const ;
57  virtual ~FitsRW() ;
58 
59 #ifdef GYOTO_USE_CFITSIO
60 
72  fitsfile* fitsCreate(std::string const filename) const;
80  fitsfile* fitsOpen(std::string const filename) const;
81 
89  void fitsClose(fitsfile* fptr) const;
90 
101  void fitsWriteHDUData(fitsfile* const fptr, std::string const extname, double* const src, long const nelements) const;
102 
112  void fitsWriteKey(fitsfile* const fptr, std::string const key, double value, std::string const hdu="PRIMARY") const;
113 
121  double* fitsReadHDUData(fitsfile* const fptr, std::string const extname, double* dest, long expectedSize) const;
122 
131  double fitsReadKey(fitsfile* const fptr, std::string const key, std::string const hdu) const;
132 
141  double fitsReadKey(fitsfile* const fptr, std::string const key, int const hdu_num=1) const;
142 
143  #endif
144 
145 };
146 
147 
148 #endif
void fitsClose(fitsfile *fptr) const
Closes a fits file referred to by a fitsfile pointer.
FitsRW()
Constructor.
Gyoto registers.
Class for reading or writing data in FITS file. The data stored should be 1D array(s).
Definition: GyotoFitsRW.h:51
fitsfile * fitsCreate(std::string const filename) const
Creates a FITS file with dummy primary HDU.
void fitsWriteHDUData(fitsfile *const fptr, std::string const extname, double *const src, long const nelements) const
Writes 1D array in FITS files.
void fitsWriteKey(fitsfile *const fptr, std::string const key, double value, std::string const hdu="PRIMARY") const
Writes a key in the header of a given HDU (by default "PRIMARY")
double fitsReadKey(fitsfile *const fptr, std::string const key, std::string const hdu) const
Read a specific key of the HDU with a specific &#39;extname&#39;.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:46
virtual ~FitsRW()
Destructor.
double * fitsReadHDUData(fitsfile *const fptr, std::string const extname, double *dest, long expectedSize) const
Read 1D array in FITS files.
fitsfile * fitsOpen(std::string const filename) const
Open a fits file.