BinTable.h
Classes
- BinaryTable -- BinaryTable is used to translate a FITS binary table to an aips++ Table. (full description)
Interface
- Public Members
- BinaryTable(FitsInput &, FITSErrorHandler errhandler = FITSError::defaultHandler, Bool useMiriadSM = False, Bool sdfits = False)
- ~BinaryTable()
- Table fullTable(const String& tabName, const Table::TableOption = Table::NewNoReplace, Bool useMiriadSM = False)
- Table fullTable()
- const TableDesc& getDescriptor()
- TableRecord& getKeywords()
- const Table &thisRow()
- const Table &nextRow()
- Private Members
- void fillRow()
Review Status
- Programs:
- Tests:
Prerequisite
- FitsInput
- HeaderDataUnit
- BinaryTableExtension
- Tables module
Etymology
BinaryTable inherits from the FITS BinaryTableExtension class and its
primary use is to convert that class to an aips++ Table. This explains
it's use but not its name. A better name should be found.
Synopsis
The class starts with an already existing FitsInput object, which should
be set at a BinaryTableExtension HDU. Member functions provide a TableDesc
appropriate for the FITS data (to help in constructing an aips++ Table
compatible with the BinaryTableExtension), a Table containing the
current row of FITS data and a Table containing the next row of FITS data
(which can be used to step through the FitsInput, copying each row
using the RowCopier class), and a Table containin the entire FITS binary
table from the current row to the end of the table.
Motivation
We need a way to get FITS data into aips++ Tables.
Example
open a FitsInput from a disk file, if the HDU is a BinaryTableExtension,
then instantiate a BinTable object and get the entire table. A fair
amount of error checking has been eliminated from this example.
FitsInput infits("myFITSFile", FITS::Disk);
switch (infits.hdutype()) {
case FITS::BinaryTableHDU:
BinaryTable bintab(infits);
Table tab = bintable.fullTable("myTable");
break;
}
There would obviously be other cases to the switch to deal with any
other HDUs (e.g. skip them via infits.skip_hdu()). The Table destructor
would write "myTable" to disk.
To Do
- It would be nice to construct this directly from the BinaryTableExtension.
- When random access FITS becomes available, this needs to be able to deal with that.
- A corresponding class is needed for conversion from aips++ Tables to FITS.
- Throw exceptions rather than send messages to cout : however the entire FITS
module behaves this way, so it should all remain consistent.
- The following types of columns are not dealt with very well or at all
(Bit, Byte, 0-length columns).
- No attempt use any TDIM columns or keywords to shape arrays.
Member Description
BinaryTable(FitsInput &, FITSErrorHandler errhandler = FITSError::defaultHandler, Bool useMiriadSM = False, Bool sdfits = False)
The only constructor is from a FitsInput, you can also optionally
provide a FITS error handler. If useMiriadSM is True, use
the Miriad storage manager for all columns, otherwise AipsIO.
If sdfits is True, all non-reserved and some reserved keyword
are treated as if they were columns with constant values
"virtual columns" in the sdfits convention.
Table fullTable(const String& tabName, const Table::TableOption = Table::NewNoReplace, Bool useMiriadSM = False)
Get the full table, using the supplied arguments to construct the table.
The table will contain all data from the current row to the end of the
BinarTableExtension.If useMiriadSM is True, use the Miriad storage
manager for all columns, otherwise AipsIO.
This version of the fullTable return a Memory based table
Its recommended if its being used as a temporary
Get an appropriate TableDesc (this is the same TableDesc used to
construct any Table objects returned by this class.
Return the Table keywords (this is the same TableRecord used
in any Table objects returned by this class.
Get a Table with a single row, the current row of the FITS table.
The returned Table is a Scratch table.
The standard BinaryTableExtension manipulation functions are
available to position the FITS input at the desired location.
Get a Table with a single row, the next row of the FITS table.
The returned Table is a Scratch table.
The FITS input is positioned to the next row and the values translated
and returned in a Table object.
this is the function that fills each row in as needed