#include <HDU.h>
Inheritance diagram for CCfits::HDU:
Public Member Functions | |
HDU (const HDU &right) | |
bool | operator== (const HDU &right) const |
bool | operator!= (const HDU &right) const |
virtual HDU * | clone (FITSBase *p) const =0 |
fitsfile * | fitsPointer () const |
virtual void | makeThisCurrent () const |
std::map< String, Keyword * > | keyWord () |
Keyword & | keyWord (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 Keyword & | keyWord (const string &keyname) const |
void | setKeyWord (const string &keyname, Keyword &value) |
template<typename T> | |
Keyword & | addKey (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... |
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].
CCfits::HDU::HDU | ( | const HDU & | right | ) |
copy constructor
CCfits::HDU::HDU | ( | FITSBase * | p = 0 |
) | [protected] |
CCfits::HDU::HDU | ( | FITSBase * | p, | |
int | bitpix, | |||
int | naxis, | |||
const std::vector< long > & | axes | |||
) | [protected] |
CCfits::HDU::~HDU | ( | ) | [protected, virtual] |
destructor
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::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 | ) |
fitsfile * CCfits::HDU::fitsPointer | ( | ) | const |
const String & CCfits::HDU::getComments | ( | ) |
const String & CCfits::HDU::getHistory | ( | ) |
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.
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.
double CCfits::HDU::scale | ( | ) | const [inline, virtual] |
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] |