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