casacore
fits.h
Go to the documentation of this file.
1 //# fits.h:
2 //# Copyright (C) 1993,1994,1995,1996,1997,1999,2000,2001,2003,2004
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 # if !defined(AIPS_FITS)
29 # define AIPS_FITS
30 
31 //# Note that aips.h has to come first for the correct definition of off_t.
32 # include <casacore/casa/aips.h>
33 # include <stdlib.h>
34 # include <ctype.h>
35 # include <casacore/casa/iostream.h>
36 # include <casacore/casa/BasicSL/Complex.h>
37 # include <casacore/casa/BasicSL/IComplex.h>
38 # include <casacore/fits/FITS/FITSError.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# All FITS code seems to assume longs are 4 bytes. To take care of machines
43 //# for which this isn't true use FitsLong instead of Long in the FITS code
44 //# where it matters.
45 # if (defined(__alpha) || defined(__sgi) || defined(__x86_64__))
46  typedef Int FitsLong;
47 # else
48  typedef Long FitsLong;
49 # endif
50 //# recovered by GYL
51 
52 //# Forward declarations
53 class ReservedFitsKeywordCollection;
54 class FitsNameResult;
55 class FitsValueResult;
56 class FitsKeyword;
57 class FitsParse;
58 
59 //<summary> FITS templated helper class </summary>
60 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
61 // </reviewed>
62 //<synopsis>
63 // NoConvert is a template class that is not intended for
64 // general use, it is used internally.
65 //</synopsis>
66 
67 template <class TYPE>
68 class NoConvert {
69  public:
70  NoConvert() { }
71  void operator = (int) {; }
72 };
73 
74 //<summary> FITS helper class </summary>
75 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
76 // </reviewed>
77 //<synopsis>
78 // FitsLogical is a helper class that is not intended for
79 // general use.
80 //</synopsis>
81 //<example>
82 // Here is an example of the FitsLogical class.
83 //<srcblock>
84 // FitsLogical x;
85 // FitsLogical y(True);
86 // FitsLogical z = x;
87 // ...
88 // x = y; y = False; x.undefine();
89 // Bool b;
90 // if (x.isdefined())
91 // b = x;
92 // b = y; If y is undefined, b will be false.
93 //</srcblock>
94 //</example>
95 class FitsLogical {
96  friend ostream & operator << (ostream &o, const FitsLogical &);
97  public:
98  FitsLogical() : v('\0') { }
99  FitsLogical(Bool x) { v = (x == True ? 'T' : 'F'); }
100  FitsLogical(const FitsLogical &x) : v(x.v) { }
102  v = x.v; return *this; }
104  v = (x == True ? 'T' : 'F'); return *this; }
105  Bool isdefined() const { return v == '\0' ? True : False; }
106  void undefine() { v = '\0'; }
107  operator Bool() { return (v == 'T' ? True : False); }
108  protected:
109  char v;
110 };
111 
112 //<summary> helper class for FITS Binary Tables </summary>
113 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
114 // </reviewed>
115 //<synopsis>
116 // This class is not intended for general use. It only has meaning
117 // in the context of FITS Binary tables. There its use is incorporated
118 // into the concept of a FitsField, where FitsBit is given a specialized
119 // interpretation.
120 //</synopsis>
121 
122 class FitsBit {
123  public:
124  FitsBit() : bit_array(0) { }
125  FitsBit(unsigned char x) : bit_array(x) { }
126  FitsBit(const FitsBit &x) : bit_array(x.bit_array) { }
127  FitsBit & operator = (const FitsBit &x) {
128  bit_array = x.bit_array; return *this; }
129  FitsBit & operator = (unsigned char x) { bit_array = x; return *this; }
130  operator unsigned char() { return bit_array; }
131  protected:
132  unsigned char bit_array;
133 };
134 
135 //<summary> Variable Length Array Descriptor </summary>
136 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
137 // </reviewed>
138 
139 class FitsVADesc {
140  friend ostream & operator << (ostream &o, const FitsVADesc &);
141  public:
142  FitsVADesc() : no_elements(0), rel_offset(0) { }
143  FitsVADesc(const FitsVADesc &x) :
144  no_elements(x.no_elements), rel_offset(x.rel_offset) { }
146  no_elements= x.no_elements;
147  rel_offset = x.rel_offset; return *this; }
148  FitsVADesc(int n, int o) : no_elements(n), rel_offset(o) { }
149  void set(int n, int o) { no_elements = n; rel_offset = o; }
150  int num() const { return no_elements; }
151  int offset() const { return rel_offset; }
152  protected:
155 };
156 
157 //<summary> static functions and enumerations </summary>
158 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
159 // </reviewed>
160 //<synopsis>
161 // Many of the static functions are utility functions used internally in the
162 // implementation of the member functions of the FITS classes. They are placed
163 // in a single class to encapsulate them and to avoid adding many names to the
164 // global name space. More important, from the user's perspective, are the
165 // enumerations. They form the basic vocabulary of a FITS application. For example,
166 // instead of referring to the FITS <src>NAXIS</src> keyword,
167 // <src>FITS::NAXIS</src> should be used
168 //</synopsis>
169 
170 class FITS {
171  public:
172 
173  // FITS I/O Error message types
174 
175  // Basic FITS Data Types for keywords and data
176  enum ValueType {
177  NOVALUE = 0, LOGICAL = 1, BIT = 2, CHAR = 3, BYTE = 4,
178  SHORT = 5, LONG = 6, FLOAT = 7, DOUBLE = 8, COMPLEX = 9,
179  ICOMPLEX = 10, DCOMPLEX = 11, VADESC = 12,
180  STRING, FSTRING, REAL
181  }; // REAL means either FLOAT or DOUBLE
182  // STRING and FSTRING are used internally in parsing keywords
183 
185  x=0; return FITS::LOGICAL; }
187  x=0; return FITS::BIT; }
189  x=0; return FITS::CHAR; }
191  x=0; return FITS::BYTE; }
193  x=0; return FITS::SHORT; }
195  x=0; return FITS::LONG; }
197  x=0; return FITS::LONG; }
199  x=0; return FITS::FLOAT; }
201  x=0; return FITS::DOUBLE; }
203  x=0; return FITS::COMPLEX; }
205  x=0; return FITS::ICOMPLEX; }
207  x=0; return FITS::DCOMPLEX; }
209  x=0; return FITS::VADESC; }
210 
211  static int fitssize(FITS::ValueType t);
212  static int localsize(FITS::ValueType t);
213 
214  // data conversion routines: FITS - local
215  static void f2l(FitsLogical *,void *,int);
216  static void l2f(void *,FitsLogical *,int);
217  static void f2l(FitsBit *,void *,int);
218  static void l2f(void *,FitsBit *,int);
219  static void f2l(char *,void *,int);
220  static void l2f(void *,char *,int);
221  static void f2l(unsigned char *,void *,int);
222  static void l2f(void *,unsigned char *,int);
223  static void f2l(short *,void *,int);
224  static void l2f(void *,short *,int);
225  static void f2l(Int *,void *,int);
226  static void l2f(void *,Int *,int);
227  static void f2l(long *,void *,int);
228  static void l2f(void *,long *,int);
229  static void f2l(float *,void *,int);
230  static void l2f(void *,float *,int);
231  static void f2l(double *,void *,int);
232  static void l2f(void *,double *,int);
233  static void f2l(Complex *,void *,int);
234  static void l2f(void *,Complex *,int);
235  static void f2l(IComplex *,void *,int);
236  static void l2f(void *,IComplex *,int);
237  static void f2l(DComplex *,void *,int);
238  static void l2f(void *,DComplex *,int);
239  static void f2l(FitsVADesc *,void *,int);
240  static void l2f(void *,FitsVADesc *,int);
241  static void swap2(void *, void *, int);
242  static void swap4(void *, void *, int);
243  static void swap8(void *, void *, int);
244 
245  // FITS Reserved Names. PZERO is named strangely because it can conflict with
246  // a standard #define in sys/param.h.
248  USER_DEF, AUTHOR, BITPIX, BLANK, BLOCKED, BSCALE,
249  BUNIT, BZERO, CDELT, COMMENT, CROTA, CRPIX,
250  CRVAL, CTYPE, DATAMAX, DATAMIN, DATE, DATE_OBS,
251  END, EPOCH, EQUINOX, EXTEND, EXTLEVEL, EXTNAME,
252  EXTVER, GCOUNT, GROUPS, HISTORY, INSTRUME, NAXIS,
253  OBJECT, OBSERVER, ORIGIN, PCOUNT, PSCAL, PTYPE,
254  PZERO_FITS, REFERENC, SIMPLE, SPACES, TBCOL, TDIM,
255  TDISP, TELESCOP, TFIELDS, TFORM, THEAP, TNULL,
256  TSCAL, TTYPE, TUNIT, TZERO, XTENSION, ERRWORD,
257  ALTRPIX, DATE_MAP
258  };
259 
260  // Types of FITS Records
261  enum FitsRecType {
262  InitialState, BadBeginningRecord, HDURecord,
263  UnrecognizableRecord, SpecialRecord, EndOfFile
264  };
265 
266  // Supported FITS Physical Devices
267  enum FitsDevice {
268  Disk, Std, Tape9
269  };
270 
271  // Types of FITS Header-Data Units
272  enum HDUType {
273  NotAHDU, PrimaryArrayHDU, PrimaryGroupHDU, AsciiTableHDU,
274  BinaryTableHDU, ImageExtensionHDU, UnknownExtensionHDU,
275  PrimaryTableHDU
276  };
277 
278  // Options on FITS array manipulations
279  enum FitsArrayOption { NoOpt = 0, CtoF = 1, FtoC = 2};
280 
282  static void valstr(ostream &o, const ValueType &ty, const void *val);
283  static Bool isa_digit(char c);
284  static int digit2bin(char c);
285  static Bool isa_text(char c);
286  static Bool isa_letter(char);
287  static int letter2bin(char);
288  static void fstr2str(char *, const char *, int);
289  static int str2fstr(char *, const char *, int);
290  static void get_name(const char *s, int len, FitsNameResult &result);
291  static int get_value_id(const char *s, int l, int &pos);
292  static void get_value(const char *s, int len, FitsValueResult &result);
293  static int trim_comment(const char *s, int len);
294  static int chk_comment(const char *s, int len);
295  static int get_comment(const char *s, int len, int &begpos);
296  static void get_numeric(const char *s, int len, FitsValueResult &result);
297  // utility function to parse the binary table variable array
298  // column (i.e. uses the heap) of the form nPt(dddd) where n
299  // is either 0 or 1, t is one of the standard FITS binary table
300  // column types and dddd is the maximum number of elements used
301  // by this column. If there is a format error in the input
302  // string (*s), then valType will have the value NOVALUE and
303  // maxelem will be -1.
304  static void parse_vatform(const char *s, FITS::ValueType &valType,
305  int &maxelem);
306  static const Int minInt;
307  static const Int maxInt;
308  static const float minfloat;
309  static const float maxfloat;
310  static const double mindouble;
311  static const double maxdouble;
312 
313  private:
314  FITS();
315  static double tenpowerD[309];
316  static float tenpowerF[39];
317  static const int minfltexp;
318  static const int maxfltexp;
319  static const int mindblexp;
320  static const int maxdblexp;
321  static const int maxsigdigits;
322  static const int maxdigl; // max digits in a long
323  static const int maxexpdig; // max digits in an exponent
324  static double tenD(Int, int);
325  static float tenF(Int, int);
326  static int ckaccum(double &, Int, int);
327  static int ckaccum(float &, Int, int);
328 };
329 
330 inline FITS::FITS() { } // just a dummy function to prevent instantiation
331 inline Bool FITS::isa_digit(char c) { return isdigit(c) ? True : False; }
332 inline int FITS::digit2bin(char c) { return c - '0'; }
333 inline Bool FITS::isa_text(char c) { return isprint(c) ? True : False; }
334 inline Bool FITS::isa_letter(char c) { return isupper(c) ? True : False; }
335 inline int FITS::letter2bin(char c) { return c - 'A'; }
336 
337 ostream & operator << (ostream &, const FITS::ValueType &);
338 
339 inline double FITS::tenD(Int numb, int pow) {
340  return (pow > 0) ? (((double)numb) * tenpowerD[pow]) :
341  ((pow < 0) ? (((double)numb) / tenpowerD[-pow]) : ((double)numb));
342 }
343 inline float FITS::tenF(Int numb, int pow) {
344  return (pow > 0) ? (((float)numb) * tenpowerF[pow]) :
345  ((pow < 0) ? (((float)numb) / tenpowerF[-pow]) : ((float)numb));
346 }
347 
348 //<summary> reserved FITS keyword </summary>
349 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
350 // </reviewed>
351 
353  public:
354  const char *aname() const;
355  FITS::ReservedName name() const;
356  int namesize() const;
357  FITS::ValueType type() const;
358  Bool isindexed() const;
359  Bool isessential() const;
360 # if defined(TURBOCPP)
361  // It is best for the following to be private, but
362  // C-Front won't allow an initializer list if they are private.
363  // This issue isn't that crucial since functions in
364  // ReservedFitsKeywordCollection always return const items.
365  private:
366 # endif
368  const char *aname_;
371  Bool isindexed_; // 0 = NOT INDEXED, 1 = INDEXED
372  Bool isessential_; // 0 = NO, 1 = YES
373 };
374 
375 inline const char *ReservedFitsKeyword::aname() const { return aname_; }
376 inline int ReservedFitsKeyword::namesize() const { return namesize_; }
377 inline FITS::ValueType ReservedFitsKeyword::type() const { return type_; }
378 inline Bool ReservedFitsKeyword::isindexed() const { return isindexed_; }
380  return isessential_; }
381 
382 //<summary> collection of reserved FITS keywords </summary>
383 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
384 // </reviewed>
385 
387  public:
388  const ReservedFitsKeyword & operator [] (int i) const;
389  int no() const;
391  const void *, int, const char *&) const;
392  const ReservedFitsKeyword &get(const char *, int, Bool, FITS::ValueType,
393  const void *, int, const char *&) const;
394  const char *aname(FITS::ReservedName) const;
395  int essential_name(const char *, int) const;
396  const ReservedFitsKeyword &get_essential(int, Bool, FITS::ValueType,
397  const void *, int, const char *&) const;
398  int isreserved(const char *, int) const;
399  Bool isunique(int) const;
400  Bool requires_value(int) const;
401  const ReservedFitsKeyword &userdef_item() const;
402  const ReservedFitsKeyword &err_item() const;
403  const ReservedFitsKeyword &end_item() const;
404  const ReservedFitsKeyword &spaces() const;
405  const ReservedFitsKeyword &comment() const;
406  const ReservedFitsKeyword &history() const;
407  int rules(const ReservedFitsKeyword &, const char *, int, Bool,
408  FITS::ValueType, const void *, int, const char *&) const;
409  private:
410  static const int no_items; // number of entries in the table
411  static const ReservedFitsKeyword &user_def_item; // user-defined keyword
412  static const ReservedFitsKeyword &error_item; // error in keyword
417  static const ReservedFitsKeyword resword[]; // table of reserved words
418  static const int resalpha[26]; // alphabetic index to table
419  const ReservedFitsKeyword &match(int, const char *, int, Bool,
420  FITS::ValueType, const void *, int, const char *&) const;
421 
422 };
423 
425  operator [] (int i) const { return resword[i]; }
426 inline int ReservedFitsKeywordCollection::no() const { return no_items; }
428  return (Bool)(resword[i + 1].name() != resword[i].name()); }
430  const { return user_def_item; }
432  const { return error_item; }
434  const { return end__item; }
436  const { return spaces_item; }
438  const { return comment_item; }
440  const { return history_item; }
441 
442 //<summary> analyse the name of a header card </summary>
443 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
444 // </reviewed>
445 //<synopsis>
446 // Analyse the name of a header card
447 //</synopsis>
448 
450  public:
451  Bool isaname; // 1 if there is a name present, otherwise 0
452  int begpos; // beginning position of name
453  int endpos; // ending position of name
454  Bool isaindex; // whether an index is present or not
455  int index; // index if present
456  int len; // length of name without index
457  enum ErrMsg { OK = 0, NO_0_NDX };
459 };
460 
461 //<summary> analyse the value of a header card </summary>
462 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
463 // </reviewed>
464 //<synopsis>
465 // Analyse the value of a header card
466 //</synopsis>
467 
469  public:
471  union {
473  int s[2]; // for strings, s[0] is offset, s[1] length
475  float f;
476  double d;
477  };
481  int begpos; // beginning position of value
482  int endpos; // ending position of value
483  Bool isa_point; // 1 if a point, otherwise 0
484  int pointpos; // position of point, if any
485  int no_sig; // number of significant digits
486  const char *errmsg; // error message, if any
487 };
488 
489 //<summary> parse a header card </summary>
490 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
491 // </reviewed>
492 //<synopsis>
493 // parse a header card
494 //</synopsis>
495 
496 class FitsParse {
497  friend class FitsKeywordList;
498  public:
499  FitsKeyword &parse(const char *, int); // Parsing one string
500  int no_errs() const;
501  const char *err(int) const;
502  private:
503  FitsParse(int = 10);
504  ~FitsParse();
505  int no_errs_;
506  const int max_errs;
507  const char **err_;
508  int seterr(const char *);
509  FitsKeyword &mkerr(const char *s, int len);
510 };
511 
512 inline FitsParse::~FitsParse() { delete [] err_; }
513 inline int FitsParse::no_errs() const { return no_errs_; }
514 inline const char *FitsParse::err(int i) const { return err_[i]; }
515 inline int FitsParse::seterr(const char *s) {
516  return no_errs_ < max_errs ? ( err_[no_errs_++] = s, 0) : -1; }
517 
518 //<summary> FITS keyword </summary>
519 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
520 // </reviewed>
521 //<synopsis>
522 // A FITS keyword contains a name, a value and a comment.
523 //</synopsis>
524 class FitsKeyword {
525  friend class FitsKeywordList;
526  friend class FitsParse;
527  // A word about friends: FitsKeywordList accesses the next and prev
528  // pointers and the FitsKeyword constructors.
529  // FitsParse only accesses the FitsKeyword constructors.
530 
531  public:
532 
533  FitsKeyword(const FitsKeyword &);
535  ~FitsKeyword();
536 
537  //<group>
538  // get info about the name
539  const char *name() const;
540  int namelen() const;
541  Bool isreserved() const;
542  Bool isindexed() const;
543  const ReservedFitsKeyword &kw() const;
544  int index() const;
545  //</group>
546 
547  //<group>
548  // access the keyword comment
549  const char *comm() const;
550  int commlen() const;
551  //</group>
552 
553  // access the error status
554  int err() const;
555 
556  // the datatype of the keyword
557  FITS::ValueType type() const;
558 
559  // access the value of the keyword
560  //<group>
561  Bool asBool() const;
562  const char *asString() const;
563  int valStrlen() const;
564  Int asInt() const;
565  float asFloat() const;
566  double asDouble() const;
567  IComplex asIComplex() const;
568  Complex asComplex() const;
569  DComplex asDComplex() const;
570  const void *value() const;
571  //</group>
572 
573  // change the value of the keyword
574  //<group>
576  FitsKeyword & operator = (const char *);
578  FitsKeyword & operator = (float);
579  FitsKeyword & operator = (double);
583  //</group>
584 
585  // change the comment of the keyword
586  void comm(const char *);
587 
588  // change the name of the keyword
589  void name(const char *);
590 
591  private:
594 
595  //<group>
596  // the keyword name
597  // if name_ is 0, keyword is not a user defined name
598  // if ndx is 0, there is no index
599  char *name_;
601  int ndx;
602  short namelen_;
603  //</group>
604 
605  //<group>
606  // the keyword comment
607  // if comm_ is 0, there is no comment
608  char *comm_;
609  short commlen_;
610  //</group>
611 
612 
613  //<group>
614  // the keyword value
616  union {
619  float fval;
620  double dval;
621  };
622  void *val; // pointer to allocated value, if any
623  short vallen; // only used for string data
624  void del_val(); // does an appropriate delete based on type
625  //</group>
626 
627  void init(const FitsKeyword &);
628  void setval(const FITS::ValueType &, const void *, int);
629  void setcomm(const char *, int);
630  static void err(const char *, const FITS::ValueType &, const void *,
631  const char *);
632  static void memchk(void *);
633 
634  //<group>
635  // private constructors for use by friends
636 
637  // constructs user-defined keywords
638  // parms: name, namelen, type, val, vallen, comm, commlen
639  FitsKeyword(const char *, int ,
640  FITS::ValueType, const void *, int, const char *, int);
641  // constructs reserved keywords
642  // parms: resword, index, val, vallen, comm, commlen
643  FitsKeyword(const ReservedFitsKeyword *, int,
644  FITS::ValueType, const void *, int, const char *, int);
645  //</group>
646 
647 
648 };
649 
650 ostream & operator << (ostream &, const FitsKeyword &);
651 
652 inline FitsKeyword::FitsKeyword(const FitsKeyword &k) : next_(0), prev_(0),
653  name_(0), kw_(0), comm_(0), val(0) { init(k); }
655  delete [] name_; delete [] comm_; del_val(); init(k); return *this; }
657  delete [] name_;
658  delete [] comm_;
659  del_val();
660 }
661 
662 inline const ReservedFitsKeyword &FitsKeyword::kw() const { return *kw_; }
663 inline Bool FitsKeyword::isreserved() const { return
664  (kw().name() != FITS::ERRWORD && kw().name() != FITS::USER_DEF)
665  ? True : False; }
666 inline const char *FitsKeyword::name() const {
667  return isreserved() ? kw().aname() : (namelen_ ? name_ : ""); }
668 inline int FitsKeyword::namelen() const { return namelen_; }
669 inline Bool FitsKeyword::isindexed() const {return ndx > 0 ? True : False;}
670 inline int FitsKeyword::index() const { return ndx; }
671 
672 inline const char *FitsKeyword::comm() const {
673  return comm_ ? comm_ : ""; }
674 inline int FitsKeyword::commlen() const { return commlen_; }
675 inline int FitsKeyword::err() const { return (kw().name() == FITS::ERRWORD); }
676 inline FITS::ValueType FitsKeyword::type() const { return type_; }
677 
678 inline Bool FitsKeyword::asBool() const { return bval; }
679 inline const char *FitsKeyword::asString() const {
680  return vallen ? (const char *)val : ""; }
681 inline int FitsKeyword::valStrlen() const { return vallen; }
682 inline Int FitsKeyword::asInt() const {
683  if( type() != FITS::LONG ) {
684  cerr << "Unexpected keyword type in FitsKeyword::asInt()\n";
685  exit(1);
686  }
687  return ival;
688 }
689 inline float FitsKeyword::asFloat() const {
690  switch( type() ) {
691  case FITS::BYTE:
692  case FITS::SHORT:
693  case FITS::LONG: return (float)ival;
694  case FITS::FLOAT: return fval;
695  case FITS::DOUBLE: return (float)dval;
696  default:
697  cerr << "Unexpected keyword type in asFloat()\n";
698  exit(1);
699  }
700  return 0.0;
701 }
702 inline double FitsKeyword::asDouble() const {
703  switch( type() ) {
704  case FITS::BYTE:
705  case FITS::SHORT:
706  case FITS::LONG: return (double)ival;
707  case FITS::FLOAT: return (double)fval;
708  case FITS::DOUBLE: return dval;
709  default:
710  cerr << "Unexpected keyword type in asDouble()\n";
711  exit(1);
712  }
713  return 0.0;
714 }
716  return *((IComplex *)val); }
718  return *((Complex *)val); }
720  return *((DComplex *)val); }
721 
723  bval = x; type_ = FITS::LOGICAL; return *this; }
725  ival = x; type_ = FITS::LONG; return *this; }
727  fval = x; type_ = FITS::FLOAT; return *this; }
729  dval = x; type_ = FITS::DOUBLE; return *this; }
731  *((IComplex *)val) = x; type_ = FITS::ICOMPLEX; return *this; }
733  *((Complex *)val) = x; type_ = FITS::COMPLEX; return *this; }
735  *((DComplex *)val) = x; type_ = FITS::DCOMPLEX; return *this; }
736 
737 class ConstFitsKeywordList; // forward declaration
738 
739 //<summary> linked list of FITS keywords </summary>
740 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
741 // </reviewed>
742 //<synopsis>
743 // A linked list of FITS keywords.
744 //</synopsis>
745 
747  public:
748  FitsKeywordList();
749  ~FitsKeywordList();
753 
754  // Convert the list to a string containing the 80-byte FITS headers.
755  std::string toString() const;
756 
757  // delete the current keyword (the thing returned by curr()) from the list
758  void del();
759 
760  // Add (make) a reserved keyword with the given value and optional comment
761  // The comment will be truncated if necessary to fit the available space.
762  // String values must be less than 69 characters. String values longer than
763  // that will result in an ERROR keyword instead of the desired keyword.
764  // <group>
765  void mk(FITS::ReservedName k, Bool v, const char *c = 0);
766  void mk(FITS::ReservedName k, const char *v = 0, const char *c = 0);
767  void mk(FITS::ReservedName k, Int v, const char *c = 0);
768  void mk(FITS::ReservedName k, long v, const char *c = 0);
769  void mk(FITS::ReservedName k, double v, const char *c = 0);
770  // </group>
771 
772  // Add (make) an indexed reserved keyword with the given value and optional comment
773  // The comment will be truncated if necessary to fit the available space.
774  // String values must be less than 69 characters. String values longer than
775  // that will result in an ERROR keyword instead of the desired keyword.
776  // <group>
777  void mk(int n, FITS::ReservedName k, Bool v, const char *c = 0);
778  void mk(int n, FITS::ReservedName k, const char *v, const char *c = 0);
779  void mk(int n, FITS::ReservedName k, Int v, const char *c = 0);
780  void mk(int n, FITS::ReservedName k, long v, const char *c = 0);
781  void mk(int n, FITS::ReservedName k, double v, const char *c = 0);
782  // </group>
783 
784  // Add (make) a user defined keyword with the given name, value and optional comment.
785  // The comment will be truncated if necessary to fit the available space.
786  // The name must be no longer than 8 characters. Names longer than that will
787  // result in an ERROR keyword instead of the desired keyword.
788  // String values must no longer than 69 characters. String values longer than
789  // that will result in an ERROR keyword instead of the desired keyword.
790  // <group>
791  void mk(const char *n, Bool v, const char *c = 0);
792  void mk(const char *n, const char *v = 0, const char *c = 0);
793  void mk(const char *n, Int v, const char *c = 0);
794  void mk(const char *n, long v, const char *c = 0);
795  void mk(const char *n, float v, const char *c = 0);
796  void mk(const char *n, double v, const char *c = 0);
797  void mk(const char *n, Int r, Int i, const char *c = 0);
798  void mk(const char *n, float r, float i, const char *c = 0);
799  void mk(const char *n, double r, double i, const char *c = 0);
800  // </group>
801 
802  // add a spaces line
803  void spaces(const char *n = 0, const char *c = 0);
804 
805  // add a comment card
806  void comment(const char *n = 0, const char *c = 0);
807 
808  // add a history card
809  void history(const char *c = 0);
810 
811  // add the end card. This must be at the end of the list.
812  void end();
813 
814  // Retrieve specific keywords -- these also set the current mark
815  //<group>
816  // return the i-th keyword -- keyword numbering starts with 0
817  FitsKeyword * operator () (int);
818  // return first and next non-indexed reserved keyword
819  FitsKeyword * operator () (const FITS::ReservedName &);
820  FitsKeyword * next(const FITS::ReservedName &);
821  // return first and next indexed reserved keyword
822  FitsKeyword * operator () (const FITS::ReservedName &, int);
823  FitsKeyword * next(const FITS::ReservedName &, int);
824  // return first and next user-defined keyword
825  FitsKeyword * operator () (const char *);
826  FitsKeyword * next(const char *);
827  //</group>
828 
829  //<group>
830  Bool isempty() const;
831  void first();
832  void last();
833  FitsKeyword *next();
834  FitsKeyword *prev();
835  FitsKeyword *curr();
836  //</group>
837 
838  //<group>
839  void delete_all();
840  int rules(FitsKeyword &,
842  int rules(FITSErrorHandler errhandler = FITSError::defaultHandler);
843  Bool basic_rules();
844  //</group>
845 
846  //<group>
847  // For parsing a single string
848  void parse(const char *, int);
849  int no_parse_errs() const;
850  const char *parse_err(int) const;
851  //</group>
852 
853  void insert(FitsKeyword &);
854  private:
858  int total;
859  int cursor;
860  FitsKeyword &make(const char *nm,
861  FITS::ValueType t, const void *v, const char *c);
863  FITS::ValueType t, const void *v, const char *c);
864  FitsKeyword &make(int ind, FITS::ReservedName nm,
865  FITS::ValueType t, const void *v, const char *c);
866  // construct an error keyword - this happens when a name is invalid (NULL
867  // or more than 8 characters) or a string value is too long (more than
868  // 69 characters). It is the responsibility of the caller to the
869  // several mk functions to ensure that that doesn't happen. By the time
870  // it gets here, it is assumed that such problems are true errors.
871  // This is used by the private make functions.
872  FitsKeyword &makeErrKeyword(const char *name, FITS::ValueType type,
873  const void *val, const char *errmsg);
875 };
876 
877 ostream & operator << (ostream &o, FitsKeywordList &); // print the entire list
878 
879 inline FitsKeywordList::FitsKeywordList() : beg_(0), end_(0), pos(0),
880  total(0), cursor(0) { }
882 inline Bool FitsKeywordList::isempty() const { return total == 0 ? True : False; }
883 inline void FitsKeywordList::first() { cursor = 0; pos = beg_; }
884 inline void FitsKeywordList::last() { cursor = total; pos = end_; }
885 inline FitsKeyword *FitsKeywordList::curr() { return pos; }
887  first(); return next(n); }
889  int ndx) { first(); return next(n,ndx); }
891  first(); return next(w); }
892 inline void FitsKeywordList::parse(const char *s, int l) {
893  insert(card.parse(s,l)); }
894 inline int FitsKeywordList::no_parse_errs() const { return card.no_errs();}
895 inline const char *FitsKeywordList::parse_err(int n) const {
896  return card.err(n); }
897 
898 // FitsKeyword constructors for non-indexed Reserved keywords
899 inline void FitsKeywordList::mk(FITS::ReservedName k, Bool v, const char *c) {
900  insert(make(k,FITS::LOGICAL,&v,c)); }
901 inline void FitsKeywordList::mk(FITS::ReservedName k, const char *v,
902  const char *c) { insert(make(k,FITS::STRING,v,c)); }
903 inline void FitsKeywordList::mk(FITS::ReservedName k, Int v, const char *c) {
904  insert(make(k,FITS::LONG,&v,c)); }
905 inline void FitsKeywordList::mk(FITS::ReservedName k, long v, const char *c) {
906  insert(make(k,FITS::LONG,&v,c)); }
907 inline void FitsKeywordList::mk(FITS::ReservedName k, double v, const char *c) {
908  insert(make(k,FITS::DOUBLE,&v,c)); }
909 // FitsKeyword constructors for indexed Reserved keywords
910 inline void FitsKeywordList::mk(int n, FITS::ReservedName k, Bool v,
911  const char *c) {
912  Bool tmp; tmp = v; insert(make(n,k,FITS::LOGICAL,&tmp,c)); }
913 inline void FitsKeywordList::mk(int n, FITS::ReservedName k, const char *v,
914  const char *c) { insert(make(n,k,FITS::STRING,v,c)); }
915 inline void FitsKeywordList::mk(int n, FITS::ReservedName k, Int v,
916  const char *c) { insert(make(n,k,FITS::LONG,&v,c)); }
917 inline void FitsKeywordList::mk(int n, FITS::ReservedName k, long v,
918  const char *c) { insert(make(n,k,FITS::LONG,&v,c)); }
919 inline void FitsKeywordList::mk(int n, FITS::ReservedName k, double v,
920  const char *c) { insert(make(n,k,FITS::DOUBLE,&v,c)); }
921 // FitsKeyword constructors for User-Defined keywords
922 inline void FitsKeywordList::mk(const char *n, Bool v, const char *c) {
923  Bool tmp; tmp = v; insert(make(n,FITS::LOGICAL,&tmp,c)); }
924 inline void FitsKeywordList::mk(const char *n, const char *v, const char *c) {
925  insert(make(n,FITS::STRING,v,c)); }
926 inline void FitsKeywordList::mk(const char *n, Int v, const char *c) {
927  insert(make(n,FITS::LONG,&v,c)); }
928 inline void FitsKeywordList::mk(const char *n, long v, const char *c) {
929  insert(make(n,FITS::LONG,&v,c)); }
930 inline void FitsKeywordList::mk(const char *n, float v, const char *c) {
931  insert(make(n,FITS::FLOAT,&v,c)); }
932 inline void FitsKeywordList::mk(const char *n, double v, const char *c) {
933  insert(make(n,FITS::DOUBLE,&v,c)); }
934 inline void FitsKeywordList::mk(const char *n, Int r, Int i, const char *c) {
935  IComplex v(r,i);
936  insert(make(n,FITS::ICOMPLEX,&v,c)); }
937 inline void FitsKeywordList::mk(const char *n, float r, float i, const char *c)
938  { Complex v(r,i); insert(make(n,FITS::COMPLEX,&v,c)); }
939 inline void FitsKeywordList::mk(const char *n, double r, double i,
940  const char *c) { DComplex v(r,i);
941  insert(make(n,FITS::DCOMPLEX,&v,c)); }
942 // Additional keyword constructors for commentary, etc.
943 inline void FitsKeywordList::spaces(const char *n, const char *c) {
944  insert((n == 0 ? make(FITS::SPACES,FITS::NOVALUE,0,c) :
945  (c == 0 ? make(FITS::SPACES,FITS::NOVALUE,0,n) :
946  make(n,FITS::NOVALUE,0,c)))); }
947 inline void FitsKeywordList::comment(const char *n, const char *c) {
948  insert((n == 0 ? make(FITS::COMMENT,FITS::NOVALUE,0,c) :
949  (c == 0 ? make(FITS::COMMENT,FITS::NOVALUE,0,n) :
950  make(n,FITS::NOVALUE,0,c)))); }
951 inline void FitsKeywordList::history(const char *c) {
953 inline void FitsKeywordList::end() {
955 
956 //<summary> list of read-only FITS keywords </summary>
957 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
958 // </reviewed>
959 
961  public:
963 
964  const FitsKeyword * operator () (int n) { return kw(n); }
966  return kw(x); }
967  const FitsKeyword * next(const FITS::ReservedName &x) {
968  return kw.next(x); }
969  const FitsKeyword * operator () (const FITS::ReservedName &x, int n) {
970  return kw(x,n); }
971  const FitsKeyword * next(const FITS::ReservedName &x, int n) {
972  return kw.next(x,n); }
973  const FitsKeyword * operator () (const char *x) { return kw(x); }
974  const FitsKeyword * next(const char *x) { return kw.next(x); }
975 
976  Bool isempty() const { return kw.isempty(); }
977  void first() { kw.first(); }
978  void last() { kw.last(); }
979  const FitsKeyword *next() { return kw.next(); }
980  const FitsKeyword *prev() { return kw.prev(); }
981  const FitsKeyword *curr() { return kw.curr(); }
982 
983  private:
985 };
986 
987 //<summary> translator between Keyword lists and fixed FITS cars </summary>
988 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
989 // </reviewed>
990 //<synopsis>
991 // also contains the parser ???
992 //</synopsis>
993 
995  public:
996  FitsKeyCardTranslator(int = 100);
998  FitsKeywordList & parse(const char *,
1000  int build(char *, FitsKeywordList &);
1001  int no_errs() const;
1002  const char *err(int) const;
1003  int err_cardno(int) const;
1004  static void fmtcard(char *, const FitsKeyword &);
1005  private:
1006  int cardno; // the current card number within record
1007  const int FitsCardSize;
1008  const int FitsMaxCard;
1009  const int FitsRecSize;
1012  const char **err_;
1014  char *blanks;
1015 };
1016 
1018  delete [] err_; delete [] err_cardno_; delete [] blanks; }
1019 inline int FitsKeyCardTranslator::no_errs() const { return no_errs_; }
1020 inline const char *FitsKeyCardTranslator::err(int i) const { return err_[i]; }
1021 inline int FitsKeyCardTranslator::err_cardno(int i) const {
1022  return err_cardno_[i]; }
1023 
1024 // <summary>Utility functions for floating point values</summary>
1025 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
1026 // </reviewed>
1028 {
1029 public:
1030  // These functions are useful to tell if some type is a floating point type.
1031  // This is useful in a templated function, where the processing can vary
1032  // depending on whether the type is FP or not (e.g. blank handling).
1033  // <group>
1034  static Bool isFP(const float *);
1035  static Bool isFP(const double *);
1036  static Bool isFP(const void *);
1037  // </group>
1038 
1039  // For blanking purposes, we need to be able to get a NaN. The NaN we set
1040  // is all bits on.
1041  // <group>
1042  static void setNaN(double &val);
1043  static void setNaN(float &val);
1044  // </group>
1045 };
1046 
1047 
1048 } //# NAMESPACE CASACORE - END
1049 
1050 # endif
int namelen() const
Definition: fits.h:668
static const ReservedFitsKeyword & user_def_item
Definition: fits.h:411
FitsVADesc(const FitsVADesc &x)
Definition: fits.h:143
int valStrlen() const
Definition: fits.h:681
Bool isreserved() const
Definition: fits.h:663
int index() const
Definition: fits.h:670
int Int
Definition: aipstype.h:47
static FITS::ValueType getfitstype(NoConvert< DComplex > x)
Definition: fits.h:206
const char * aname() const
Definition: fits.h:375
static int digit2bin(char c)
Definition: fits.h:332
FitsBit(const FitsBit &x)
Definition: fits.h:126
reserved FITS keyword
Definition: fits.h:352
IComplex asIComplex() const
Definition: fits.h:715
FitsKeyword & operator=(const FitsKeyword &)
Definition: fits.h:654
static const int minfltexp
Definition: fits.h:317
FITS templated helper class.
Definition: fits.h:68
unsigned char bit_array
Definition: fits.h:132
Bool isessential() const
Definition: fits.h:379
void parse(const char *, int)
For parsing a single string.
Definition: fits.h:892
const char * parse_err(int) const
Definition: fits.h:895
friend class FitsKeywordList
Definition: fits.h:525
static const ReservedFitsKeyword & error_item
Definition: fits.h:412
int namesize() const
Definition: fits.h:376
DComplex asDComplex() const
Definition: fits.h:719
void mk(FITS::ReservedName k, Bool v, const char *c=0)
Add (make) a reserved keyword with the given value and optional comment The comment will be truncated...
Definition: fits.h:899
const FitsKeyword * next(const FITS::ReservedName &x, int n)
Definition: fits.h:971
FitsKeyword * pos
Definition: fits.h:857
const ReservedFitsKeyword & spaces() const
Definition: fits.h:435
int commlen() const
Definition: fits.h:674
Bool isindexed() const
Definition: fits.h:669
FitsLogical(Bool x)
Definition: fits.h:99
Bool isindexed() const
Definition: fits.h:378
void comment(const char *n=0, const char *c=0)
add a comment card
Definition: fits.h:947
struct Node * first
Definition: malloc.h:330
const ReservedFitsKeyword & kw() const
Definition: fits.h:662
int no_parse_errs() const
Definition: fits.h:894
const ReservedFitsKeyword & userdef_item() const
Definition: fits.h:429
void insert(FitsKeyword &)
FitsKeyword(const FitsKeyword &)
A word about friends: FitsKeywordList accesses the next and prev pointers and the FitsKeyword constru...
Definition: fits.h:652
Bool isempty() const
Definition: fits.h:882
int offset() const
Definition: fits.h:151
FitsLogical(const FitsLogical &x)
Definition: fits.h:100
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
Complex asComplex() const
Definition: fits.h:717
const char * asString() const
Definition: fits.h:679
const ReservedFitsKeyword & end_item() const
Definition: fits.h:433
static functions and enumerations
Definition: fits.h:170
void init(const FitsKeyword &)
static FITS::ValueType getfitstype(NoConvert< IComplex > x)
Definition: fits.h:204
parse a header card
Definition: fits.h:496
FITS::ValueType type_
the keyword value
Definition: fits.h:615
FITS::ValueType type() const
the datatype of the keyword
Definition: fits.h:676
FitsBit(unsigned char x)
Definition: fits.h:125
const ReservedFitsKeyword & err_item() const
Definition: fits.h:431
static FITS::ValueType getfitstype(NoConvert< char > x)
Definition: fits.h:188
static const ReservedFitsKeyword & history_item
Definition: fits.h:416
static Bool isa_letter(char)
Definition: fits.h:334
helper class for FITS Binary Tables
Definition: fits.h:122
static const int maxdblexp
Definition: fits.h:320
HDUType
Types of FITS Header-Data Units.
Definition: fits.h:272
FitsKeyword * curr()
Definition: fits.h:885
ValueType
FITS I/O Error message types.
Definition: fits.h:176
const char * name() const
get info about the name
Definition: fits.h:666
const char * errmsg
Definition: fits.h:486
const char * comm() const
access the keyword comment
Definition: fits.h:672
static double tenD(Int, int)
Definition: fits.h:339
FITS::ValueType type_
Definition: fits.h:370
const ReservedFitsKeyword & history() const
Definition: fits.h:439
int err_cardno(int) const
Definition: fits.h:1021
static FITS::ValueType getfitstype(NoConvert< Int > x)
Definition: fits.h:194
static const int maxfltexp
Definition: fits.h:318
long Long
Definition: aipstype.h:49
analyse the value of a header card
Definition: fits.h:468
static const int maxdigl
Definition: fits.h:322
Float pow(Float f1, Float f2)
Definition: math.h:90
const FitsKeyword * next()
Definition: fits.h:979
FITS::ValueType type() const
Definition: fits.h:377
const ReservedFitsKeyword & operator[](int i) const
Definition: fits.h:425
void operator=(int)
Definition: fits.h:71
const char * err(int) const
Definition: fits.h:514
static float tenF(Int, int)
Definition: fits.h:343
FITS::ValueType type
Definition: fits.h:470
FitsKeyword * end_
Definition: fits.h:856
static FITS::ValueType getfitstype(NoConvert< double > x)
Definition: fits.h:200
static Bool isa_digit(char c)
Definition: fits.h:331
FitsDevice
Supported FITS Physical Devices.
Definition: fits.h:267
void end()
add the end card.
Definition: fits.h:953
collection of reserved FITS keywords
Definition: fits.h:386
Utility functions for floating point values.
Definition: fits.h:1027
FitsKeyword & parse(const char *, int)
const FitsKeyword * next(const char *x)
Definition: fits.h:974
String toString(const SubScanKey &subScanKey)
static FITS::ValueType getfitstype(NoConvert< FitsBit > x)
Definition: fits.h:186
static FITS::ValueType getfitstype(NoConvert< short > x)
Definition: fits.h:192
const FitsKeyword * prev()
Definition: fits.h:980
static const ReservedFitsKeyword & end__item
Definition: fits.h:413
const FitsKeyword * curr()
Definition: fits.h:981
Bool isempty() const
Definition: fits.h:976
static const float minfloat
Definition: fits.h:308
double asDouble() const
Definition: fits.h:702
static const double mindouble
Definition: fits.h:310
const int max_errs
Definition: fits.h:506
Bool isdefined() const
Definition: fits.h:105
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
FitsRecType
Types of FITS Records.
Definition: fits.h:261
list of read-only FITS keywords
Definition: fits.h:960
Integer complex numbers.
Definition: IComplex.h:49
FitsKeyword * beg_
Definition: fits.h:855
static FITS::ValueType getfitstype(NoConvert< FitsVADesc > x)
Definition: fits.h:208
const char * err(int) const
Definition: fits.h:1020
const Bool False
Definition: aipstype.h:41
static FITS::ValueType getfitstype(NoConvert< long > x)
Definition: fits.h:196
void(* FITSErrorHandler)(const char *errMessage, FITSError::ErrorLevel severity)
Define a typedef for the handler function signature for convenience.
Definition: FITSError.h:111
void history(const char *c=0)
add a history card
Definition: fits.h:951
char * comm_
the keyword comment if comm_ is 0, there is no comment
Definition: fits.h:608
static ReservedFitsKeywordCollection & ResWord
Definition: fits.h:281
long FitsLong
Definition: aipsxtype.h:47
static int letter2bin(char)
Definition: fits.h:335
char * name_
the keyword name if name_ is 0, keyword is not a user defined name if ndx is 0, there is no index ...
Definition: fits.h:599
static const ReservedFitsKeyword & spaces_item
Definition: fits.h:414
FitsKeyword & make(const char *nm, FITS::ValueType t, const void *v, const char *c)
Int asInt() const
Definition: fits.h:682
static const int maxsigdigits
Definition: fits.h:321
static FITS::ValueType getfitstype(NoConvert< float > x)
Definition: fits.h:198
float asFloat() const
Definition: fits.h:689
static Bool isa_text(char c)
Definition: fits.h:333
FitsKeyword * operator()(int)
Retrieve specific keywords – these also set the current mark.
int num() const
Definition: fits.h:150
FitsKeywordList & kw
Definition: fits.h:984
FITS::ReservedName name_
Definition: fits.h:367
const ReservedFitsKeyword * kw_
Definition: fits.h:600
static const float maxfloat
Definition: fits.h:309
FitsKeyword * prev_
Definition: fits.h:593
linked list of FITS keywords
Definition: fits.h:746
static FITS::ValueType getfitstype(NoConvert< Complex > x)
Definition: fits.h:202
FITS keyword.
Definition: fits.h:524
FitsArrayOption
Options on FITS array manipulations.
Definition: fits.h:279
const Double c
Fundamental physical constants (SI units):
static FITS::ValueType getfitstype(NoConvert< unsigned char > x)
Definition: fits.h:190
FitsKeyword * next_
Definition: fits.h:592
analyse the name of a header card
Definition: fits.h:449
int seterr(const char *)
Definition: fits.h:515
const FitsKeyword * next(const FITS::ReservedName &x)
Definition: fits.h:967
ConstFitsKeywordList(FitsKeywordList &x)
Definition: fits.h:962
const ReservedFitsKeyword & comment() const
Definition: fits.h:437
static const int mindblexp
Definition: fits.h:319
static const int maxexpdig
Definition: fits.h:323
static const double maxdouble
Definition: fits.h:311
Bool asBool() const
access the value of the keyword
Definition: fits.h:678
translator between Keyword lists and fixed FITS cars
Definition: fits.h:994
static const Int maxInt
Definition: fits.h:307
int no_errs() const
Definition: fits.h:513
const char ** err_
Definition: fits.h:507
const Bool True
Definition: aipstype.h:40
Variable Length Array Descriptor.
Definition: fits.h:139
this file contains all the compiler specific defines
Definition: mainpage.dox:28
FitsVADesc(int n, int o)
Definition: fits.h:148
static const ReservedFitsKeyword & comment_item
Definition: fits.h:415
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
static const Int minInt
Definition: fits.h:306
FITS helper class.
Definition: fits.h:95
void spaces(const char *n=0, const char *c=0)
add a spaces line
Definition: fits.h:943
int err() const
access the error status
Definition: fits.h:675
ReservedName
FITS Reserved Names.
Definition: fits.h:247
static void defaultHandler(const char *errMessage, ErrorLevel severity)
The default error handler.
static FITS::ValueType getfitstype(NoConvert< FitsLogical > x)
STRING and FSTRING are used internally in parsing keywords.
Definition: fits.h:184