casacore
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::BinaryTable Class Reference

More...

#include <BinTable.h>

Public Member Functions

 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. More...
 
 ~BinaryTable ()
 
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. More...
 
Table fullTable ()
 This version of the fullTable return a Memory based table Its recommended if its being used as a temporary. More...
 
const TableDescgetDescriptor ()
 Get an appropriate TableDesc (this is the same TableDesc used to construct any Table objects returned by this class. More...
 
TableRecordgetKeywords ()
 Return the Table keywords (this is the same TableRecord used in any Table objects returned by this class. More...
 
const TablethisRow ()
 Get a Table with a single row, the current row of the FITS table. More...
 
const TablenextRow ()
 Get a Table with a single row, the next row of the FITS table. More...
 
- Public Member Functions inherited from casacore::BinaryTableExtension
 BinaryTableExtension (FitsInput &, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
 BinaryTableExtension (FitsKeywordList &, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
 BinaryTableExtension (FITSErrorHandler errhandler=FITSError::defaultHandler)
 constructor to match write_bintbl_hdr()
More...
 
virtual ~BinaryTableExtension ()
 
Int nrows () const
 return basic elements of a table More...
 
Int ncols () const
 
uInt rowsize () const
 
Int tfields () const
 
const char * tform (int n) const
 
double tscal (int n) const
 
double tzero (int n) const
 
Bool isatnull (int n) const
 
Int tnull (int n) const
 
const char * ttype (int n) const
 
const char * tunit (int n) const
 
const char * tdisp (int n) const
 
const char * tdim (int n) const
 
const char * ctype (int n) const
 
double crpix (int n) const
 
double crota (int n) const
 
double crval (int n) const
 
double cdelt (int n) const
 
Int theap () const
 
const char * author () const
 
const char * referenc () const
 
int bind (int, FitsBase &)
 binds a FitsField to a column More...
 
BinaryTableExtensionoperator++ ()
 row selector functions More...
 
BinaryTableExtensionoperator-- ()
 
BinaryTableExtensionoperator() (int)
 
int read ()
 read entire table into memory More...
 
int read (int)
 read next N rows into memory More...
 
int set_next (int)
 prepare to write the next N rows More...
 
int write (FitsOutput &)
 write current rows More...
 
int write_binTbl_hdr (FitsOutput &, long, int, const char **, const char **, const char **, const char *, long)
 create a binary table header without using FitsKeywordList objet. More...
 
FitsBasefield (int i) const
 select a field More...
 
Int currrow () const
 get current row More...
 
- Public Member Functions inherited from casacore::ExtensionHeaderDataUnit
 ExtensionHeaderDataUnit (FitsInput &, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
 ExtensionHeaderDataUnit (FitsKeywordList &, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
 ~ExtensionHeaderDataUnit ()
 
char * xtension ()
 
char * extname ()
 
Int extver ()
 
Int extlevel ()
 
Int pcount ()
 
Int gcount ()
 
int read (char *addr, int nbytes)
 read next N bytes into addr More...
 
int write (FitsOutput &fout, char *addr, int nbytes)
 write next N bytes from addr to the FITS output fout More...
 
- Public Member Functions inherited from casacore::HeaderDataUnit
virtual ~HeaderDataUnit ()
 
Int dims () const
 
Int dim (int n) const
 
OFF_T fitsdatasize () const
 
FITS::ValueType datatype () const
 
Int fitsitemsize () const
 
Int localitemsize () const
 
FITS::HDUType hdutype () const
 
int err () const
 
int skip (uInt n)
 skipping one or more HDU's More...
 
int skip ()
 
int write_hdr (FitsOutput &)
 write the current header More...
 
ConstFitsKeywordListkwlist ()
 Operations on the HDU's keyword list. More...
 
Vector< Stringkwlist_str (Bool length80=False)
 return the header of the chdu as a vector of String. More...
 
void firstkw ()
 
void lastkw ()
 
const FitsKeywordnextkw ()
 
const FitsKeywordprevkw ()
 
const FitsKeywordcurrkw ()
 
const FitsKeywordkw (int n)
 
const FitsKeywordkw (const FITS::ReservedName &n)
 
const FitsKeywordnextkw (FITS::ReservedName &n)
 
const FitsKeywordkw (FITS::ReservedName &n, int i)
 
const FitsKeywordnextkw (FITS::ReservedName &n, int i)
 
const FitsKeywordkw (const char *n)
 
const FitsKeywordnextkw (const char *n)
 
void mk (FITS::ReservedName k, Bool v, const char *c=0)
 
void mk (FITS::ReservedName k, const char *v=0, const char *c=0)
 
void mk (FITS::ReservedName k, Int v, const char *c=0)
 
void mk (FITS::ReservedName k, double v, const char *c=0)
 
void mk (int n, FITS::ReservedName k, Bool v, const char *c=0)
 
void mk (int n, FITS::ReservedName k, const char *v, const char *c=0)
 
void mk (int n, FITS::ReservedName k, Int v, const char *c=0)
 
void mk (int n, FITS::ReservedName k, double v, const char *c=0)
 
void mk (const char *n, Bool v, const char *c=0)
 
void mk (const char *n, const char *v=0, const char *c=0)
 
void mk (const char *n, Int v, const char *c=0)
 
void mk (const char *n, float v, const char *c=0)
 
void mk (const char *n, double v, const char *c=0)
 
void mk (const char *n, Int r, Int i, const char *c=0)
 
void mk (const char *n, float r, float i, const char *c=0)
 
void mk (const char *n, double r, double i, const char *c=0)
 
void spaces (const char *n=0, const char *c=0)
 
void comment (const char *n=0, const char *c=0)
 
void history (const char *c=0)
 
Bool notnull (double x) const
 
Bool notnull (char *s) const
 
Bool notnull (Int l) const
 
int get_hdr (FITS::HDUType, FitsKeywordList &)
 
int read_data (char *, Int)
 
int write_data (FitsOutput &, char *, Int)
 
OFF_T read_all_data (char *)
 
int write_all_data (FitsOutput &, char *)
 

Private Member Functions

void fillRow ()
 this is the function that fills each row in as needed More...
 

Private Attributes

TablecurrRowTab
 This is the Scratch table containing the current row. More...
 
Intnelem
 The number of elements for each column of the BinaryTableExtension. More...
 
std::map< Int, String > * colNames
 This is a map from column number to column name. More...
 
TableRecord kwSet
 
FITS::ValueTypevatypes_p
 These are used by any VADesc columns. More...
 
void ** vaptr_p
 
VADescFitsFieldva_p
 
char * theheap_p
 

Additional Inherited Members

- Public Types inherited from casacore::HeaderDataUnit
enum  HDUErrs {
  OK ,
  NOMEM ,
  MISSKEY ,
  BADBITPIX ,
  NOAXISN ,
  NOPCOUNT ,
  NOGCOUNT ,
  BADPCOUNT ,
  BADGCOUNT ,
  NOGROUPS ,
  BADNAXIS ,
  BADREC ,
  BADTYPE ,
  BADRULES ,
  BADSIZE ,
  BADOPER ,
  BADCONV ,
  BADIO
}
 error handling and error codes that can be returned More...
 
- Static Public Member Functions inherited from casacore::HeaderDataUnit
static Bool determine_type (FitsKeywordList &, FITS::HDUType &, FITS::ValueType &, FITSErrorHandler, HDUErrs &)
 Determines the HDU type and the data type Parameterss: keyword list, hdu type, data type, error handler and error status. More...
 
static Bool compute_size (FitsKeywordList &, OFF_T &, Int &, FITS::HDUType &, FITS::ValueType &, FITSErrorHandler, HDUErrs &)
 Compute the total size of the data associated with an HDU. More...
 
- Protected Member Functions inherited from casacore::BinaryTableExtension
 BinaryTableExtension (FitsInput &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
 sets field addresses in the current row void set_fitsrow(Int); More...
 
 BinaryTableExtension (FitsKeywordList &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
 BinaryTableExtension (FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
virtual int readrow ()
 read and write the next FITS data row More...
 
virtual int writerow (FitsOutput &)
 
void set_fitsrow (Int)
 sets field addresses in the current row More...
 
- Protected Member Functions inherited from casacore::ExtensionHeaderDataUnit
 ExtensionHeaderDataUnit (FitsInput &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
 ExtensionHeaderDataUnit (FitsKeywordList &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
 
 ExtensionHeaderDataUnit (FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
 This constructor is used for writing only required keywords. More...
 
- Protected Member Functions inherited from casacore::HeaderDataUnit
 HeaderDataUnit (FitsInput &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
 For input – ~ should delete the keyword list: kwflag = 1. More...
 
 HeaderDataUnit (FitsKeywordList &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler, FitsInput *=0)
 For output – ~ should not delete keyword list: kwflag = 0 07/21/98 AKH Clarification: HeaderDataUnit has a copy of the FitsKeywordList, and should delete it. More...
 
 HeaderDataUnit (FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler, FitsInput *=0)
 constructor for objects that write only required keyword to fits file. More...
 
bool init_data_unit (FITS::HDUType t)
 for write required keywords only to use. More...
 
void posEnd ()
 
void errmsg (HDUErrs, const char *)
 
char * assign (FITS::ReservedName)
 
char * assign (FITS::ReservedName, int)
 
double asgdbl (FITS::ReservedName, double)
 
double asgdbl (FITS::ReservedName, int, double)
 
- Protected Attributes inherited from casacore::BinaryTableExtension
Int tfields_x
 
char ** tform_x
 
double * tscal_x
 
double * tzero_x
 
Boolisatnull_x
 
Inttnull_x
 
char ** ttype_x
 
char ** tunit_x
 
char ** tdisp_x
 
char ** tdim_x
 
char ** ctype_x
 
double * crpix_x
 
double * crota_x
 
double * crval_x
 
double * cdelt_x
 
Int nAxis
 
Int theap_x
 
char * author_x
 
char * referenc_x
 
unsigned char * fitsrow
 
uIntfits_offset
 
uInt fitsrowsize
 
Bool isoptimum
 
unsigned char * table
 
uInt tablerowsize
 
uInt alloc_row
 
Int beg_row
 
Int end_row
 
Int curr_row
 
FitsBase ** fld
 
uInttable_offset
 
void ** data_addr
 data addresses of fields of current row More...
 
- Protected Attributes inherited from casacore::ExtensionHeaderDataUnit
char * xtension_x
 
char * extname_x
 
Int extver_x
 
Int extlevel_x
 
Int pcount_x
 
Int gcount_x
 
- Protected Attributes inherited from casacore::HeaderDataUnit
FitsKeywordListkwlist_
 
ConstFitsKeywordList constkwlist_
 
FitsInputfin
 
FITSErrorHandler errfn
 
HDUErrs err_status
 
Int no_dims
 
Intdimn
 
OFF_T fits_data_size
 uInt fits_data_size; // size in bytes of total amount of data More...
 
FITS::ValueType data_type
 
Int fits_item_size
 
Int local_item_size
 
FITS::HDUType hdu_type
 
char pad_char
 
double double_null
 
char char_null
 
Int Int_null
 

Detailed Description


BinaryTable is used to translate a FITS binary table to a Casacore Table.

Intended use:

Public interface

Review Status

Test programs:
tBinTable

Prerequisite

Etymology

BinaryTable inherits from the FITS BinaryTableExtension class and its primary use is to convert that class to a Casacore 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 a Casacore 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 Casacore 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()) {
BinaryTable bintab(infits);
Table tab = bintable.fullTable("myTable");
break;
}
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.
@ BinaryTableHDU
Definition: fits.h:265

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

Definition at line 110 of file BinTable.h.

Constructor & Destructor Documentation

◆ BinaryTable()

casacore::BinaryTable::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.

◆ ~BinaryTable()

casacore::BinaryTable::~BinaryTable ( )

Member Function Documentation

◆ fillRow()

void casacore::BinaryTable::fillRow ( )
private

this is the function that fills each row in as needed

◆ fullTable() [1/2]

Table casacore::BinaryTable::fullTable ( )

This version of the fullTable return a Memory based table Its recommended if its being used as a temporary.

◆ fullTable() [2/2]

Table casacore::BinaryTable::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.

◆ getDescriptor()

const TableDesc& casacore::BinaryTable::getDescriptor ( )

Get an appropriate TableDesc (this is the same TableDesc used to construct any Table objects returned by this class.

◆ getKeywords()

TableRecord& casacore::BinaryTable::getKeywords ( )

Return the Table keywords (this is the same TableRecord used in any Table objects returned by this class.

◆ nextRow()

const Table& casacore::BinaryTable::nextRow ( )

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.

◆ thisRow()

const Table& casacore::BinaryTable::thisRow ( )

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.

Member Data Documentation

◆ colNames

std::map<Int, String>* casacore::BinaryTable::colNames
private

This is a map from column number to column name.

Definition at line 168 of file BinTable.h.

◆ currRowTab

Table* casacore::BinaryTable::currRowTab
private

This is the Scratch table containing the current row.

Definition at line 164 of file BinTable.h.

◆ kwSet

TableRecord casacore::BinaryTable::kwSet
private

Definition at line 170 of file BinTable.h.

◆ nelem

Int* casacore::BinaryTable::nelem
private

The number of elements for each column of the BinaryTableExtension.

Definition at line 166 of file BinTable.h.

◆ theheap_p

char* casacore::BinaryTable::theheap_p
private

Definition at line 176 of file BinTable.h.

◆ va_p

VADescFitsField* casacore::BinaryTable::va_p
private

Definition at line 175 of file BinTable.h.

◆ vaptr_p

void** casacore::BinaryTable::vaptr_p
private

Definition at line 174 of file BinTable.h.

◆ vatypes_p

FITS::ValueType* casacore::BinaryTable::vatypes_p
private

These are used by any VADesc columns.

Definition at line 173 of file BinTable.h.


The documentation for this class was generated from the following file: