#include <HDU.h>
Inheritance diagram for CCfits::HDU:
Public Member Functions | |
HDU (const HDU &right) | |
copy constructor | |
bool | operator== (const HDU &right) const |
equality operator | |
bool | operator!= (const HDU &right) const |
inequality operator | |
virtual HDU * | clone (FITSBase *p) const =0 |
virtual copy constructor, to be implemented in subclasses. | |
fitsfile * | fitsPointer () const |
return the fitsfile pointer for the FITS object containing the HDU | |
virtual void | makeThisCurrent () const |
move the fitsfile pointer to this current HDU. | |
std::map< String, Keyword * > | keyWord () |
return the associative array containing the HDU keywords so far read. | |
Keyword & | keyWord (const String &keyName) |
return a (previously read) keyword from the HDU object. | |
const String & | getHistory () |
read the history information from the HDU and add it to the FITS object. | |
const String & | getComments () |
read the comments from the HDU and add it to the FITS object. | |
void | writeHistory (const String &history="Generic History String") |
write a history string. | |
void | writeComment (const String &comment="Generic Comment") |
write a comment string. | |
void | writeDate () |
write a date string to *this. | |
FITSBase * | parent () const |
return reference to the pointer representing the FITSBase object containing the HDU | |
void | readAllKeys () |
read all of the keys in the header | |
long | axes () const |
return the number of axes in the HDU data section (always 2 for tables). | |
long | axis (size_t index) const |
return the length of HDU data axis i. | |
void | index (int value) |
set the HDU number | |
void | deleteKey (const String &doomed) |
delete a keyword from the header | |
long | bitpix () const |
return the data type keyword. | |
void | bitpix (long value) |
set the data type keyword | |
int | index () const |
return the HDU number | |
const string & | history () const |
return the history string previously read by getHistory() | |
const string & | comment () const |
return the comment string previously read by getComment() | |
virtual double | zero () const |
return the BZERO keyword value | |
virtual double | scale () const |
return the BSCALE keyword value | |
const std::map< string, Keyword * > & | keyWord () const |
return the associative array containing the HDU Keywords that have been read so far. | |
const Keyword & | keyWord (const string &keyname) const |
return a (previously read) keyword from the HDU object. const version | |
void | setKeyWord (const string &keyname, Keyword &value) |
set Keyword keyname to specified value | |
template<typename T> | |
Keyword & | addKey (const String &name, T val, const String &comment) |
create a new keyword in the HDU with specified value and comment fields | |
template<typename T> | |
void | readKey (const String &keyName, T &val) |
read a keyword of specified type from the header of a disk FITS file and return its value. | |
template<typename T> | |
void | 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 | |
Protected Member Functions | |
HDU (FITSBase *p=0) | |
default constructor, called by HDU subclasses that read from FITS files. | |
HDU (FITSBase *p, int bitpix, int naxis, const std::vector< long > &axes) | |
constructor for creating new HDU objects, called by HDU subclasses writing to FITS files. | |
virtual | ~HDU () |
destructor | |
std::vector< long > & | naxes () |
return the HDU data axis array. | |
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... |
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].
Keyword & CCfits::HDU::addKey | ( | const String & | name, | |
T | 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:
name | (String) The keyword name | |
value | (T = String, float, std::complex<float>, int, or bool | |
comment | (String) the keyword value |
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::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.
void CCfits::HDU::deleteKey | ( | const String & | doomed | ) |
const String & CCfits::HDU::getComments | ( | ) |
const String & CCfits::HDU::getHistory | ( | ) |
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.
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.
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.
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.
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::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.