Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Compound Members   Related Pages  

CCfits::AsciiTable Class Reference

Class Representing Ascii Table Extensions. More...

#include <AsciiTable.h>

Inheritance diagram for CCfits::AsciiTable::

Inheritance diagram
CCfits::Table CCfits::ExtHDU CCfits::HDU List of all members.

Public Methods

virtual AsciiTable* clone (FITSBase *p) const
virtual void readData (bool readFlag=false, const std::vector< string > &keys=std::vector< string >())
virtual void addColumn (ValueType type, const string &columnName, long repeatWidth, const string &colUnit=string(""), long decimals=-1, size_t columnNumber=0)

Protected Methods

 AsciiTable (FITSBase *p, const string &hduName=string(""), bool readFlag=false, const std::vector< string > &keys=std::vector< string >(), int version=1)
 AsciiTable (FITSBase *p, const string &hduName, int rows, const std::vector< string > &columnName=std::vector< string >(), const std::vector< string > &columnFmt=std::vector< string >(), const std::vector< string > &columnUnit=std::vector< string >(), int version=1)
 AsciiTable (FITSBase *p, int number)
 ~AsciiTable ()

Detailed Description

Class Representing Ascii Table Extensions.

May only contain columns with scalar row entries and a small range of data types. AsciiTable (re)implements functions prescribed in the Table abstract class. The implementations allow the calling of cfitsio specialized routines for AsciiTable header construction.

Direct instantiation of AsciiTable objects is disallowed: they are created by explicit calls to FITS::addTable( ... ), FITS::read(...) or internally by one of the FITS ctors on initialization. The default for FITS::addTable is to produce BinTable extensions.


Constructor & Destructor Documentation

CCfits::AsciiTable::AsciiTable ( FITSBase * p,
const string & hduName = string(""),
bool readFlag = false,
const std::vector< string > & keys = std::vector<string>(),
int version = 1 ) [protected]
 

reading constructor: Construct a AsciiTable extension from an extension of an existing disk file.

The Table is specified by name and optional version number within the file. An array of strings representing columns or keys indicates which data are to be read. The column data are only read if readFlag is true. Reading on construction is optimized, so it is more efficient to read data at the point of instantiation. This favours a "resource acquisition is initialization" model of data management.

Parameters:
hduName   name of AsciiTable object to be read.
readFlag   flag to determine whether to read data on construction
keys   (optional) a list of keywords/columns to be read. The implementation will determine which are keywords. If none are specified, the constructor will simply read the header
version   (optional) version number. If not specified, will read the first extension that matches hduName.

CCfits::AsciiTable::AsciiTable ( FITSBase * p,
const string & hduName,
int rows,
const std::vector< string > & columnName = std::vector<string>(),
const std::vector< string > & columnFmt = std::vector<string>(),
const std::vector< string > & columnUnit = std::vector<string>(),
int version = 1 ) [protected]
 

writing constructor: create new Ascii Table object with the specified columns.

The constructor creates a valid HDU which is ready for Column::write or insertRows operations. The disk FITS file is update accordingly. The data type of each column is determined by the columnFmt argument (TFORM keywords). See cfitsio documentation for acceptable values.

Parameters:
hduName   name of AsciiTable object to be written
rows   number of rows in the table (NAXIS2)
columnName   array of column names for columns to be constructed.
columnFmt   array of column formats for columns to be constructed.
columnUnit   (optional) array of units for data in columns.
version   (optional) version number for HDU.

The dimensions of columnType, columnName and columnFmt must match, although this is not enforced at present.

Todo:
{enforce equal dimensions for arrays input to AsciiTable, BinTable writing ctor}

CCfits::AsciiTable::AsciiTable ( FITSBase * p,
int number ) [protected]
 

read AsciiTable with HDU number number from existing file.

This is used internally by methods that need to access HDUs for which no EXTNAME [or equivalent] keyword exists.

CCfits::AsciiTable::~AsciiTable ( ) [protected]
 

destructor.


Member Function Documentation

void CCfits::AsciiTable::addColumn ( ValueType type,
const string & columnName,
long repeatWidth,
const string & colUnit = string(""),
long decimals = -1,
size_t columnNumber = 0 ) [virtual]
 

add a new column to an existing table HDU.

Parameters:
type   The data type of the column to be added
columnName   The name of the column to be added
repeatWidth   for a string valued, this is the width of a string. For a numeric column it supplies the vector length of the rows. It is ignored for ascii table numeric data.
colUnit   an optional field specifying the units of the data (TUNITn)
decimal   optional parameter specifying the number of decimals for an ascii numeric column
columnNumber   optional parameter specifying column number to be created. If not specified the column is added to the end. If specified, the column is inserted and the columns already read are reindexed. This parameter is provided as a convenience to support existing code rather than recommended.

Reimplemented from CCfits::ExtHDU.

AsciiTable * CCfits::AsciiTable::clone ( FITSBase * p ) const [virtual]
 

virtual copy constructor.

Reimplemented from CCfits::ExtHDU.

void CCfits::AsciiTable::readData ( bool readFlag = false,
const std::vector< string > & keys = std::vector<string>() ) [virtual]
 

read columns and keys specified in the input array.

See Table class documentation for further details.

Reimplemented from CCfits::ExtHDU.


The documentation for this class was generated from the following files:
Generated at Fri Apr 11 16:05:09 2003 for CCfits by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001