Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
![]() | Version 1.9 Build 1556 |
|
The FITS classes fall naturally into two groups, the classes that directly model the header-data-units themselves and the classes that form the underlying infrastructure that manipulates the FITS records, parses the header records, enforces the FITS formatting rules, and relates the header-data-units to these records.
The structure of the header-data-units is depicted in figure one. The class HeaderDataUnit contains what is common to all header-data-units, including the collection of keywords. This keyword collection is in the form of a linked list of objects of the Keyword class, which contains the name, value and any comment. On input, this linked list is formed from the FITS header; on output, it is used to form the FITS header. There are an extensive number of functions for manipulating this linked list of keywords. Classes derived from the HeaderDataUnit are specific types of FITS header-data-units: PrimaryArray, PrimaryGroup, ImageExtension, ExtensionHeaderDataUnit, BinaryTableExtension, and AsciiTableExtension. Each one of these has a rich assortment of functions for accessing and manipulating data of specific types.
The classes that form the underlying infrastructure are depicted in figure two. The highest level class, and the most important to the user, is FitsIO. The HeaderDataUnit class, from figure one, uses the FitsIO class for its I/O. FitsIO is the class that contains the knowledge of how to translate FITS fixed length records into keyword lists and blocks of data. It uses a class, FitsKeyCardTranslator, to translate between Keyword lists and the fixed FITS ``card'' format. The FITS parser is contained within the FitsKeyCardTranslator. In addition to providing this translation service, FITSIO keeps track of vital I/O information, such as the current type of header-data-unit, the current record type, size of remaining data, etc. The classes FitsInput and FitsOutput, derived from FitsIO, are the classes that users will instantiate to identify the FITS file being read or written. FitsInput also has a function allowing a reader to skip an entire header-data-unit.
FitsInput and FitsOutput use classes that implement fixed-length blocked I/O, the BlockIO, BlockInput, and BlockOutput classes. Specific physical devices supported by these classes are derived from BlockInput and BlockOutput. They include disk I/O, standard I/O, and 9-track tape I/O. By isolating physical devices in this manner, other types of media, such as optical disks or helical scan tapes, are easy to add to the list of supported devices.
One final class must be mentioned in the overview, the FITS class. This class consists of a series of static functions and enumerations. Many of the static functions are utility functions used internally in the implementation of the member functions of the FITS classes. They are placed in a single class to encapsulate them and to avoid adding many names to the global namespace. More important, from the user's perspective, is the enumerations. They form the basic vocabulary of a FITS application. The names in the enumerations may be used by prepending FITS:: to the names, e. g., to refer to the FITS NAXIS keyword FITS::NAXIS should be used. They are used in the following manner. Suppose we have a FITS input file, as in the following declaration.
FitsInput fin("myfile.fit",FITS::Disk);Then, a test for the primary FITS array might be the following.
if (fin.rectype() == FITS::HDURecord && fin.hdutype() == FITS::PrimaryArrayHDU)The enumerations in the FITS class are listed below.
Table of Enumerations in the FITS Class ValueType // Basic FITS Data Types for keywords and data NOVALUE LOGICAL BIT CHAR BYTE SHORT LONG FLOAT DOUBLE COMPLEX ICOMPLEX DCOMPLEX VADESC STRING ReservedName // FITS Reserved Names USER_DEF AUTHOR BITPIX BLANK BLOCKED BSCALE BUNIT BZERO CDELT COMMENT CROTA CRPIX CRVAL CTYPE DATAMAX DATAMIN DATE DATE_OBS END EPOCH EQUINOX EXTEND EXTLEVEL EXTNAME EXTVER GCOUNT GROUPS HISTORY INSTRUME NAXIS OBJECT OBSERVER ORIGIN PCOUNT PSCAL PTYPE PZERO REFERENC SIMPLE SPACES TBCOL TDIM TDISP TELESCOP TFIELDS TFORM THEAP TNULL TSCAL TTYPE TUNIT TZERO XTENSION ERRWORD FitsRecType // Types of FITS Records InitialState BadBeginningRecord HDURecord UnrecognizableRecord SpecialRecord EndOfFile FitsDevice // Supported FITS Physical Devices Disk Std Tape9 HDUType // Types of FITS Header-Data Units NotAHDU PrimaryArrayHDU PrimaryGroupHDU AsciiTableHDU BinaryTableHDU ImageExtensionHDU UnknownExtensionHDU FitsArrayOption // Options on FITS array manipulations NoOpt CtoF FtoC