CCfits::HDU Class Reference

Base class for all HDU [Header-Data Unit] objects. More...

#include <HDU.h>

Inheritance diagram for CCfits::HDU:

Inheritance diagram
CCfits::ExtHDU CCfits::PHDU CCfits::Table CCfits::AsciiTable CCfits::BinTable List of all members.

Public Member Functions

 HDU (const HDU &right)
bool operator== (const HDU &right) const
bool operator!= (const HDU &right) const
virtual HDUclone (FITSBase *p) const =0
fitsfile * fitsPointer () const
virtual void makeThisCurrent () const
std::map< String, Keyword * > keyWord ()
KeywordkeyWord (const String &keyName)
const String & getHistory ()
const String & getComments ()
void writeHistory (const String &history="Generic History String")
void writeComment (const String &comment="Generic Comment")
void writeDate ()
FITSBase * parent () const
void readAllKeys ()
long axes () const
long axis (size_t index) const
void index (int value)
void deleteKey (const String &doomed)
long bitpix () const
void bitpix (long value)
int index () const
const string & history () const
const string & comment () const
virtual double zero () const
virtual double scale () const
const std::map< string, Keyword * > & keyWord () const
const KeywordkeyWord (const string &keyname) const
void setKeyWord (const string &keyname, Keyword &value)
template<typename T>
KeywordaddKey (const String &name, T val, const String &comment)
template<typename T>
void readKey (const String &keyName, T &val)
template<typename T>
void readKeys (std::vector< String > &keyNames, std::vector< T > &vals)

Protected Member Functions

 HDU (FITSBase *p=0)
 HDU (FITSBase *p, int bitpix, int naxis, const std::vector< long > &axes)
virtual ~HDU ()
std::vector< long > & naxes ()

Classes

class  InvalidExtensionType
 exception to be thrown if user requests extension type that can not be understood as ImageExt, AsciiTable or BinTable. More...
class  InvalidImageDataType
 exception to be thrown if user requests creation of an image of type not supported by cfitsio. More...
class  NoNullValue
 exception to be thrown on seek errors for keywords. More...
class  NoSuchKeyword
 exception to be thrown on seek errors for keywords. More...

Detailed Description

Base class for all HDU [Header-Data Unit] objects.

HDU objects in CCfits are either PHDU (Primary HDU objects) or ExtHDU (Extension HDU) objects. Following the behavior. ExtHDUs are further subclassed into ImageExt or Table objects, which are finally AsciiTable or BinTable objects.

HDU's public interface gives access to properties that are common to all HDUs, largely required keywords, and functions that are common to all HDUs, principally the manipulation of keywords and their values.

HDUs must be constructed by HDUCreator objects which are called by FITS methods. Each HDU has an embedded pointer to a FITSBase object, which is private to FITS [FITSBase is a pointer encapsulating the resources of FITS. For details of this coding idiom see Exceptional C++ by Herb Sutter (2000) and references therein].


Constructor & Destructor Documentation

CCfits::HDU::HDU ( const HDU right  ) 

copy constructor

CCfits::HDU::HDU ( FITSBase *  p = 0  )  [protected]

default constructor, called by HDU subclasses that read from FITS files.

CCfits::HDU::HDU ( FITSBase *  p,
int  bitpix,
int  naxis,
const std::vector< long > &  axes 
) [protected]

constructor for creating new HDU objects, called by HDU subclasses writing to FITS files.

CCfits::HDU::~HDU (  )  [protected, virtual]

destructor


Member Function Documentation

template<typename T>
Keyword & CCfits::HDU::addKey ( const String &  name,
value,
const String &  comment 
)

create a new keyword in the HDU with specified value and comment fields

the function returns a reference to keyword object just created.

Parameters:

Parameters:
name (String) The keyword name
value (T = String, float, std::complex<float>, int, or bool
comment (String) the keyword value
Note the limitations on T, which arise for historical reasons (i.e. since keywords do not contain explicit type information, routines in CCfits must assign a type). The limitation may be removed in a future release

It is possible however to create a keyword of any of the allowed data types in fitsio (see the cfitsio manual section 4.3). The required calls are, e.g. for a floating point double valued keyword:

NewKeyword<double> keyCreate( hdu, double val1 ); Keyword* key1 = Keyword keyCreate.MakeKeyword(keyName1, const String& comment); keyCreate.keyData(val2); Keyword* key2 = Keyword keyCreate.MakeKeyword(keyName2, const String& comment);

key1->write(); key2->write();

... which is essentially what addKey does for its allowed types.

long CCfits::HDU::axes (  )  const [inline]

return the number of axes in the HDU data section (always 2 for tables).

long CCfits::HDU::axis ( size_t  index  )  const [inline]

return the length of HDU data axis i.

void CCfits::HDU::bitpix ( long  value  )  [inline]

set the data type keyword

long CCfits::HDU::bitpix (  )  const [inline]

return the data type keyword.

Takes values denoting the image data type for images, and takes the fixed value 8 for tables.

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

virtual copy constructor, to be implemented in subclasses.

Implemented in CCfits::AsciiTable, CCfits::BinTable, CCfits::ExtHDU, and CCfits::PHDU.

const string & CCfits::HDU::comment (  )  const [inline]

return the comment string previously read by getComment()

void CCfits::HDU::deleteKey ( const String &  doomed  ) 

delete a keyword from the header

removes doomed from the FITS file and from the FITS object

fitsfile * CCfits::HDU::fitsPointer (  )  const

return the fitsfile pointer for the FITS object containing the HDU

const String & CCfits::HDU::getComments (  ) 

read the comments from the HDU and add it to the FITS object.

The comment string found in the header is concatenated and returned to the calling function

const String & CCfits::HDU::getHistory (  ) 

read the history information from the HDU and add it to the FITS object.

The history string found in the header is concatenated and returned to the calling function

const string & CCfits::HDU::history (  )  const [inline]

return the history string previously read by getHistory()

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

return the HDU number

void CCfits::HDU::index ( int  value  )  [inline]

set the HDU number

const Keyword & CCfits::HDU::keyWord ( const string &  keyname  )  const [inline]

return a (previously read) keyword from the HDU object. const version

const std::map< string, Keyword * > & CCfits::HDU::keyWord (  )  const [inline]

return the associative array containing the HDU Keywords that have been read so far.

Keyword & CCfits::HDU::keyWord ( const String &  keyName  )  [inline]

return a (previously read) keyword from the HDU object.

std::map< String, Keyword * > CCfits::HDU::keyWord (  )  [inline]

return the associative array containing the HDU keywords so far read.

void CCfits::HDU::makeThisCurrent (  )  const [virtual]

move the fitsfile pointer to this current HDU.

This function should never need to be called by the user since it is called internally whenever required.

Reimplemented in CCfits::ExtHDU.

std::vector< long > & CCfits::HDU::naxes (  )  [inline, protected]

return the HDU data axis array.

bool CCfits::HDU::operator!= ( const HDU right  )  const

inequality operator

bool CCfits::HDU::operator== ( const HDU right  )  const

equality operator

const FITSBase *& CCfits::HDU::parent (  )  const

return reference to the pointer representing the FITSBase object containing the HDU

void CCfits::HDU::readAllKeys (  ) 

read all of the keys in the header

This member function reads keys that are not meta data for columns or image information, [which are considered to be part of the column or image objects]. Also, history and comment keys are read and returned by getHistory() and getComment().

Note that readAllKeys can only construct keys of type string, float, complex<float>, integer, and bool because the FITS header records do not encode exact type information.

template<typename T>
void CCfits::HDU::readKey ( const String &  keyName,
T &  val 
)

read a keyword of specified type from the header of a disk FITS file and return its value.

T is one of the types String, float, int, std::complex<float>, and bool.

template<typename T>
void CCfits::HDU::readKeys ( std::vector< String > &  keyNames,
std::vector< T > &  vals 
)

read a set of specified keywords of the same data type from the header of a disk FITS file and return their values

T is one of the types String, float, int, std::complex<float>, and bool.

double CCfits::HDU::scale (  )  const [inline, virtual]

return the BSCALE keyword value

Reimplemented in CCfits::PHDU.

void CCfits::HDU::setKeyWord ( const string &  keyname,
Keyword value 
) [inline]

set Keyword keyname to specified value

void CCfits::HDU::writeComment ( const String &  comment = "Generic Comment"  ) 

write a comment string.

A default value for the string is given ("Generic Comment String") so users can put a placeholder call to this function in their code.

void CCfits::HDU::writeDate (  ) 

write a date string to *this.

void CCfits::HDU::writeHistory ( const String &  history = "Generic History String"  ) 

write a history string.

A default value for the string is given ("Generic History String") so users can put a placeholder call to this function in their code.

double CCfits::HDU::zero (  )  const [inline, virtual]

return the BZERO keyword value

Reimplemented in CCfits::PHDU.


The documentation for this class was generated from the following files:
Generated on Fri Nov 3 17:09:09 2006 for CCfits by  doxygen 1.4.7