fitsio.h

Classes

FitsIO -- sequential FITS I/O (full description)
FitsInput -- fixed-length sequential blocked FITS input (full description)
FitsOutput -- fixed-length sequential blocked FITS output (full description)
FitsDiskInput -- FITS input from disk (full description)
FitsDiskOutput -- FITS output to disk (full description)
FitsStdInput -- FITS input from standard input (full description)
FitsStdOutput -- FITS output to standard output (full description)
FitsTape9Input -- FITS input from 9-track tape (full description)
FitsTape9Output -- FITS output to 9-track tape (full description)

class FitsIO

Types

enum FitsErrs

OK
IOERR
MISSKEY
BADBEGIN
EMPTYFILE
NOPRIMARY
BADOPER
BADEOF
MEMERR
BADBITPIX
NOAXISN
NOPCOUNT
NOGCOUNT
BADPCOUNT
BADGCOUNT
NOGROUPS
BADNAXIS
BADPRIMARY
BADSIZE
HDUERR

Interface

Public Members
virtual ~FitsIO()
int err() const
int fitsrecsize() const
Bool isafits() const
Bool isextend() const
Bool eof() const
FITS::FitsRecType rectype() const
FITS::HDUType hdutype() const
FITS::ValueType datatype() const
OFF_T datasize() const
Int itemsize() const
OFF_T currsize() const
FitsKeyCardTranslator& getkc()
fitsfile *getfptr() const
Protected Members
FitsIO(FITSErrorHandler)
virtual void errmsg(FitsErrs, char *) = 0

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Synopsis

FitsIO is a base class that handles all the sequential blocked FITS I/O. Special derived classes do the input and output. No interpretation of the data is attempted here, there are special FITS classes that handle syntax and interpretation.

Example

    FitsInput fin("myfile.fits",FITS::Disk);	// open disk file for FITS input
    if (fin.err() == FitsIO::IOERR) {            // check if open succeeded
        cout << "Could not open FITS input\n";
        exit(0);
    }
    if (fin.rectype() == FITS::HDURecord &&      // test for primary array
        fin.hdutype() == FITS::PrimaryArrayHDU) {
    }
    

Member Description

virtual ~FitsIO()

enum FitsErrs

int err() const

error return code. Should be one of an enumerated type:

  enum FitsErrs { OK, IOERR, MISSKEY, BADBEGIN, EMPTYFILE,
	NOPRIMARY, BADOPER, BADEOF, MEMERR, BADBITPIX, NOAXISN,
	NOPCOUNT, NOGCOUNT, BADPCOUNT, BADGCOUNT, NOGROUPS,
	BADNAXIS, BADPRIMARY, BADSIZE, HDUERR };

int fitsrecsize() const

record size, in bytes, of a FITS block. Normally set at 2880, unless some form of blocking was used.

Bool isafits() const

is it a valid fits file (SIMPLE==T). If not, the only safest operation is to skip the data portion of the current HeaderDataUnit

Bool isextend() const

see if there may be FITS extensions present (EXTENT==T)

Bool eof() const

test if end of file has been reached

FITS::FitsRecType rectype() const

the FITS record type

FITS::HDUType hdutype() const

Header Data Unit type (e.g.

FITS::ValueType datatype() const

OFF_T datasize() const

return the datasize of the current HDU. This excludes the trailing end of the blocked data portion.

Int itemsize() const

data characteristics

OFF_T currsize() const

for input, size of remaining data for output, size of data written

FitsKeyCardTranslator& getkc()

get FitsKeyCardTranslator

fitsfile *getfptr() const

get the fitsfile pointer

FitsIO(FITSErrorHandler)

virtual void errmsg(FitsErrs, char *) = 0

set error message that belongs to one of the enumerated types


class FitsInput : public FitsIO

Interface

friend int HeaderDataUnit::get_hdr(HeaderDataUnit::HDUType, FitsKeywordList &)
friend OFF_T OFF_T::read_all_data(char *)
friend int HeaderDataUnit::read_data(char *, Int)
friend int HeaderDataUnit::skip(uInt)
friend int HeaderDataUnit::skip()
Public Members
FitsInput(const char *, const FITS::FitsDevice &, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)
FitsInput(FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsInput()
int skip_hdu()
char *read_sp()
Vector<String> kwlist_str(Bool length80=False)
int blockno() const
int recno() const
BlockInput & getfin()
Private Members
BlockInput &make_input(const char *, const FITS::FitsDevice &, int, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual void errmsg(FitsErrs, char *)
void init()
void read_header_rec()
bool current_hdu_type( FITS::HDUType &)
bool get_data_type( FITS::ValueType &)
int process_header(FITS::HDUType, FitsKeywordList &)
OFF_T read_all(FITS::HDUType, char *)
int read(FITS::HDUType, char *, int )
int skip(FITS::HDUType, OFF_T)
void skip_all(FITS::HDUType)
See Also
ReadFITS AIPS++ interface routines.

Description

Member Description

friend int HeaderDataUnit::get_hdr(HeaderDataUnit::HDUType, FitsKeywordList &)

friend OFF_T OFF_T::read_all_data(char *)

friend int HeaderDataUnit::read_data(char *, Int)

friend int HeaderDataUnit::skip(uInt)

friend int HeaderDataUnit::skip()

FitsInput(const char *, const FITS::FitsDevice &, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)
FitsInput(FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsInput()

int skip_hdu()

char *read_sp()

int skip_hdu2(); read special or unrecognizable records

Vector<String> kwlist_str(Bool length80=False)

get hdu header image cards as strings. By default the strings will be of variable length. You can optionally ask for them to be length 80 (padded with spaces).

int blockno() const

number of physical blocks read/written

int recno() const

number of logical records read/written

BlockInput & getfin()

BlockInput &make_input(const char *, const FITS::FitsDevice &, int, FITSErrorHandler errhandler = FITSError::defaultHandler)

virtual void errmsg(FitsErrs, char *)

void init()

void read_header_rec()

bool current_hdu_type( FITS::HDUType &)

bool get_data_type( FITS::ValueType &)

int process_header(FITS::HDUType, FitsKeywordList &)

Special interface to class HeaderDataUnit

special way to process header

OFF_T read_all(FITS::HDUType, char *)

Special interface to class HeaderDataUnit

read all data into a given address - all responsibility is given to the user

int read(FITS::HDUType, char *, int )

Special interface to class HeaderDataUnit

read N bytes into address

int skip(FITS::HDUType, OFF_T)

Special interface to class HeaderDataUnit

skip N bytes

void skip_all(FITS::HDUType)

Special interface to class HeaderDataUnit

skip all remaining data


class FitsOutput : public FitsIO

Interface

friend int HeaderDataUnit::write_hdr(FitsOutput &)
friend int HeaderDataUnit::write_all_data(FitsOutput &, char *)
friend int HeaderDataUnit::write_data(FitsOutput &, char *, Int)
Public Members
FitsOutput(const char *, const FITS::FitsDevice &, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)
FitsOutput(FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsOutput()
void set_data_info( FitsKeywordList &kwl, FITS::HDUType t, FITS::ValueType dt, OFF_T ds, Int is)
int write_sp(char *rec)
int hdu_complete()
BlockOutput & getfout()
void setfptr( fitsfile* ffp )
Bool required_keys_only()
Private Members
BlockOutput &make_output(const char *, const FITS::FitsDevice &, int, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual void errmsg(FitsErrs, char *)
int hdu_inprogress()
int write_hdr(FitsKeywordList &, FITS::HDUType, FITS::ValueType, OFF_T, Int)
int write_all(FITS::HDUType, char *, char)
int write(FITS::HDUType, char *, Int, char)
See Also
WriteFITS AIPS++ interface routines.

Description

Member Description

friend int HeaderDataUnit::write_hdr(FitsOutput &)

friend int HeaderDataUnit::write_all_data(FitsOutput &, char *)

friend int HeaderDataUnit::write_data(FitsOutput &, char *, Int)

FitsOutput(const char *, const FITS::FitsDevice &, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)
FitsOutput(FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsOutput()

void set_data_info( FitsKeywordList &kwl, FITS::HDUType t, FITS::ValueType dt, OFF_T ds, Int is)

used by PrimaryArray, BinaryTabelExtention etc to work with the constructor without keyword list.

int write_sp(char *rec)

write a special record. For this the record type must also be to set to FITS::SpecialRecord

int hdu_complete()

check if the current hdu is done. It was private.

BlockOutput & getfout()

void setfptr( fitsfile* ffp )

Bool required_keys_only()

BlockOutput &make_output(const char *, const FITS::FitsDevice &, int, FITSErrorHandler errhandler = FITSError::defaultHandler)

virtual void errmsg(FitsErrs, char *)

int hdu_inprogress()

int write_all(FITS::HDUType, char *, char)

Special interface to class HeaderDataUnit

write all data from address

int write(FITS::HDUType, char *, Int, char)

Special interface to class HeaderDataUnit

write N bytes from address

int write_hdr(FitsKeywordList &, FITS::HDUType, FITS::ValueType, OFF_T, Int)

Special interface to class HeaderDataUnit


class FitsDiskInput : public BlockInput

Interface

Public Members
FitsDiskInput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsDiskInput()
char *skip(int)

Description

Member Description

FitsDiskInput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)

~FitsDiskInput()

char *skip(int)

implements skip in terms of lseek

class FitsDiskOutput : public BlockOutput

Interface

FitsDiskOutput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsDiskOutput()

Description

Member Description

FitsDiskOutput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)

~FitsDiskOutput()


class FitsStdInput : public BlockInput

Interface

FitsStdInput(int, FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsStdInput()

Description

Member Description

FitsStdInput(int, FITSErrorHandler errhandler = FITSError::defaultHandler)

~FitsStdInput()


class FitsStdOutput : public BlockOutput

Interface

FitsStdOutput(int, FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsStdOutput()

Description

Member Description

FitsStdOutput(int, FITSErrorHandler errhandler = FITSError::defaultHandler)

~FitsStdOutput()


class FitsTape9Input : public BlockInput

Interface

FitsTape9Input(const char *, int, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsTape9Input()

Description

Member Description

FitsTape9Input(const char *, int, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)

~FitsTape9Input()


class FitsTape9Output : public BlockOutput

Interface

FitsTape9Output(const char *, int, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)
~FitsTape9Output()

Description

Member Description

FitsTape9Output(const char *, int, int = 10, FITSErrorHandler errhandler = FITSError::defaultHandler)

~FitsTape9Output()