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
uInt datasize() const
Int itemsize() const
uInt currsize() const
Protected Members
FitsIO(FITSErrorHandler)
virtual void errmsg(FitsErrs, char *) = 0

Description

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

uInt datasize() const

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

Int itemsize() const

data characteristics

uInt currsize() const

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

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 int HeaderDataUnit::read_all_data(char *)
friend int HeaderDataUnit::read_data(char *, int)
friend int HeaderDataUnit::skip(int)
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()
int blockno() const
int recno() const
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()
int process_header(FITS::HDUType, FitsKeywordList &)
uInt read_all(FITS::HDUType, char *)
int read(FITS::HDUType, char *, int)
int skip(FITS::HDUType, int)
void skip_all(FITS::HDUType)
See Also
ReadFITS AIPS++ interface routines.

Description

Member Description

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

friend int HeaderDataUnit::read_all_data(char *)

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

friend int HeaderDataUnit::skip(int)

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()

read special or unrecognizable records

int blockno() const

number of physical blocks read/written

int recno() const

number of logical records read/written

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

virtual void errmsg(FitsErrs, char *)

void init()

void read_header_rec()

int process_header(FITS::HDUType, FitsKeywordList &)

Special interface to class HeaderDataUnit

special way to process header

uInt 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, int)

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()
int write_sp(char *rec)
Private Members
BlockOutput &make_output(const char *, const FITS::FitsDevice &, int, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual void errmsg(FitsErrs, char *)
int hdu_complete()
int hdu_inprogress()
int write_hdr(FitsKeywordList &, FITS::HDUType, FITS::ValueType, Int, 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()

int write_sp(char *rec)

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

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

virtual void errmsg(FitsErrs, char *)

int hdu_complete()

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, Int, 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()