GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GFitsCfitsio.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GFitsCfitsio.hpp - CFITSIO interface header *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2008-2021 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GFitsCfitsio.hpp
23  * @brief CFITSIO interface header
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GFITSCFITSIO_HPP
28 #define GFITSCFITSIO_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #ifdef HAVE_CONFIG_H
32 #include <config.h>
33 #endif
34 #include <cstring>
35 
36 /* __ Namespaces _________________________________________________________ */
37 
38 
39 /***************************************************************************
40  * CFITSIO is available *
41  ***************************************************************************/
42 #if defined(HAVE_LIBCFITSIO)
43 
44 #if defined(HAVE_CFITSIO_FITSIO_H)
45 #include <cfitsio/fitsio.h>
46 #elif defined(HAVE_LIBCFITSIO0_FITSIO_H)
47 #include <libcfitsio0/fitsio.h>
48 #else
49 #include <fitsio.h>
50 #endif
51 
52 /* __ Macros _____________________________________________________________ */
53 #define __ffclos(A, B) ffclos(A, B)
54 #define __ffcrim(A, B, C, D, E) ffcrim(A, B, C, D, E)
55 #define __ffcrtb(A, B, C, D, E, F, G, H, I) ffcrtb(A, B, C, D, E, F, G, H, I)
56 #define __ffdcol(A, B, C) ffdcol(A, B, C)
57 #define __ffdelt(A, B) ffdelt(A, B)
58 #define __ffdhdu(A, B, C) ffdhdu(A, B, C)
59 #define __ffdrow(A, B, C, D) ffdrow(A, B, C, D)
60 #define __ffflus(A, B) ffflus(A, B)
61 #define __ffgabc(A, B, C, D, E, F) ffgabc(A, B, C, D, E, F)
62 #define __ffgcv(A, B, C, D, E, F, G, H, I, J) ffgcv(A, B, C, D, E, F, G, H, I, J)
63 #define __ffgcvb(A, B, C, D, E, F, G, H, I) ffgcvb(A, B, C, D, E, F, G, H, I)
64 #define __ffgcvs(A, B, C, D, E, F, G, H, I) ffgcvs(A, B, C, D, E, F, G, H, I)
65 #define __ffgdes(A, B, C, D, E, F) ffgdes(A, B, C, D, E, F)
66 #define __ffgerr(A, B) ffgerr(A, B)
67 #define __ffghdt(A, B, C) ffghdt(A, B, C)
68 #define __ffghsp(A, B, C, D) ffghsp(A, B, C, D)
69 #define __ffgidm(A, B, C) ffgidm(A, B, C)
70 #define __ffgidt(A, B, C) ffgidt(A, B, C)
71 #define __ffgiet(A, B, C) ffgiet(A, B, C)
72 #define __ffgipr(A, B, C, D, E, F) ffgipr(A, B, C, D, E, F)
73 #define __ffgisz(A, B, C, D) ffgisz(A, B, C, D)
74 #define __ffgky(A, B, C, D, E, F) ffgky(A, B, C, D, E, F)
75 #define __ffgkey(A, B, C, D, E) ffgkey(A, B, C, D, E)
76 #define __ffgkyd(A, B, C, D, E) ffgkyd(A, B, C, D, E)
77 #define __ffgkyn(A, B, C, D, E, F) ffgkyn(A, B, C, D, E, F)
78 #define __ffgnrw(A, B, C) ffgnrw(A, B, C)
79 #define __ffgncl(A, B, C) ffgncl(A, B, C)
80 #define __ffgsv(A, B, C, D, E, F, G, H, I) ffgsv(A, B, C, D, E, F, G, H, I)
81 #define __ffgtcl(A, B, C, D, E, F) ffgtcl(A, B, C, D, E, F)
82 #define __ffibin(A, B, C, D, E, F, G, H, I) ffibin(A, B, C, D, E, F, G, H, I)
83 #define __fficol(A, B, C, D, E) fficol(A, B, C, D, E)
84 #define __ffiimg(A, B, C, D, E) ffiimg(A, B, C, D, E)
85 #define __ffiimgll(A, B, C, D, E) ffiimgll(A, B, C, D, E)
86 #define __ffinit(A, B, C) ffinit(A, B, C)
87 #define __ffirow(A, B, C, D) ffirow(A, B, C, D)
88 #define __ffitab(A, B, C, D, E, F, G, H, I, J) ffitab(A, B, C, D, E, F, G, H, I, J)
89 #define __ffopen(A, B, C, D) ffopen(A, B, C, D)
90 #define __ffmahd(A, B, C, D) ffmahd(A, B, C, D)
91 #define __ffpcn(A, B, C, D, E, F, G, H, I) ffpcn(A, B, C, D, E, F, G, H, I)
92 #define __ffpcom(A, B, C) ffpcom(A, B, C)
93 #define __ffphis(A, B, C) ffphis(A, B, C)
94 #define __ffpss(A, B, C, D, E, F) ffpss(A, B, C, D, E, F)
95 #define __ffprec(A, B, C) ffprec(A, B, C)
96 #define __ffrsim(A, B, C, D, E) ffrsim(A, B, C, D, E)
97 #define __ffsrow(A, B, C, D) ffsrow(A, B, C, D)
98 #define __ffthdu(A, B, C) ffthdu(A, B, C)
99 #define __fftscl(A, B, C, D, E) fftscl(A, B, C, D, E)
100 #define __ffuky(A, B, C, D, E, F) ffuky(A, B, C, D, E, F)
101 #define __ffukye(A, B, C, D, E, F) ffukye(A, B, C, D, E, F)
102 #define __ffukyd(A, B, C, D, E, F) ffukyd(A, B, C, D, E, F)
103 #define __ffukyj(A, B, C, D, E) ffukyj(A, B, C, D, E)
104 #define __ffukyl(A, B, C, D, E) ffukyl(A, B, C, D, E)
105 #define __ffukys(A, B, C, D, E) ffukys(A, B, C, D, E)
106 #define __ffukyu(A, B, C, D) ffukyu(A, B, C, D)
107 #define __TNULL 0
108 #define __TBIT TBIT
109 #define __TBYTE TBYTE
110 #define __TSBYTE TSBYTE
111 #define __TLOGICAL TLOGICAL
112 #define __TSTRING TSTRING
113 #define __TUSHORT TUSHORT
114 #define __TSHORT TSHORT
115 #define __TUINT TUINT
116 #define __TINT TINT
117 #define __TULONG TULONG
118 #define __TLONG TLONG
119 #define __TFLOAT TFLOAT
120 #define __TLONGLONG TLONGLONG
121 #define __TDOUBLE TDOUBLE
122 #define __TCOMPLEX TCOMPLEX
123 #define __TDBLCOMPLEX TDBLCOMPLEX
124 
125 /* __ Type definition ____________________________________________________ */
126 typedef fitsfile __fitsfile;
127 
128 /***************************************************************************
129  * CFITSIO is not available *
130  ***************************************************************************/
131 #else
132 
133 /* __ Macros _____________________________________________________________ */
134 #define __ffclos(A, B) __dummy()
135 #define __ffcrim(A, B, C, D, E) __dummy()
136 #define __ffcrtb(A, B, C, D, E, F, G, H, I) __dummy()
137 #define __ffdcol(A, B, C) __dummy()
138 #define __ffdelt(A, B) __dummy()
139 #define __ffdhdu(A, B, C) __dummy()
140 #define __ffdrow(A, B, C, D) __dummy()
141 #define __ffflus(A, B) __dummy()
142 #define __ffgabc(A, B, C, D, E, F) __dummy()
143 #define __ffgcv(A, B, C, D, E, F, G, H, I, J) __dummy()
144 #define __ffgcvb(A, B, C, D, E, F, G, H, I) __dummy()
145 #define __ffgcvs(A, B, C, D, E, F, G, H, I) __dummy()
146 #define __ffgdes(A, B, C, D, E, F) __dummy()
147 #define __ffgerr(A, B) __error(A, B)
148 #define __ffghdt(A, B, C) __dummy()
149 #define __ffghsp(A, B, C, D) __dummy()
150 #define __ffgidm(A, B, C) __dummy()
151 #define __ffgidt(A, B, C) __dummy()
152 #define __ffgiet(A, B, C) __dummy()
153 #define __ffgipr(A, B, C, D, E, F) __dummy()
154 #define __ffgisz(A, B, C, D) __dummy()
155 #define __ffgky(A, B, C, D, E, F) __dummy()
156 #define __ffgkey(A, B, C, D, E) __dummy()
157 #define __ffgkyd(A, B, C, D, E) __dummy()
158 #define __ffgkyn(A, B, C, D, E, F) __dummy()
159 #define __ffgnrw(A, B, C) __dummy()
160 #define __ffgncl(A, B, C) __dummy()
161 #define __ffgsv(A, B, C, D, E, F, G, H, I) __dummy()
162 #define __ffgtcl(A, B, C, D, E, F) __dummy()
163 #define __ffibin(A, B, C, D, E, F, G, H, I) __dummy()
164 #define __fficol(A, B, C, D, E) __dummy()
165 #define __ffiimg(A, B, C, D, E) __dummy()
166 #define __ffiimgll(A, B, C, D, E) __dummy()
167 #define __ffinit(A, B, C) __dummy()
168 #define __ffirow(A, B, C, D) __dummy()
169 #define __ffitab(A, B, C, D, E, F, G, H, I, J) __dummy()
170 #define __ffmahd(A, B, C, D) __dummy()
171 #define __ffpcn(A, B, C, D, E, F, G, H, I) __dummy()
172 #define __ffopen(A, B, C, D) __dummy()
173 #define __ffpcom(A, B, C) __dummy()
174 #define __ffphis(A, B, C) __dummy()
175 #define __ffpss(A, B, C, D, E, F) __dummy()
176 #define __ffprec(A, B, C) __dummy()
177 #define __ffrsim(A, B, C, D, E) __dummy()
178 #define __ffsrow(A, B, C, D) __dummy()
179 #define __ffthdu(A, B, C) __dummy()
180 #define __fftscl(A, B, C, D, E) __dummy()
181 #define __ffuky(A, B, C, D, E, F) __dummy()
182 #define __ffukye(A, B, C, D, E, F) __dummy()
183 #define __ffukyd(A, B, C, D, E, F) __dummy()
184 #define __ffukyj(A, B, C, D, E) __dummy()
185 #define __ffukyl(A, B, C, D, E) __dummy()
186 #define __ffukys(A, B, C, D, E) __dummy()
187 #define __ffukyu(A, B, C, D) __dummy()
188 #define __TNULL 0
189 #define __TBIT 1
190 #define __TBYTE 11
191 #define __TSBYTE 12
192 #define __TLOGICAL 14
193 #define __TSTRING 16
194 #define __TUSHORT 20
195 #define __TSHORT 21
196 #define __TUINT 30
197 #define __TINT 31
198 #define __TULONG 40
199 #define __TLONG 41
200 #define __TFLOAT 42
201 #define __TLONGLONG 81
202 #define __TDOUBLE 82
203 #define __TCOMPLEX 83
204 #define __TDBLCOMPLEX 163
205 
206 /* __ Type definition ____________________________________________________ */
207 typedef struct {
208  int HDUposition; // HDU position in file; 0 = first HDU
209  int* Fptr; // Pointer to FITS file structure
210 } __fitsfile;
211 
212 /* __ Dummy function _____________________________________________________ */
213 inline
214 void __error(int status, char* err_text)
215 {
216  std::strcpy(err_text, "CFITSIO not available");
217 }
218 inline
219 int __dummy(void)
220 {
221  return 0;
222 }
223 
224 #endif
225 
226 /* __ Common macros ______________________________________________________ */
227 #define FPTR(A) ((__fitsfile*)A)
228 #define FHANDLE(A) ((__fitsfile**)&A)
229 #define FPTR_COPY(A, B) *((__fitsfile*)A) = *((__fitsfile*)B)
230 
231 #endif /* GFITSCFITSIO_HPP */
void __error(int status, char *err_text)
int __dummy(void)