26#if !defined(AIPS_FITS)
30#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>
97 v = (x ==
True ?
'T' :
'F');
104 operator Bool()
const {
return v ==
'T'; }
261 static void f2l(
char *,
void *,
int);
262 static void l2f(
void *,
char *,
int);
263 static void f2l(
unsigned char *,
void *,
int);
264 static void l2f(
void *,
unsigned char *,
int);
265 static void f2l(
short *,
void *,
int);
266 static void l2f(
void *,
short *,
int);
269 static void f2l(
long *,
void *,
int);
270 static void l2f(
void *,
long *,
int);
271 static void f2l(
float *,
void *,
int);
272 static void l2f(
void *,
float *,
int);
273 static void f2l(
double *,
void *,
int);
274 static void l2f(
void *,
double *,
int);
275 static void f2l(Complex *,
void *,
int);
276 static void l2f(
void *, Complex *,
int);
279 static void f2l(DComplex *,
void *,
int);
280 static void l2f(
void *, DComplex *,
int);
283 static void swap2(
void *,
void *,
int);
284 static void swap4(
void *,
void *,
int);
285 static void swap8(
void *,
void *,
int);
410 1.0, 1.0E1, 1.0E2, 1.0E3, 1.0E4, 1.0E5, 1.0E6, 1.0E7, 1.0E8, 1.0E9,
411 1.0E10, 1.0E11, 1.0E12, 1.0E13, 1.0E14, 1.0E15, 1.0E16, 1.0E17, 1.0E18, 1.0E19,
412 1.0E20, 1.0E21, 1.0E22, 1.0E23, 1.0E24, 1.0E25, 1.0E26, 1.0E27, 1.0E28, 1.0E29,
413 1.0E30, 1.0E31, 1.0E32, 1.0E33, 1.0E34, 1.0E35, 1.0E36, 1.0E37, 1.0E38, 1.0E39,
414 1.0E40, 1.0E41, 1.0E42, 1.0E43, 1.0E44, 1.0E45, 1.0E46, 1.0E47, 1.0E48, 1.0E49,
415 1.0E50, 1.0E51, 1.0E52, 1.0E53, 1.0E54, 1.0E55, 1.0E56, 1.0E57, 1.0E58, 1.0E59,
416 1.0E60, 1.0E61, 1.0E62, 1.0E63, 1.0E64, 1.0E65, 1.0E66, 1.0E67, 1.0E68, 1.0E69,
417 1.0E70, 1.0E71, 1.0E72, 1.0E73, 1.0E74, 1.0E75, 1.0E76, 1.0E77, 1.0E78, 1.0E79,
418 1.0E80, 1.0E81, 1.0E82, 1.0E83, 1.0E84, 1.0E85, 1.0E86, 1.0E87, 1.0E88, 1.0E89,
419 1.0E90, 1.0E91, 1.0E92, 1.0E93, 1.0E94, 1.0E95, 1.0E96, 1.0E97, 1.0E98, 1.0E99,
420 1.0E100, 1.0E101, 1.0E102, 1.0E103, 1.0E104, 1.0E105, 1.0E106, 1.0E107, 1.0E108, 1.0E109,
421 1.0E110, 1.0E111, 1.0E112, 1.0E113, 1.0E114, 1.0E115, 1.0E116, 1.0E117, 1.0E118, 1.0E119,
422 1.0E120, 1.0E121, 1.0E122, 1.0E123, 1.0E124, 1.0E125, 1.0E126, 1.0E127, 1.0E128, 1.0E129,
423 1.0E130, 1.0E131, 1.0E132, 1.0E133, 1.0E134, 1.0E135, 1.0E136, 1.0E137, 1.0E138, 1.0E139,
424 1.0E140, 1.0E141, 1.0E142, 1.0E143, 1.0E144, 1.0E145, 1.0E146, 1.0E147, 1.0E148, 1.0E149,
425 1.0E150, 1.0E151, 1.0E152, 1.0E153, 1.0E154, 1.0E155, 1.0E156, 1.0E157, 1.0E158, 1.0E159,
426 1.0E160, 1.0E161, 1.0E162, 1.0E163, 1.0E164, 1.0E165, 1.0E166, 1.0E167, 1.0E168, 1.0E169,
427 1.0E170, 1.0E171, 1.0E172, 1.0E173, 1.0E174, 1.0E175, 1.0E176, 1.0E177, 1.0E178, 1.0E179,
428 1.0E180, 1.0E181, 1.0E182, 1.0E183, 1.0E184, 1.0E185, 1.0E186, 1.0E187, 1.0E188, 1.0E189,
429 1.0E190, 1.0E191, 1.0E192, 1.0E193, 1.0E194, 1.0E195, 1.0E196, 1.0E197, 1.0E198, 1.0E199,
430 1.0E200, 1.0E201, 1.0E202, 1.0E203, 1.0E204, 1.0E205, 1.0E206, 1.0E207, 1.0E208, 1.0E209,
431 1.0E210, 1.0E211, 1.0E212, 1.0E213, 1.0E214, 1.0E215, 1.0E216, 1.0E217, 1.0E218, 1.0E219,
432 1.0E220, 1.0E221, 1.0E222, 1.0E223, 1.0E224, 1.0E225, 1.0E226, 1.0E227, 1.0E228, 1.0E229,
433 1.0E230, 1.0E231, 1.0E232, 1.0E233, 1.0E234, 1.0E235, 1.0E236, 1.0E237, 1.0E238, 1.0E239,
434 1.0E240, 1.0E241, 1.0E242, 1.0E243, 1.0E244, 1.0E245, 1.0E246, 1.0E247, 1.0E248, 1.0E249,
435 1.0E250, 1.0E251, 1.0E252, 1.0E253, 1.0E254, 1.0E255, 1.0E256, 1.0E257, 1.0E258, 1.0E259,
436 1.0E260, 1.0E261, 1.0E262, 1.0E263, 1.0E264, 1.0E265, 1.0E266, 1.0E267, 1.0E268, 1.0E269,
437 1.0E270, 1.0E271, 1.0E272, 1.0E273, 1.0E274, 1.0E275, 1.0E276, 1.0E277, 1.0E278, 1.0E279,
438 1.0E280, 1.0E281, 1.0E282, 1.0E283, 1.0E284, 1.0E285, 1.0E286, 1.0E287, 1.0E288, 1.0E289,
439 1.0E290, 1.0E291, 1.0E292, 1.0E293, 1.0E294, 1.0E295, 1.0E296, 1.0E297, 1.0E298, 1.0E299,
440 1.0E300, 1.0E301, 1.0E302, 1.0E303, 1.0E304, 1.0E305, 1.0E306, 1.0E307, 1.0E308};
442 1.0F, 1.0E1F, 1.0E2F, 1.0E3F, 1.0E4F, 1.0E5F, 1.0E6F, 1.0E7F, 1.0E8F, 1.0E9F,
443 1.0E10F, 1.0E11F, 1.0E12F, 1.0E13F, 1.0E14F, 1.0E15F, 1.0E16F, 1.0E17F, 1.0E18F, 1.0E19F,
444 1.0E20F, 1.0E21F, 1.0E22F, 1.0E23F, 1.0E24F, 1.0E25F, 1.0E26F, 1.0E27F, 1.0E28F, 1.0E29F,
445 1.0E30F, 1.0E31F, 1.0E32F, 1.0E33F, 1.0E34F, 1.0E35F, 1.0E36F, 1.0E37F, 1.0E38F};
483 const char *
aname()
const;
519 const char *&)
const;
521 const char *&)
const;
525 const char *&)
const;
536 int,
const char *&)
const;
619 1, 2, 8, 14, 18, 0, 25, 27, 28, 0, 0, 0, 0, 29, 31, 34, 0, 38,
621 39, 41, 0, 0, 0, 54, 0, 0};
623 const char *&)
const;
712 const char *
err(
int)
const;
751 const char *
name()
const;
761 const char *
comm()
const;
897 cerr <<
"Unexpected keyword type in FitsKeyword::asInt()\n";
913 cerr <<
"Unexpected keyword type in asFloat()\n";
929 cerr <<
"Unexpected keyword type in asDouble()\n";
964 *((Complex *)
val) = x;
969 *((DComplex *)
val) = x;
1028 void mk(
const char *n,
Bool v,
const char *c = 0);
1029 void mk(
const char *n,
const char *v = 0,
const char *c = 0);
1030 void mk(
const char *n,
Int v,
const char *c = 0);
1031 void mk(
const char *n,
long v,
const char *c = 0);
1032 void mk(
const char *n,
float v,
const char *c = 0);
1033 void mk(
const char *n,
double v,
const char *c = 0);
1034 void mk(
const char *n,
Int r,
Int i,
const char *c = 0);
1035 void mk(
const char *n,
float r,
float i,
const char *c = 0);
1036 void mk(
const char *n,
double r,
double i,
const char *c = 0);
1040 void spaces(
const char *n = 0,
const char *c = 0);
1043 void comment(
const char *n = 0,
const char *c = 0);
1046 void history(
const char *c = 0);
1084 void parse(
const char *,
int);
1108 const char *errmsg);
1132 return next(n, ndx);
1266 const char *
err(
int)
const;
list of read-only FITS keywords
const FitsKeyword * operator()(const char *x)
ConstFitsKeywordList(FitsKeywordList &x)
const FitsKeyword * curr()
const FitsKeyword * prev()
const FitsKeyword * next(const FITS::ReservedName &x, int n)
const FitsKeyword * next(const FITS::ReservedName &x)
const FitsKeyword * operator()(const FITS::ReservedName &x)
const FitsKeyword * operator()(const FITS::ReservedName &x, int n)
const FitsKeyword * operator()(int n)
const FitsKeyword * next()
const FitsKeyword * next(const char *x)
static void defaultHandler(const char *errMessage, ErrorLevel severity)
The default error handler.
static void l2f(void *, FitsLogical *, int)
static FITS::ValueType getfitstype(NoConvert< double > x)
static constexpr int mindblexp
static int get_comment(const char *s, int len, int &begpos)
static FITS::ValueType getfitstype(NoConvert< IComplex > x)
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 constexpr 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 constexpr int maxfltexp
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 constexpr Int maxInt
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 constexpr double mindouble
static FITS::ValueType getfitstype(NoConvert< short > x)
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)
static constexpr double maxdouble
FitsRecType
Types of FITS Records.
static constexpr int maxdblexp
static FITS::ValueType getfitstype(NoConvert< unsigned char > x)
static constexpr float tenpowerF[39]
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 void l2f(void *, long *, int)
static FITS::ValueType getfitstype(NoConvert< Complex > x)
static void l2f(void *, double *, int)
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 constexpr int minfltexp
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 constexpr int maxdigl
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 constexpr double tenpowerD[309]
static void l2f(void *, short *, int)
static constexpr int maxsigdigits
static FITS::ValueType getfitstype(NoConvert< long > x)
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 constexpr Int minInt
static void f2l(FitsLogical *, void *, int)
data conversion routines: FITS - local
static constexpr float maxfloat
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)
static constexpr float minfloat
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.
static constexpr int FitsCardSize
static void fmtcard(char *, const FitsKeyword &)
static constexpr int FitsRecSize
int err_cardno(int) const
FitsKeyCardTranslator(int=100)
FitsKeywordList & parse(const char *, FitsKeywordList &, int, FITSErrorHandler, Bool)
int build(char *, FitsKeywordList &)
static constexpr int FitsMaxCard
const char * err(int) const
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 & make(const char *nm, FITS::ValueType t, const void *v, const char *c)
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
FitsKeywordList & operator=(const FitsKeywordList &)
void spaces(const char *n=0, const char *c=0)
add a spaces line
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 * next(const FITS::ReservedName &, int)
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 ...
FitsKeyword & make(FITS::ReservedName nm, FITS::ValueType t, const void *v, const char *c)
FitsKeywordList(const FitsKeywordList &)
FitsKeyword * next(const char *)
FitsKeyword & make(int ind, FITS::ReservedName nm, FITS::ValueType t, const void *v, const char *c)
void history(const char *c=0)
add a history card
FitsKeywordList(ConstFitsKeywordList &)
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)
FitsKeyword & operator=(const char *)
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
friend class FitsKeywordList
Complex asComplex() const
friend ostream & operator<<(ostream &o, const FitsLogical &)
void undefine()
ARO 2021-02-20: Removed the following function, because it seems incorrectly implemented and isn't us...
FitsLogical & operator=(Bool x)
analyse the name of a header card
const char * err(int) const
FitsKeyword & parse(const char *, int)
friend class FitsKeywordList
FitsKeyword & mkerr(const char *s, int len)
Variable Length Array Descriptor.
friend ostream & operator<<(ostream &o, const FitsVADesc &)
FitsVADesc & operator=(const FitsVADesc &x)
FitsVADesc(const FitsVADesc &x)
analyse the value of a header card
collection of reserved FITS keywords
const ReservedFitsKeyword & history() const
static constexpr const ReservedFitsKeyword & spaces_item
int essential_name(const char *, int) const
const ReservedFitsKeyword & operator[](int i) const
Bool requires_value(int) const
const ReservedFitsKeyword & comment() const
const ReservedFitsKeyword & get_essential(int, Bool, FITS::ValueType, const void *, int, const char *&) const
const ReservedFitsKeyword & get(FITS::ReservedName, Bool, FITS::ValueType, const void *, int, const char *&) const
static constexpr int resalpha[26]
alphabetic index to table
static constexpr const ReservedFitsKeyword & user_def_item
static constexpr const ReservedFitsKeyword & end__item
const ReservedFitsKeyword & end_item() const
const ReservedFitsKeyword & match(int, const char *, int, Bool, FITS::ValueType, const void *, int, const char *&) const
static constexpr const ReservedFitsKeyword & error_item
const char * aname(FITS::ReservedName) const
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
static constexpr int no_items
const ReservedFitsKeyword & get(const char *, int, Bool, FITS::ValueType, const void *, int, const char *&) const
const ReservedFitsKeyword & userdef_item() const
static constexpr const ReservedFitsKeyword & comment_item
const ReservedFitsKeyword & spaces() const
static constexpr ReservedFitsKeyword resword[56]
Discussion of Reserved FitsKeyword Table.
static constexpr const ReservedFitsKeyword & history_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.
For temporary backward namespace compatibility, use casa as alias for casacore.
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
String name() const
Return the name of the field.
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
void init()
Other internal helper function(s).
int FitsLong
All FITS code seems to assume longs are 4 bytes.
bool Bool
Define the standard types used by Casacore.
const String & comment() const
Get the comment of this field.