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

CCfits::Column Class Reference

Abstract base class for Column objects. More...

#include <Column.h>

List of all members.

Public Methods

 Column (const Column &right)
virtual ~Column ()
virtual void readData (long firstRow, long nelements, long firstElem=1)=0
int rows () const
void setDisplay ()
virtual void setDimen ()
int index () const
bool isRead () const
long width () const
size_t repeat () const
bool varLength () const
double scale () const
double zero () const
const string& display () const
const string& dimen () const
ValueType type () const
const std::string& name () const
const std::string& unit () const
const std::string& format () const
template<typename S> void write (const std::vector< S > &indata, long firstRow)
template<typename S> void write (const std::valarray< S > &indata, long firstRow)
template<typename S> void write (S *indata, long nRows, long firstRow)
template<typename S> void write (const std::vector< S > &indata, long firstRow, S *nullValue)
template<typename S> void write (const std::valarray< S > &indata, long firstRow, S *nullValue)
template<typename S> void write (S *indata, long nRows, long firstRow, S *nullValue)
template<typename S> void write (const std::valarray< S > &indata, long nRows, long firstRow)
template<typename S> void write (const std::vector< S > &indata, long nRows, long firstRow)
template<typename S> void write (S *indata, long nElements, long nRows, long firstRow)
template<typename S> void write (const std::valarray< S > &indata, long nRows, long firstRow, S *nullValue)
template<typename S> void write (const std::vector< S > &indata, long nRows, long firstRow, S *nullValue)
template<typename S> void write (S *indata, long nElements, long nRows, long firstRow, S *nullValue)
template<typename S> void write (const std::valarray< S > &indata, const std::vector< long > &vectorLengths, long firstRow)
template<typename S> void write (const std::vector< S > &indata, const std::vector< long > &vectorLengths, long firstRow)
template<typename S> void write (S *indata, long nElements, const std::vector< long > &vectorLengths, long firstRow)
template<typename S> void writeArrays (const std::vector< std::valarray< S > > &indata, long firstRow)
template<typename S> void writeArrays (const std::vector< std::valarray< S > > &indata, long firstRow, S *nullValue)
template<typename S> void read (std::vector< S > &vals, long first, long last)
template<typename S> void read (std::valarray< S > &vals, long first, long last)
template<typename S> void read (std::valarray< S > &vals, long rows)
template<typename S> void readArrays (std::vector< std::valarray< S > > &vals, long first, long last)
template<typename S> void read (std::vector< S > &vals, long first, long last, S *nullValue)
template<typename S> void read (std::valarray< S > &vals, long first, long last, S *nullValue)
template<typename S> void read (std::valarray< S > &vals, long rows, S *nullValue)
template<typename S> void readArrays (std::vector< std::valarray< S > > &vals, long first, long last, S *nullValue)
template<typename T> void addNullValue (T nullVal)

Protected Methods

 Column (int columnIndex, const string &columnName, ValueType type, const string &format, const string &unit, Table *p, int rpt=1, long w=1, const string &comment="")
 Column (Table *p=0)
fitsfile* fitsPointer ()
void makeHDUCurrent ()
virtual std::ostream& put (std::ostream &s) const
const std::string& comment () const


Detailed Description

Abstract base class for Column objects.

Columns are the data containers used in FITS tables. Columns of scalar type (one entry per cell) are implemented by the template subclass ColumnData<T>. Columns of vector type (vector and variable rows) are implemented with the template subclass ColumnVectorData<T>. AsciiTables may only contain Columns of type ColumnData<T>, where T is an implemented FITS data type (see the CCfits.h header for a complete list. This requirement is enforced by ensuring that AsciiTable's addColumn method may only create an AsciiTable compatible column. The ColumnData<T> class stores its data in a std::vector<T> object.

BinTables may contain either ColumnData<T> or ColumnVectorData<T>. For ColumnVectorData, T must be a numeric type: string vectors are handled by ColumnData<T>; string arrays are not supported. The internal representation of the data is a std::vector<std::valarray<T> > object. The std::valarray class is designed for efficient numeric processing and has many vectorized numeric and transcendental functions defined on it.

Member template functions for read/write operations are provided in multiple overloads as the interface to data operations. Implicit data type conversions are supported but where they are required make the operations less efficient. Reading numeric column data as character arrays, supported by cfitsio, is not supported by CCfits.

As a base class, Column provides protected accessor/mutator inline functions to allow only its subclasses to access data members.


Constructor & Destructor Documentation

CCfits::Column::Column ( const Column & right )
 

copy constructor, used in copying Columns to standard library containers.

The copy constructor is for internal use only: it does not affect the disk fits file associated with the object.

CCfits::Column::~Column ( ) [virtual]
 

destructor.

CCfits::Column::Column ( int columnIndex,
const string & columnName,
ValueType type,
const string & format,
const string & unit,
Table * p,
int rpt = 1,
long w = 1,
const string & comment = "" ) [protected]
 

new column creation constructor.

This constructor allows the specification of:

Parameters:
columnIndex   The column number
columnName   The column name, keyword TTYPEn
type   used for determining class of T in ColumnData<T>, ColumnVectorData<T>
format   the column data format, TFORMn keyword
unit   the column data unit, TUNITn keyword
p   the Table pointer
rpt   (optional) repeat count for the row ( == 1 for AsciiTables)
w   the row width
comment   comment to be added to the header.

CCfits::Column::Column ( Table * p = 0 ) [protected]
 

Simple constructor to be called by subclass reading ctors.


Member Function Documentation

template<typename T>
void CCfits::Column::addNullValue ( T nullVal )
 

Set the TNULLn keyword for the column.

Only relevant for integer valued columns, TNULLn is the value used by cfitsio in undefined processing. All entries in the table equal to an input "null value" are set equal to the value of TNULLn. (For floating point columns a system NaN values is used).

const std::string & CCfits::Column::comment ( ) const [inline, protected]
 

retrieve comment for Column.

const string & CCfits::Column::dimen ( ) const [inline]
 

return TDIMn keyword.

represents dimensions of data arrays in vector columns. for scalar columns, returns a default value.

const string & CCfits::Column::display ( ) const [inline]
 

return TDISPn keyword.

TDISPn is suggested format for output of column data.

fitsfile * CCfits::Column::fitsPointer ( ) [protected]
 

fits pointer corresponding to fits file containing column data.

const std::string & CCfits::Column::format ( ) const [inline]
 

return TFORMn keyword.

TFORMn specifies data format stored in disk file.

int CCfits::Column::index ( ) const [inline]
 

get the Column index (the n in TTYPEn etc).

bool CCfits::Column::isRead ( ) const [inline]
 

flag set to true if the entire column data has been read from disk.

void CCfits::Column::makeHDUCurrent ( ) [protected]
 

make HDU containing this the current HDU of the fits file.

const std::string & CCfits::Column::name ( ) const [inline]
 

return name of Column (TTYPEn keyword).

std::ostream & CCfits::Column::put ( std::ostream & s ) const [protected, virtual]
 

internal implementation of << operator.

template<typename S>
void CCfits::Column::read ( std::valarray< S > & vals,
long row,
S * nullValue )
 

return a single row of a vector column into a std::valarray, setting undefined values.

template<typename S>
void CCfits::Column::read ( std::valarray< S > & vals,
long first,
long last,
S * nullValue )
 

Retrieve data from a scalar column into a std::valarray, setting undefined values.

Parameters:
vals   The output container. The function will resize this as necessary
first,last   the span of row numbers to read.

template<typename S>
void CCfits::Column::read ( std::vector< S > & vals,
long first,
long last,
S * nullValue )
 

Retrieve data from a scalar column into a std::vector, setting nullvalue.

As above, only a pointer to a null value is also recognized. If the column is of integer type, then any column value that equals this null value is set equal to the value of the TNULLn keyword. An exception is thrown if TNULLn is not specified. See cfitsio documentation for further details

Parameters:
vals   The output container. The function will resize this as necessary
first,last   the span of row numbers to read.
nullValue, pointer   to integer value regarded as undefined

template<typename S>
void CCfits::Column::read ( std::valarray< S > & vals,
long row )
 

return a single row of a vector column into a std::valarray.

Parameters:
vals   The output valarray object
rows   The row number to be retrieved (starting at 1).

template<typename S>
void CCfits::Column::read ( std::valarray< S > & vals,
long first,
long last )
 

Retrieve data from a scalar column into a std::valarray.

Parameters:
vals   The output container. The function will resize this as necessary
first,last   the span of row numbers to read.

template<typename S>
void CCfits::Column::read ( std::vector< S > & vals,
long first,
long last )
 

Retrieve data from a scalar column into a std::vector.

This and the following functions perform implicit data conversions. An exception will be thrown if no conversion exists.

Parameters:
vals   The output container. The function will resize this as necessary
first,last   the span of row numbers to read.

template<typename S>
void CCfits::Column::readArrays ( std::vector< std::valarray< S > > & vals,
long first,
long last,
S * nullValue )
 

return a set of rows of a vector column into a container, setting undefined values.

Parameters:
vals   The output container. The function will resize this as necessary
first,last   the span of row numbers to read.

template<typename S>
void CCfits::Column::readArrays ( std::vector< std::valarray< S > > & vals,
long first,
long last )
 

return a set of rows of a vector column into a vector of valarrays.

Parameters:
vals   The output container. The function will resize this as necessary
first,last   the span of row numbers to read.

void CCfits::Column::readData ( long firstrow = 1,
long nelements = 1,
long firstelem = 1 ) [pure virtual]
 

read method.

Parameters:
firstRow   The first row to be read
firstElem   the number of the element on the first row to start at (ignored for scalar columns)
nRows   The number of rows to read

size_t CCfits::Column::repeat ( ) const [inline]
 

get the repeat count for the rows.

int CCfits::Column::rows ( ) const
 

return number of rows in the Column.

double CCfits::Column::scale ( ) const [inline]
 

get TSCALn value.

TSCALn is used to convert a data array represented on disk in integer format as floating. Useful for compact storage of digitized data.

void CCfits::Column::setDimen ( ) [inline, virtual]
 

set the TDIMn keyword.

void CCfits::Column::setDisplay ( )
 

set the TDISPn keyword.

ValueType CCfits::Column::type ( ) const [inline]
 

returns the data type of the column.

const std::string & CCfits::Column::unit ( ) const [inline]
 

get units of data in Column (TUNITn keyword).

bool CCfits::Column::varLength ( ) const [inline]
 

boolean, set to true if Column has variable length vector rows.

long CCfits::Column::width ( ) const [inline]
 

return column data width.

template<typename S>
void CCfits::Column::write ( S * indata,
long nelements,
const std::vector< long > & vectorLengths,
long firstRow )
 

write a C-array of values of size nElements into a column with specified number of entries written per row.

template<typename S>
void CCfits::Column::write ( const std::vector< S > & indata,
const std::vector< long > & vectorLengths,
long firstRow )
 

write a vector of values into a column with specified number of entries written per row.

template<typename S>
void CCfits::Column::write ( const std::valarray< S > & indata,
const std::vector< long > & vectorLengths,
long firstRow )
 

write a valarray of values into a column with specified number of entries written per row.

Data are written into vectorLengths.size() rows, with vectorLength[n] elements written to row n+firstRow -1. Although clearly designed for wrapping calls to multiple variable-width vector column rows, the code is written to write a variable number of elements to fixed-width column rows (cfitsio requires these operations to be done on a row-by-row basis).

Since cfitsio does not support null value processing for variable width columns this function and its variants do not have version which process undefined values

Parameters:
indata   The data to be written
vectorLengths   the number of elements to write to each successive row.
firstRow   the first row to be written.

template<typename S>
void CCfits::Column::write ( S * indata,
long nelements,
long nRows,
long firstRow,
S * nullValue )
 

write a C array of values into a range of rows of a vector column, processing undefined values.

template<typename S>
void CCfits::Column::write ( const std::vector< S > & indata,
long nRows,
long firstRow,
S * nullValue )
 

write a vector of values into a range of rows of a vector column, processing undefined values.

see valarray version for details.

template<typename S>
void CCfits::Column::write ( const std::valarray< S > & indata,
long nRows,
long firstRow,
S * nullValue )
 

write a valarray of values into a range of rows of a vector column.

see version without undefined processing for details.

template<typename S>
void CCfits::Column::write ( S * indata,
long nelements,
long nRows,
long firstRow )
 

write a C array of values into a range of rows of a vector column.

Details are as for vector input; only difference is the need to supply the size of the C-array.

Parameters:
indata   The data to be written.
nElements   The size of indata
nRows   the number of rows to which to write the data.
firstRow   The first row to be written

template<typename S>
void CCfits::Column::write ( const std::vector< S > & indata,
long nRows,
long firstRow )
 

write a vector of values into a range of rows of a vector column.

see valarray version for details.

template<typename S>
void CCfits::Column::write ( const std::valarray< S > & indata,
long nRows,
long firstRow )
 

write a valarray of values into a range of rows of a vector column.

This and the equivalent vector version write a vector of values into nRows. The primary use of this is for fixed width columns, in which case Column's repeat attribute is used to determine how many elements are written to each row; if indata.size() is too small an exception will be thrown. If the column is variable width, the call will write indata.size()/nRows elements to each row.

Parameters:
indata   The data to be written.
nRows   the number of rows to which to write the data.
firstRow   The first row to be written

template<typename S>
void CCfits::Column::write ( S * indata,
long nRows,
long firstRow,
S * nullValue )
 

write a C array into a scalar Column, processing undefined values.

Parameters:
indata   The data to be written.
nRows   The size of the data array to be written
firstRow   The first row to be written
nullValue   Pointer to the value in the input array to be set to undefined values

template<typename S>
void CCfits::Column::write ( const std::valarray< S > & indata,
long firstRow,
S * nullValue )
 

write a valarray of values into a scalar column starting with firstRow with undefined values set to nullValue.

Parameters:
indata   The data to be written.
firstRow   The first row to be written
nullValue   Pointer to the value in the input array to be set to undefined values

template<typename S>
void CCfits::Column::write ( const std::vector< S > & indata,
long firstRow,
S * nullValue )
 

write a vector of values into a row starting with firstRow with undefined values set to nullValue.

Parameters:
indata   The data to be written.
firstRow   The first row to be written
nullValue   Pointer to the value in the input array to be set to undefined values

template<typename S>
void CCfits::Column::write ( S * indata,
long nRows,
long firstRow )
 

write a C array of size nRows into a scalar Column starting with row firstRow.

Parameters:
indata   The data to be written.
nRows   The size of the data array to be written
firstRow   The first row to be written

template<typename S>
void CCfits::Column::write ( const std::valarray< S > & indata,
long firstRow )
 

write a valarray of values into a scalar column starting with firstRow.

Parameters:
indata   The data to be written.
firstRow   The first row to be written

template<typename S>
void CCfits::Column::write ( const std::vector< S > & indata,
long firstRow )
 

write a vector of values into a row starting with firstRow.

Parameters:
indata   The data to be written.
firstRow   The first row to be written

template<typename S>
void CCfits::Column::writeArrays ( const std::vector< std::valarray< S > > & indata,
long firstRow,
S * nullValue )
 

write a vector of valarray objects to the column, starting at row firstRow >= 1, processing undefined values.

template<typename S>
void CCfits::Column::writeArrays ( const std::vector< std::valarray< S > > & indata,
long firstRow )
 

write a vector of valarray objects to the column, starting at row firstRow >= 1.

double CCfits::Column::zero ( ) const [inline]
 

get TZEROn value.

TZEROn is an integer offset used in the implementation of unsigned data


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