28 # if !defined(AIPS_FITS)
32 # include <casacore/casa/aips.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>
48 class ReservedFitsKeywordCollection;
50 class FitsValueResult;
96 v = (x ==
True ?
'T' :
'F');
return *
this; }
101 operator Bool()
const {
return v ==
'T'; }
210 static void f2l(
char *,
void *,
int);
211 static void l2f(
void *,
char *,
int);
212 static void f2l(
unsigned char *,
void *,
int);
213 static void l2f(
void *,
unsigned char *,
int);
214 static void f2l(
short *,
void *,
int);
215 static void l2f(
void *,
short *,
int);
218 static void f2l(
long *,
void *,
int);
219 static void l2f(
void *,
long *,
int);
220 static void f2l(
float *,
void *,
int);
221 static void l2f(
void *,
float *,
int);
222 static void f2l(
double *,
void *,
int);
223 static void l2f(
void *,
double *,
int);
232 static void swap2(
void *,
void *,
int);
233 static void swap4(
void *,
void *,
int);
234 static void swap8(
void *,
void *,
int);
345 const char *
aname()
const;
351 # if defined(TURBOCPP)
382 const void *,
int,
const char *&)
const;
384 const void *,
int,
const char *&)
const;
388 const void *,
int,
const char *&)
const;
492 const char *
err(
int)
const;
530 const char *
name()
const;
540 const char *
comm()
const;
644 name_(0), kw_(0), comm_(0), val(0) {
init(k); }
671 return vallen ? (
const char *)
val :
""; }
675 cerr <<
"Unexpected keyword type in FitsKeyword::asInt()\n";
688 cerr <<
"Unexpected keyword type in asFloat()\n";
701 cerr <<
"Unexpected keyword type in asDouble()\n";
782 void mk(
const char *n,
Bool v,
const char *
c = 0);
783 void mk(
const char *n,
const char *v = 0,
const char *
c = 0);
784 void mk(
const char *n,
Int v,
const char *
c = 0);
785 void mk(
const char *n,
long v,
const char *
c = 0);
786 void mk(
const char *n,
float v,
const char *
c = 0);
787 void mk(
const char *n,
double v,
const char *
c = 0);
788 void mk(
const char *n,
Int r,
Int i,
const char *
c = 0);
789 void mk(
const char *n,
float r,
float i,
const char *
c = 0);
790 void mk(
const char *n,
double r,
double i,
const char *
c = 0);
794 void spaces(
const char *n = 0,
const char *
c = 0);
797 void comment(
const char *n = 0,
const char *
c = 0);
839 void parse(
const char *,
int);
864 const void *val,
const char *errmsg);
871 total(0), cursor(0) { }
880 int ndx) {
first();
return next(n,ndx); }
993 const char *
err(
int)
const;
list of read-only FITS keywords
ConstFitsKeywordList(FitsKeywordList &x)
const FitsKeyword * next(const FITS::ReservedName &x, int n)
const FitsKeyword * next()
const FitsKeyword * next(const FITS::ReservedName &x)
const FitsKeyword * next(const char *x)
const FitsKeyword * prev()
const FitsKeyword * operator()(int n)
const FitsKeyword * curr()
static void defaultHandler(const char *errMessage, ErrorLevel severity)
The default error handler.
static functions and enumerations
static void l2f(void *, FitsLogical *, int)
static float tenpowerF[39]
static const int maxsigdigits
static FITS::ValueType getfitstype(NoConvert< double > x)
static int get_comment(const char *s, int len, int &begpos)
static FITS::ValueType getfitstype(NoConvert< IComplex > x)
static const int mindblexp
static void f2l(short *, void *, int)
static void f2l(DComplex *, void *, int)
static int trim_comment(const char *s, int len)
static void get_numeric(const char *s, int len, FitsValueResult &result)
static const int maxexpdig
ReservedName
FITS Reserved Names.
static void l2f(void *, float *, int)
static FITS::ValueType getfitstype(NoConvert< float > x)
static void f2l(FitsBit *, void *, int)
static void l2f(void *, char *, int)
static Bool isa_text(char c)
static void swap2(void *, void *, int)
static int str2fstr(char *, const char *, int)
static void l2f(void *, FitsBit *, int)
static void f2l(unsigned char *, void *, int)
static void l2f(void *, IComplex *, int)
static void f2l(FitsVADesc *, void *, int)
static void f2l(Int *, void *, int)
static FITS::ValueType getfitstype(NoConvert< short > x)
static const double mindouble
static const int maxdblexp
static ReservedFitsKeywordCollection & ResWord
static void f2l(long *, void *, int)
static int fitssize(FITS::ValueType t)
static FITS::ValueType getfitstype(NoConvert< DComplex > x)
static void swap4(void *, void *, int)
static void l2f(void *, FitsVADesc *, int)
static void l2f(void *, Int *, int)
static void l2f(void *, Complex *, int)
static double tenD(Int, int)
static int ckaccum(float &, Int, int)
static void f2l(Complex *, void *, int)
FitsRecType
Types of FITS Records.
static FITS::ValueType getfitstype(NoConvert< unsigned char > x)
static double tenpowerD[309]
ValueType
FITS I/O Error message types.
static FITS::ValueType getfitstype(NoConvert< FitsVADesc > x)
static Bool isa_letter(char)
static void fstr2str(char *, const char *, int)
static FITS::ValueType getfitstype(NoConvert< FitsBit > x)
static const float minfloat
static void l2f(void *, long *, int)
static FITS::ValueType getfitstype(NoConvert< Complex > x)
static void l2f(void *, double *, int)
static const int minfltexp
static FITS::ValueType getfitstype(NoConvert< FitsLogical > x)
STRING and FSTRING are used internally in parsing keywords.
static float tenF(Int, int)
static FITS::ValueType getfitstype(NoConvert< Int > x)
static void valstr(ostream &o, const ValueType &ty, const void *val)
static void f2l(IComplex *, void *, int)
static void l2f(void *, DComplex *, int)
static void f2l(char *, void *, int)
static int ckaccum(double &, Int, int)
static int get_value_id(const char *s, int l, int &pos)
FitsArrayOption
Options on FITS array manipulations.
static Bool isa_digit(char c)
static const double maxdouble
static const int maxfltexp
static void l2f(void *, short *, int)
static FITS::ValueType getfitstype(NoConvert< long > x)
static const float maxfloat
static void get_value(const char *s, int len, FitsValueResult &result)
static int chk_comment(const char *s, int len)
static void parse_vatform(const char *s, FITS::ValueType &valType, int &maxelem)
utility function to parse the binary table variable array column (i.e.
static void l2f(void *, unsigned char *, int)
HDUType
Types of FITS Header-Data Units.
static void get_name(const char *s, int len, FitsNameResult &result)
static void f2l(FitsLogical *, void *, int)
data conversion routines: FITS - local
FitsDevice
Supported FITS Physical Devices.
static void swap8(void *, void *, int)
static int digit2bin(char c)
static int localsize(FITS::ValueType t)
static void f2l(float *, void *, int)
static void f2l(double *, void *, int)
static int letter2bin(char)
static FITS::ValueType getfitstype(NoConvert< char > x)
helper class for FITS Binary Tables
FitsBit & operator=(unsigned char x)
Utility functions for floating point values.
static void setNaN(float &val)
static Bool isFP(const double *)
static Bool isFP(const float *)
These functions are useful to tell if some type is a floating point type.
static Bool isFP(const void *)
static void setNaN(double &val)
For blanking purposes, we need to be able to get a NaN.
translator between Keyword lists and fixed FITS cars
static void fmtcard(char *, const FitsKeyword &)
int err_cardno(int) const
FitsKeyCardTranslator(int=100)
int build(char *, FitsKeywordList &)
const char * err(int) const
FitsKeywordList & parse(const char *, FitsKeywordList &, int, FITSErrorHandler, Bool)
linked list of FITS keywords
void end()
add the end card.
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...
int rules(FitsKeyword &, FITSErrorHandler errhandler=FITSError::defaultHandler)
int rules(FITSErrorHandler errhandler=FITSError::defaultHandler)
FitsKeyword * operator()(int)
Retrieve specific keywords – these also set the current mark.
FitsKeyword * next(const FITS::ReservedName &, int)
FitsKeyword * next(const FITS::ReservedName &)
void parse(const char *, int)
For parsing a single string.
std::string toString() const
Convert the list to a string containing the 80-byte FITS headers.
int no_parse_errs() const
FitsKeyword & make(int ind, FITS::ReservedName nm, FITS::ValueType t, const void *v, const char *c)
void spaces(const char *n=0, const char *c=0)
add a spaces line
FitsKeyword * next(const char *)
void del()
delete the current keyword (the thing returned by curr()) from the list
const char * parse_err(int) const
void insert(FitsKeyword &)
void comment(const char *n=0, const char *c=0)
add a comment card
FitsKeyword & make(FITS::ReservedName nm, FITS::ValueType t, const void *v, const char *c)
FitsKeywordList(const FitsKeywordList &)
void history(const char *c=0)
add a history card
FitsKeyword & make(const char *nm, FITS::ValueType t, const void *v, const char *c)
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 ...
FitsKeywordList(ConstFitsKeywordList &)
FitsKeywordList & operator=(const FitsKeywordList &)
FitsKeyword(const FitsKeyword &)
A word about friends: FitsKeywordList accesses the next and prev pointers and the FitsKeyword constru...
Bool asBool() const
access the value of the keyword
char * name_
the keyword name if name_ is 0, keyword is not a user defined name if ndx is 0, there is no index
const char * comm() const
access the keyword comment
const ReservedFitsKeyword * kw_
FitsKeyword(const char *, int, FITS::ValueType, const void *, int, const char *, int)
private constructors for use by friends
const ReservedFitsKeyword & kw() const
char * comm_
the keyword comment if comm_ is 0, there is no comment
void init(const FitsKeyword &)
FitsKeyword & operator=(const FitsKeyword &)
void setval(const FITS::ValueType &, const void *, int)
static void err(const char *, const FITS::ValueType &, const void *, const char *)
void name(const char *)
change the name of the keyword
FITS::ValueType type() const
the datatype of the keyword
const char * asString() const
FITS::ValueType type_
the keyword value
const void * value() const
void setcomm(const char *, int)
static void memchk(void *)
int err() const
access the error status
const char * name() const
get info about the name
DComplex asDComplex() const
void comm(const char *)
change the comment of the keyword
IComplex asIComplex() const
FitsKeyword(const ReservedFitsKeyword *, int, FITS::ValueType, const void *, int, const char *, int)
constructs reserved keywords parms: resword, index, val, vallen, comm, commlen
Complex asComplex() const
void undefine()
ARO 2021-02-20: Removed the following function, because it seems incorrectly implemented and isn't us...
friend ostream & operator<<(ostream &o, const FitsLogical &)
FitsLogical & operator=(Bool x)
analyse the name of a header card
const char * err(int) const
FitsKeyword & parse(const char *, int)
FitsKeyword & mkerr(const char *s, int len)
Variable Length Array Descriptor.
FitsVADesc & operator=(const FitsVADesc &x)
friend ostream & operator<<(ostream &o, const FitsVADesc &)
FitsVADesc(const FitsVADesc &x)
analyse the value of a header card
collection of reserved FITS keywords
static const ReservedFitsKeyword & user_def_item
const ReservedFitsKeyword & get_essential(int, Bool, FITS::ValueType, const void *, int, const char *&) const
const ReservedFitsKeyword & history() const
int essential_name(const char *, int) const
const ReservedFitsKeyword & operator[](int i) const
const ReservedFitsKeyword & get(const char *, int, Bool, FITS::ValueType, const void *, int, const char *&) const
Bool requires_value(int) const
const ReservedFitsKeyword & comment() const
static const ReservedFitsKeyword & error_item
const ReservedFitsKeyword & end_item() const
const ReservedFitsKeyword & get(FITS::ReservedName, Bool, FITS::ValueType, const void *, int, const char *&) const
static const ReservedFitsKeyword & history_item
const ReservedFitsKeyword & match(int, const char *, int, Bool, FITS::ValueType, const void *, int, const char *&) const
static const int resalpha[26]
static const ReservedFitsKeyword & comment_item
static const int no_items
int rules(const ReservedFitsKeyword &, const char *, int, Bool, FITS::ValueType, const void *, int, const char *&) const
const ReservedFitsKeyword & err_item() const
int isreserved(const char *, int) const
const ReservedFitsKeyword & userdef_item() const
const ReservedFitsKeyword & spaces() const
static const ReservedFitsKeyword resword[]
static const ReservedFitsKeyword & end__item
const char * aname(FITS::ReservedName) const
static const ReservedFitsKeyword & spaces_item
FITS::ValueType type() const
const char * aname() const
FITS::ReservedName name() const
void(* FITSErrorHandler)(const char *errMessage, FITSError::ErrorLevel severity)
Define a typedef for the handler function signature for convenience.
std::complex< Float > Complex
std::complex< Double > DComplex
const Double c
Fundamental physical constants (SI units):
this file contains all the compiler specific defines
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
int FitsLong
All FITS code seems to assume longs are 4 bytes.
bool Bool
Define the standard types used by Casacore.
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.