LTL  2.0.x
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Related Functions | List of all members
ltl::FitsExtensionOut Class Reference

Create a FITS extension object. Look into test/testfitsextensionio.cpp for examples. More...

Inherits ltl::FitsOut, and ltl::FitsExtension.

Public Member Functions

 FitsExtensionOut (const string &path)
 
 FitsExtensionOut (const char *path)
 
 FitsExtensionOut (const string &path, const FitsHeader &header, const bool quiet_please=false, const bool ign_junk=false)
 
 FitsExtensionOut (const char *path, const FitsHeader &header, const bool quiet_please=false, const bool ign_junk=false)
 
virtual ~FitsExtensionOut ()
 
void flushHeader ()
 dump header to file, i.e. either primary or of next extension More...
 
void setGeometry (const int newbitpix, const util::Region &region, const bool append=false)
 Create "empty" FITS file, i.e. header + zero data segment. More...
 
virtual void describeSelf (std::ostream &os)
 Write FITS file geometry and class interna to out stream. More...
 
void openData (const int newbitpix, const int newnaxis, const int *newnaxis_i, const bool append=false) throw (FitsException)
 Write FITS file header and create suitable data segment map. More...
 
void openData (const int newbitpix, const util::Region &region, const bool append=false) throw (FitsException)
 Write FITS file header and create region sized data segment map. More...
 
void setRegion (const util::Region &region) throw (FitsException)
 Set Region for selective access to parts of data segment . More...
 
void resetRegion ()
 Reset Region, if set. More...
 
bool isRegion () const
 Return true if region is set. More...
 
void closeData ()
 Finish FITS file, unmap data segment. More...
 
void copyData (FitsIn &infile, const bool append=false)
 Copy data (and BSCALE and BZERO) from infile. More...
 
unsigned char * begin () const
 
unsigned char * end () const
 
void resetPosition ()
 
void setPosition (off_t offset)
 
ptrdiff_t getPosition () const
 
void setFilename (const string &path)
 Set output filename according to argument. More...
 
void setBitpixOut (const int bpo) throw (FitsException)
 Override automatic BITPIX setting with argument. More...
 
void setOrigin (const string &orig)
 Set FITS key ORIGIN according to argument. More...
 
int getBitpixOut () const
 Public method to read ltl::FitsOut::bitpixout_. More...
 
string getOrigin () const
 Public method to read ltl::FitsOut::origin_. More...
 
template<class T >
void writeDataArray (T &i)
 Fill data segment with container via iterator i. More...
 
template<class T >
void writeRegionArray (T &i)
 Fill region of data segment with container via iterator i. More...
 
template<class T >
void setNextPixel (const T value)
 Per pixel writing, set next pixel to value. More...
 
std::string adjustKeyword (std::string keyword) const
 Return keyword trimmed (or expanded) to a width of 8 chars. More...
 
int eraseCard (const std::string &keyword) throw (FitsException)
 Erase FITS card keyword. More...
 
off_t getDataOffset () const
 Return the byte offset within the file to the data segment. More...
 
off_t getDataLength () const
 Return the size of the data segment in bytes. More...
 
std::string writeHeader (const bool with_junk=false)
 Return a new valid FITS file format header. More...
 
string getFilename () const
 Return ltl::FitsIO::filename_ . More...
 
unsigned char * streampos () const
 Return ltl::FitsIO::fitsstreamptr_ . More...
 
size_t getExtNo () const
 Return number of actual extension. More...
 
bool getPrimary () const
 Return status of primary flag, i.e. reading or writing primary header / data. More...
 
void resetExtNo ()
 Reset Extension counter and raise primary flag. More...
 
void incExtNo ()
 Increment Extension counter and lower primary flag. More...
 
void unsetPrimary ()
 Lower primary flag. More...
 
Adding new Cards
void addCommentCard (const std::string &keyword, const std::string &comment)
 Add a commentary card. More...
 
void addHistory (const std::string &history)
 Add a history of arbitrary length. More...
 
void addComment (const std::string &comment)
 Add a history of arbitrary length. More...
 
void addValueCard (const std::string &keyword, const std::string &value, const std::string comment="", const bool fixed=true)
 Add a string value card. More...
 
void addValueCard (const std::string &keyword, const char *value, const std::string comment="", const bool fixed=true)
 Add a char value card. More...
 
void addValueCard (const std::string &keyword, const bool value, const std::string comment="", const bool fixed=true)
 Add a boolean value card. More...
 
void addValueCard (const std::string &keyword, const int value, const std::string comment="", const bool fixed=true)
 Add an integer value card. More...
 
void addValueCard (const std::string &keyword, const long value, const std::string comment="", const bool fixed=true)
 Add an integer value card. More...
 
void addValueCard (const std::string &keyword, const float value, const std::string comment="", const bool fixed=true)
 Add a floating point value card. More...
 
void addValueCard (const std::string &keyword, const double value, const std::string comment="", const bool fixed=true)
 Add a floating point value card. More...
 
Shortcuts

Get (and set) values of mandatories and array keys via shortcuts.

int getBitpix () const
 Return BITPIX setting. More...
 
int getBytpix () const
 Return bytes per pixel, i.e. abs( bitpix_ ) / 8. More...
 
int getNaxis () const
 Return NAXIS setting. More...
 
int getNaxis (const int i) const
 Return width of i NAXIS. More...
 
double getBscale () const
 Return BSCALE setting. More...
 
double getBzero () const
 Return BZERO setting. More...
 
void setBscale (const double value)
 Set the BSCALE key to value. More...
 
void setBzero (const double value)
 Set the BZERO key to value. More...
 
util::Region getFullRegion () const
 Return a util::Region according to the NAXIS geometry. More...
 
Read Cards

Search the lists for card matching keyword and return requested instance.

std::string getString (const std::string &keyword) const
 Return string value of FITS key keyword. More...
 
bool getBool (const std::string &keyword) const
 Return boolean value of FITS key keyword. More...
 
long getInt (const std::string &keyword) const
 Return integer value of FITS key keyword. More...
 
double getFloat (const std::string &keyword) const
 Return floating point value of FITS key keyword. More...
 
bool isFixed (const std::string &keyword) const
 Indicate if value of FITS key keyword is of fixed type. More...
 
std::string getComment (const std::string &keyword) const
 Return comment of FITS key keyword. More...
 
std::string getComment () const
 Return complete COMMENT. More...
 
std::string getHistory () const
 Return complete HISTORY. More...
 
std::string getValueAsString (const std::string &keyword) const
 Return value of FITS key keyword as a string irrespective of its type. More...
 
size_t getRegionLength () const
 Get number of pixels in selected region. More...
 
size_t getRegionLength (const size_t dim) const
 Get length along dimension dim of selected region in pixels. More...
 
int getRegionStart (const size_t dim) const
 Get start pixel coordinate in dimension dim of selected region. More...
 
int getRegionEnd (const size_t dim) const
 Get end pixel coordinate in dimension dim of selected region. More...
 
util::Region getRegion () const
 Return copy of selected region. More...
 

Protected Member Functions

intregion2Naxis (const util::Region &region, int &newnaxis) const
 Convert Region to Naxis array discarding dims with length == 1. More...
 
int setGeometry (const int newbitpix, const int newnaxis, const int *newnaxis_i, const bool append=false)
 Create "empty" FITS file, i.e. header + zero data segment. Returns file descriptor. More...
 
void checkinmemalloc (const off_t write_offset, const int bytestobewritten)
 
void eraseObsolete ()
 Erase BSCALE, BZERO, BLOCKED, EPOCH and ORIGIN. More...
 
void resetMandatories (const int newbitpix, const int newnaxis, const int *newnaxis_i) throw (FitsException)
 Set mandatory FITS keywords according to arguments. More...
 
void resetArrayKeys ()
 Erase potentially missleading FITS array keywords. More...
 
void addCommentCard (FitsCard *cardptr) throw (FitsException)
 Add a commentary card to the correct list. More...
 
void addValueCard (FitsCard *cardptr) throw (FitsException)
 Add a value holding card to its proper list. More...
 
void readHeader (const std::string &filename, const bool alljunk=false, unsigned char *inmemptr=NULL, size_t inmemlen=0) throw (FitsException)
 Read and parse a FITS header from file. More...
 
void parseCommentToCardList (const std::string &keyword, const std::string &comment)
 Parse and add a commentstring to its list. More...
 
void addJunkCard (const std::string &native_card)
 Just split 80 char card into keyword + rest and push it on the junk list. More...
 
void addJunkCard (const std::string &keyword, const std::string &comment)
 Add a suitable trimmed junk card. More...
 
void addJunkCard (FitsCard *cardptr)
 Add a preexisting ltl::FitsCard to junk list. More...
 
void clearCardList (std::list< FitsCard * > &the_list)
 Clear a whole list of cards. More...
 
int eraseCardFromList (const std::string &keyword, std::list< FitsCard * > &the_list)
 Erase first ltl::FitsCard mathcing keyword from the_list. More...
 
int eraseCardsFromJunkList (const std::string &keyword)
 Erase all cards matching keyword from the ltl::FitsHeader::junk_ list. More...
 
FitsCard * findCardInList (const std::string &keyword, const std::list< FitsCard * > &the_list) const
 Return pointer to card matching keyword in the_list. More...
 
FitsCard * getValueCard (const std::string &keyword) const throw (FitsException)
 Return pointer to first card matching keyword on any non commentary list. More...
 
std::string writeCommentsOfList (const std::list< FitsCard * > &the_list) const
 Return string holding new line broken comments of a whole list. More...
 
std::string writeCardsOfList (const std::list< FitsCard * > &the_list) const
 Return string holding FITS formatted cards of a list. More...
 
void copy (const FitsHeader &other)
 Copy header from other. More...
 
void copyCardList (std::list< FitsCard * > &dest_list, const std::list< FitsCard * > &src_list)
 Copy list of ltl::FitsCard. More...
 
void testRegion (const util::Region &testreg) const throw (FitsException)
 Test if region complies with FITS file geometry. More...
 
void checkRegion (const size_t dim) const throw (FitsException)
 Test if dimension dim of region is "retrievable". More...
 
Parse Record string

The next 4 methods parse a complete 2880 char record into lists of ltl::FitsCards.

std::string::size_type parseRecord (const std::string &record, const bool alljunk=false) throw (FitsException)
 Parse a FITS record and assign the cards to their proper lists. More...
 
std::string::size_type parseMandatory (const std::string &record) throw (FitsException)
 Parse the mandatory keys of record. More...
 
std::string::size_type parseNaxis (const std::string &record, std::string::size_type card_of_record=0)
 Parse cards until Naxis parameter is matched, returns card offset in record. More...
 
void checkNaxis () throw (FitsException)
 Check the Naxis list, ltl::FitsException on error. More...
 
Parse Card String

These 2 functions parse a 80 char line card into an ltl::FitsCard.

FitsCard * parseCard (const std::string &card) const throw (FitsException)
 Parse 80 char line into an ltl::FitsCard object. More...
 
std::string getCardComment (const std::string &teststring) const throw (FitsException)
 Return the comment of a 80 char line card remainder. More...
 

Protected Attributes

bool ignorejunk_
 Boolean indicating if "junk" FITS cards are also written to header. More...
 
int bitpixout_
 BITPIX setting for FITS file. More...
 
string origin_
 Shortcut to ORIGIN key. More...
 
bool shutup_
 Boolean indicating if no error messages shall be written to stderr. More...
 
int bitpix_
 Shortcuts to FITS keywords BITPIX, abs(BITPIX)/8 and NAXIS. More...
 
int bytpix_
 
int naxis_
 
intnaxis_array_
 Pointer to array holding shortcuts to NAXIS keywords. More...
 
bool extended_
 Shortcut indicating extension maybe present. More...
 
int pcount_
 Shortcuts for calculating length of extension. More...
 
int gcount_
 
double bscale_
 Shortcuts to FITS keywords BSCALE and BZERO. More...
 
double bzero_
 
off_t data_offset_
 Offset to first element of data segment,. More...
 
off_t data_length_
 Length of data segment in bytes. More...
 
string filename_
 Filename associated with FitsIn/Out object. More...
 
unsigned char * fitsinmemptr_
 Pointer to in-memory fits file image. More...
 
size_t fitsinmemlength_
 Length of in-memory fits file. More...
 
unsigned char ** ptrfitsinmemptr_
 In-memory fits file image allocation data. More...
 
size_t * ptrfitsinmemlength_
 
unsigned char * fitsdataptr_
 Pointer to data segment map. More...
 
unsigned char * fitsstreamptr_
 Pointer to actual byte in data segment for per pixel I/O. More...
 
size_t fitsmaplength_
 Length of data segment map, multiple of page size. More...
 
util::Regionregionptr_
 Pointer to Region (if set). More...
 
off_t fitsregionoffset_
 Offset to determine first pixel of selected region. More...
 
bool primary_
 
size_t extno_
 

Static Protected Attributes

static const FitsPhysical PH_C
 Structure holding physical FITS sizes. More...
 
static const FitsKnownList KNOWN
 List of all known keywords and their types. More...
 

Related Functions

(Note that these are not member functions.)

template<class T , int N>
FitsExtensionOutoperator<< (FitsExtensionOut &fitsfile, const MArray< T, N > &a)
 
template<class T >
FitsOutoperator<< (FitsOut &fitsfile, const T &a)
 
template<class T , int N>
FitsOutoperator<< (FitsOut &fitsfile, const MArray< T, N > &a)
 
FitsOutoperator<< (FitsOut &outfile, FitsIn &infile)
 
FitsOutoperator<< (FitsOut &outfile, FitsExtensionIn &infile)
 
FitsExtensionOutoperator<< (FitsExtensionOut &outfile, const emptyData_ &)
 
FitsExtensionOutoperator<< (FitsExtensionOut &outfile, FitsIn &infile)
 
template<>
FitsInoperator>> (FitsIn &infile, FitsOut &outfile)
 

Card Lists

Lists representing the FITS header structure.

MandatoryList mandatory_
 List holding all mandatory cards. More...
 
NaxisList naxis_i_
 List holding all NAXIS# cards. More...
 
ExtensionList extension_
 List holding EXTENSION cards. More...
 
ObserveList observe_
 List holding reserved keywords cards which are not on other lists. More...
 
CommentList comment_
 List holding the COMMENT cards. More...
 
HistoryList history_
 List holding the HISTORY cards. More...
 
BlankList blank_
 List holding the blank cards. More...
 
ArrayList array_
 List holding array keywords cards. More...
 
OtherList otherkeys_
 List holding all other cards. More...
 
JunkList junk_
 List holding the cards not complying with FITS standard. More...
 
typedef std::list< FitsCard * > MandatoryList
 
typedef MandatoryList::iterator MandatoryIter
 
typedef std::list< FitsCard * > NaxisList
 
typedef NaxisList::iterator NaxisIter
 
typedef std::list< FitsCard * > ExtensionList
 
typedef ExtensionList::iterator ExtensionIter
 
typedef std::list< FitsCard * > ObserveList
 
typedef ObserveList::iterator ObserveIter
 
typedef std::list< FitsCard * > CommentList
 
typedef CommentList::iterator CommentIter
 
typedef std::list< FitsCard * > HistoryList
 
typedef HistoryList::iterator HistoryIter
 
typedef std::list< FitsCard * > BlankList
 
typedef BlankList::iterator BlankIter
 
typedef std::list< FitsCard * > ArrayList
 
typedef ArrayList::iterator ArrayIter
 
typedef std::list< FitsCard * > OtherList
 
typedef OtherList::iterator OtherIter
 
typedef std::list< FitsCard * > JunkList
 
typedef JunkList::iterator JunkIter
 

Detailed Description

Create a FITS extension object. Look into test/testfitsextensionio.cpp for examples.

Member Typedef Documentation

typedef std::list<FitsCard *> ltl::FitsHeader::MandatoryList
protectedinherited
typedef MandatoryList::iterator ltl::FitsHeader::MandatoryIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::NaxisList
protectedinherited
typedef NaxisList::iterator ltl::FitsHeader::NaxisIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::ExtensionList
protectedinherited
typedef ExtensionList::iterator ltl::FitsHeader::ExtensionIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::ObserveList
protectedinherited
typedef ObserveList::iterator ltl::FitsHeader::ObserveIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::CommentList
protectedinherited
typedef CommentList::iterator ltl::FitsHeader::CommentIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::HistoryList
protectedinherited
typedef HistoryList::iterator ltl::FitsHeader::HistoryIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::BlankList
protectedinherited
typedef BlankList::iterator ltl::FitsHeader::BlankIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::ArrayList
protectedinherited
typedef ArrayList::iterator ltl::FitsHeader::ArrayIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::OtherList
protectedinherited
typedef OtherList::iterator ltl::FitsHeader::OtherIter
protectedinherited
typedef std::list<FitsCard *> ltl::FitsHeader::JunkList
protectedinherited
typedef JunkList::iterator ltl::FitsHeader::JunkIter
protectedinherited

Constructor & Destructor Documentation

ltl::FitsExtensionOut::FitsExtensionOut ( const string &  path)
ltl::FitsExtensionOut::FitsExtensionOut ( const char *  path)
ltl::FitsExtensionOut::FitsExtensionOut ( const string &  path,
const FitsHeader header,
const bool  quiet_please = false,
const bool  ign_junk = false 
)
ltl::FitsExtensionOut::FitsExtensionOut ( const char *  path,
const FitsHeader header,
const bool  quiet_please = false,
const bool  ign_junk = false 
)
virtual ltl::FitsExtensionOut::~FitsExtensionOut ( )
virtual

Member Function Documentation

void ltl::FitsExtensionOut::flushHeader ( )

dump header to file, i.e. either primary or of next extension

int* ltl::FitsOut::region2Naxis ( const util::Region region,
int newnaxis 
) const
protectedinherited

Convert Region to Naxis array discarding dims with length == 1.

int ltl::FitsOut::setGeometry ( const int  newbitpix,
const int  newnaxis,
const int newnaxis_i,
const bool  append = false 
)
protectedinherited

Create "empty" FITS file, i.e. header + zero data segment. Returns file descriptor.

void ltl::FitsOut::setGeometry ( const int  newbitpix,
const util::Region region,
const bool  append = false 
)
inherited

Create "empty" FITS file, i.e. header + zero data segment.

void ltl::FitsOut::checkinmemalloc ( const off_t  write_offset,
const int  bytestobewritten 
)
protectedinherited
virtual void ltl::FitsOut::describeSelf ( std::ostream &  os)
virtualinherited

Write FITS file geometry and class interna to out stream.

Reimplemented from ltl::FitsHeader.

void ltl::FitsOut::openData ( const int  newbitpix,
const int  newnaxis,
const int newnaxis_i,
const bool  append = false 
)
throw (FitsException
)
inherited

Write FITS file header and create suitable data segment map.

Referenced by ltl::FitsIO::operator<<().

void ltl::FitsOut::openData ( const int  newbitpix,
const util::Region region,
const bool  append = false 
)
throw (FitsException
)
inherited

Write FITS file header and create region sized data segment map.

void ltl::FitsOut::setRegion ( const util::Region region)
throw (FitsException
)
inherited

Set Region for selective access to parts of data segment .

void ltl::FitsOut::resetRegion ( )
inlineinherited

Reset Region, if set.

References ltl::FitsOut::closeData().

bool ltl::FitsOut::isRegion ( ) const
inlineinherited

Return true if region is set.

References ltl::FitsIO::regionptr_.

void ltl::FitsOut::closeData ( )
inherited

Finish FITS file, unmap data segment.

Referenced by ltl::FitsOut::resetRegion().

void ltl::FitsOut::copyData ( FitsIn infile,
const bool  append = false 
)
inherited

Copy data (and BSCALE and BZERO) from infile.

Referenced by ltl::FitsIO::operator<<(), and ltl::FitsIO::operator>>().

unsigned char* ltl::FitsOut::begin ( ) const
inherited
unsigned char* ltl::FitsOut::end ( ) const
inherited
void ltl::FitsOut::resetPosition ( )
inherited
void ltl::FitsOut::setPosition ( off_t  offset)
inherited
ptrdiff_t ltl::FitsOut::getPosition ( ) const
inherited
void ltl::FitsOut::setFilename ( const string &  path)
inherited

Set output filename according to argument.

void ltl::FitsOut::setBitpixOut ( const int  bpo)
throw (FitsException
)
inherited

Override automatic BITPIX setting with argument.

void ltl::FitsOut::setOrigin ( const string &  orig)
inherited

Set FITS key ORIGIN according to argument.

int ltl::FitsOut::getBitpixOut ( ) const
inherited

Public method to read ltl::FitsOut::bitpixout_.

string ltl::FitsOut::getOrigin ( ) const
inherited

Public method to read ltl::FitsOut::origin_.

template<class T >
void ltl::FitsOut::writeDataArray ( T &  i)
inherited

Fill data segment with container via iterator i.

References ltl::FitsOut::begin(), ltl::FitsHeader::bitpix_, and ltl::FitsHeader::getDataLength().

template<class T >
void ltl::FitsOut::writeRegionArray ( T &  i)
inherited

Fill region of data segment with container via iterator i.

References ltl::FitsOut::begin(), ltl::FitsHeader::bitpix_, ltl::FitsHeader::getFullRegion(), and ltl::FitsIO::regionptr_.

template<class T >
void ltl::FitsOut::setNextPixel ( const T  value)
inherited
void ltl::FitsOut::eraseObsolete ( )
protectedinherited

Erase BSCALE, BZERO, BLOCKED, EPOCH and ORIGIN.

void ltl::FitsOut::resetMandatories ( const int  newbitpix,
const int  newnaxis,
const int newnaxis_i 
)
throw (FitsException
)
protectedinherited

Set mandatory FITS keywords according to arguments.

void ltl::FitsOut::resetArrayKeys ( )
protectedinherited

Erase potentially missleading FITS array keywords.

std::string ltl::FitsHeader::adjustKeyword ( std::string  keyword) const
inherited

Return keyword trimmed (or expanded) to a width of 8 chars.

Trailing blanks are significant for FITS keywords. If you want to add missing trailing blanks or simply trim too long keywords you may want to use this method.

void ltl::FitsHeader::addCommentCard ( const std::string &  keyword,
const std::string &  comment 
)
inherited

Add a commentary card.

void ltl::FitsHeader::addCommentCard ( FitsCard *  cardptr)
throw (FitsException
)
protectedinherited

Add a commentary card to the correct list.

void ltl::FitsHeader::addHistory ( const std::string &  history)
inherited

Add a history of arbitrary length.

void ltl::FitsHeader::addComment ( const std::string &  comment)
inherited

Add a history of arbitrary length.

void ltl::FitsHeader::addValueCard ( const std::string &  keyword,
const std::string &  value,
const std::string  comment = "",
const bool  fixed = true 
)
inherited

Add a string value card.

void ltl::FitsHeader::addValueCard ( const std::string &  keyword,
const char *  value,
const std::string  comment = "",
const bool  fixed = true 
)
inherited

Add a char value card.

void ltl::FitsHeader::addValueCard ( const std::string &  keyword,
const bool  value,
const std::string  comment = "",
const bool  fixed = true 
)
inherited

Add a boolean value card.

void ltl::FitsHeader::addValueCard ( const std::string &  keyword,
const int  value,
const std::string  comment = "",
const bool  fixed = true 
)
inherited

Add an integer value card.

void ltl::FitsHeader::addValueCard ( const std::string &  keyword,
const long  value,
const std::string  comment = "",
const bool  fixed = true 
)
inherited

Add an integer value card.

void ltl::FitsHeader::addValueCard ( const std::string &  keyword,
const float  value,
const std::string  comment = "",
const bool  fixed = true 
)
inherited

Add a floating point value card.

void ltl::FitsHeader::addValueCard ( const std::string &  keyword,
const double  value,
const std::string  comment = "",
const bool  fixed = true 
)
inherited

Add a floating point value card.

void ltl::FitsHeader::addValueCard ( FitsCard *  cardptr)
throw (FitsException
)
protectedinherited

Add a value holding card to its proper list.

If the card has a bad syntax it's put on the ltl::FitsHeader::junk_ list.

Exceptions
ltl::FitsExceptionon error.
int ltl::FitsHeader::eraseCard ( const std::string &  keyword)
throw (FitsException
)
inherited

Erase FITS card keyword.

Returns 0 on success, -1 on keyword not found.

Exceptions
ltl::FitsExceptionon forbidden erasures.
off_t ltl::FitsHeader::getDataOffset ( ) const
inherited

Return the byte offset within the file to the data segment.

int ltl::FitsHeader::getBitpix ( ) const
inherited

Return BITPIX setting.

int ltl::FitsHeader::getBytpix ( ) const
inherited

Return bytes per pixel, i.e. abs( bitpix_ ) / 8.

int ltl::FitsHeader::getNaxis ( ) const
inherited

Return NAXIS setting.

Referenced by ltl::getFitsMArray(), and ltl::insertFitsMArray().

int ltl::FitsHeader::getNaxis ( const int  i) const
inherited

Return width of i NAXIS.

double ltl::FitsHeader::getBscale ( ) const
inherited
double ltl::FitsHeader::getBzero ( ) const
inherited
void ltl::FitsHeader::setBscale ( const double  value)
inherited

Set the BSCALE key to value.

void ltl::FitsHeader::setBzero ( const double  value)
inherited

Set the BZERO key to value.

util::Region ltl::FitsHeader::getFullRegion ( ) const
inherited

Return a util::Region according to the NAXIS geometry.

Referenced by ltl::FitsIn::getDataArray(), ltl::FitsIn::readRegionArray(), and ltl::FitsOut::writeRegionArray().

off_t ltl::FitsHeader::getDataLength ( ) const
inherited

Return the size of the data segment in bytes.

Referenced by ltl::FitsIn::getDataArray(), ltl::FitsIn::readDataArray(), and ltl::FitsOut::writeDataArray().

std::string ltl::FitsHeader::getString ( const std::string &  keyword) const
inherited

Return string value of FITS key keyword.

bool ltl::FitsHeader::getBool ( const std::string &  keyword) const
inherited

Return boolean value of FITS key keyword.

long ltl::FitsHeader::getInt ( const std::string &  keyword) const
inherited

Return integer value of FITS key keyword.

double ltl::FitsHeader::getFloat ( const std::string &  keyword) const
inherited

Return floating point value of FITS key keyword.

bool ltl::FitsHeader::isFixed ( const std::string &  keyword) const
inherited

Indicate if value of FITS key keyword is of fixed type.

std::string ltl::FitsHeader::getComment ( const std::string &  keyword) const
inherited

Return comment of FITS key keyword.

std::string ltl::FitsHeader::getComment ( ) const
inherited

Return complete COMMENT.

std::string ltl::FitsHeader::getHistory ( ) const
inherited

Return complete HISTORY.

std::string ltl::FitsHeader::getValueAsString ( const std::string &  keyword) const
inherited

Return value of FITS key keyword as a string irrespective of its type.

std::string ltl::FitsHeader::writeHeader ( const bool  with_junk = false)
inherited

Return a new valid FITS file format header.

void ltl::FitsHeader::readHeader ( const std::string &  filename,
const bool  alljunk = false,
unsigned char *  inmemptr = NULL,
size_t  inmemlen = 0 
)
throw (FitsException
)
protectedinherited

Read and parse a FITS header from file.

std::string::size_type ltl::FitsHeader::parseRecord ( const std::string &  record,
const bool  alljunk = false 
)
throw (FitsException
)
protectedinherited

Parse a FITS record and assign the cards to their proper lists.

Returns the length of the record or 0 if "END" was found.

Exceptions
ltl::FitsExceptionon error.
std::string::size_type ltl::FitsHeader::parseMandatory ( const std::string &  record)
throw (FitsException
)
protectedinherited

Parse the mandatory keys of record.

Return offset to next non-mandatory card within record.

Exceptions
ltl::FitsExceptionon error.
std::string::size_type ltl::FitsHeader::parseNaxis ( const std::string &  record,
std::string::size_type  card_of_record = 0 
)
protectedinherited

Parse cards until Naxis parameter is matched, returns card offset in record.

void ltl::FitsHeader::checkNaxis ( )
throw (FitsException
)
protectedinherited

Check the Naxis list, ltl::FitsException on error.

FitsCard* ltl::FitsHeader::parseCard ( const std::string &  card) const
throw (FitsException
)
protectedinherited

Parse 80 char line into an ltl::FitsCard object.

std::string ltl::FitsHeader::getCardComment ( const std::string &  teststring) const
throw (FitsException
)
protectedinherited

Return the comment of a 80 char line card remainder.

void ltl::FitsHeader::parseCommentToCardList ( const std::string &  keyword,
const std::string &  comment 
)
protectedinherited

Parse and add a commentstring to its list.

Can be long, will be broken into lines)

void ltl::FitsHeader::addJunkCard ( const std::string &  native_card)
protectedinherited

Just split 80 char card into keyword + rest and push it on the junk list.

void ltl::FitsHeader::addJunkCard ( const std::string &  keyword,
const std::string &  comment 
)
protectedinherited

Add a suitable trimmed junk card.

void ltl::FitsHeader::addJunkCard ( FitsCard *  cardptr)
protectedinherited

Add a preexisting ltl::FitsCard to junk list.

void ltl::FitsHeader::clearCardList ( std::list< FitsCard * > &  the_list)
protectedinherited

Clear a whole list of cards.

int ltl::FitsHeader::eraseCardFromList ( const std::string &  keyword,
std::list< FitsCard * > &  the_list 
)
protectedinherited

Erase first ltl::FitsCard mathcing keyword from the_list.

Return -1 if keyword not found, otherwise 0.

int ltl::FitsHeader::eraseCardsFromJunkList ( const std::string &  keyword)
protectedinherited

Erase all cards matching keyword from the ltl::FitsHeader::junk_ list.

Return the number of erased cards.

FitsCard * ltl::FitsHeader::findCardInList ( const std::string &  keyword,
const std::list< FitsCard * > &  the_list 
) const
protectedinherited

Return pointer to card matching keyword in the_list.

Return NULL if no card is found.

Referenced by ltl::FitsBinTableIn::readColumn().

FitsCard * ltl::FitsHeader::getValueCard ( const std::string &  keyword) const
throw (FitsException
)
protectedinherited

Return pointer to first card matching keyword on any non commentary list.

Exceptions
ltl::FitsExceptionon error, i.e. no matching card found.
std::string ltl::FitsHeader::writeCommentsOfList ( const std::list< FitsCard * > &  the_list) const
protectedinherited

Return string holding new line broken comments of a whole list.

std::string ltl::FitsHeader::writeCardsOfList ( const std::list< FitsCard * > &  the_list) const
protectedinherited

Return string holding FITS formatted cards of a list.

void ltl::FitsHeader::copy ( const FitsHeader other)
protectedinherited

Copy header from other.

void ltl::FitsHeader::copyCardList ( std::list< FitsCard * > &  dest_list,
const std::list< FitsCard * > &  src_list 
)
protectedinherited

Copy list of ltl::FitsCard.

void ltl::FitsHeader::testRegion ( const util::Region testreg) const
throw (FitsException
)
protectedinherited

Test if region complies with FITS file geometry.

void ltl::FitsIO::checkRegion ( const size_t  dim) const
throw (FitsException
)
protectedinherited

Test if dimension dim of region is "retrievable".

string ltl::FitsIO::getFilename ( ) const
inlineinherited
unsigned char* ltl::FitsIO::streampos ( ) const
inlineinherited
size_t ltl::FitsIO::getRegionLength ( ) const
inherited

Get number of pixels in selected region.

Referenced by ltl::getFitsMArray(), and ltl::insertFitsMArray().

size_t ltl::FitsIO::getRegionLength ( const size_t  dim) const
inherited

Get length along dimension dim of selected region in pixels.

int ltl::FitsIO::getRegionStart ( const size_t  dim) const
inherited

Get start pixel coordinate in dimension dim of selected region.

int ltl::FitsIO::getRegionEnd ( const size_t  dim) const
inherited

Get end pixel coordinate in dimension dim of selected region.

Referenced by ltl::insertFitsMArray().

util::Region ltl::FitsIO::getRegion ( ) const
inherited

Return copy of selected region.

Referenced by ltl::insertFitsMArray().

size_t ltl::FitsExtension::getExtNo ( ) const
inherited

Return number of actual extension.

bool ltl::FitsExtension::getPrimary ( ) const
inherited

Return status of primary flag, i.e. reading or writing primary header / data.

Referenced by ltl::FitsIO::operator<<().

void ltl::FitsExtension::resetExtNo ( )
inherited

Reset Extension counter and raise primary flag.

Referenced by ltl::FitsIO::operator<<().

void ltl::FitsExtension::incExtNo ( )
inherited

Increment Extension counter and lower primary flag.

Referenced by ltl::FitsIO::operator<<().

void ltl::FitsExtension::unsetPrimary ( )
inherited

Lower primary flag.

Referenced by ltl::FitsIO::operator<<().

Member Data Documentation

bool ltl::FitsOut::ignorejunk_
protectedinherited

Boolean indicating if "junk" FITS cards are also written to header.

int ltl::FitsOut::bitpixout_
protectedinherited

BITPIX setting for FITS file.

string ltl::FitsOut::origin_
protectedinherited

Shortcut to ORIGIN key.

bool ltl::FitsHeader::shutup_
protectedinherited

Boolean indicating if no error messages shall be written to stderr.

int ltl::FitsHeader::bitpix_
protectedinherited
int ltl::FitsHeader::bytpix_
protectedinherited
int ltl::FitsHeader::naxis_
protectedinherited
int* ltl::FitsHeader::naxis_array_
protectedinherited

Pointer to array holding shortcuts to NAXIS keywords.

Referenced by ltl::FitsBinTableIn::readColumn(), and ltl::FitsBinTableIn::readPColumn().

bool ltl::FitsHeader::extended_
protectedinherited

Shortcut indicating extension maybe present.

int ltl::FitsHeader::pcount_
protectedinherited

Shortcuts for calculating length of extension.

int ltl::FitsHeader::gcount_
protectedinherited
double ltl::FitsHeader::bscale_
protectedinherited

Shortcuts to FITS keywords BSCALE and BZERO.

Referenced by ltl::FitsIn::getNextPixel().

double ltl::FitsHeader::bzero_
protectedinherited
off_t ltl::FitsHeader::data_offset_
protectedinherited

Offset to first element of data segment,.

off_t ltl::FitsHeader::data_length_
protectedinherited

Length of data segment in bytes.

const FitsPhysical ltl::FitsHeader::PH_C
staticprotectedinherited

Structure holding physical FITS sizes.

const FitsKnownList ltl::FitsHeader::KNOWN
staticprotectedinherited

List of all known keywords and their types.

MandatoryList ltl::FitsHeader::mandatory_
protectedinherited

List holding all mandatory cards.

NaxisList ltl::FitsHeader::naxis_i_
protectedinherited

List holding all NAXIS# cards.

ExtensionList ltl::FitsHeader::extension_
protectedinherited

List holding EXTENSION cards.

Referenced by ltl::FitsBinTableIn::readColumn().

ltl::FitsHeader::ObserveList ltl::FitsHeader::observe_
protectedinherited

List holding reserved keywords cards which are not on other lists.

These are AUTHOR, BLOCKED, DATE, DATE-OBS, DATExxxx, EQUINOX, EPOCH, INSTRUME, OBJECT, OBSERVER, ORIGIN, REFERENC and TELESCOP. EPOCH will be copied to EQUINOX if EQUINOX not present.

CommentList ltl::FitsHeader::comment_
protectedinherited

List holding the COMMENT cards.

HistoryList ltl::FitsHeader::history_
protectedinherited

List holding the HISTORY cards.

BlankList ltl::FitsHeader::blank_
protectedinherited

List holding the blank cards.

ltl::FitsHeader::ArrayList ltl::FitsHeader::array_
protectedinherited

List holding array keywords cards.

These are BSCALE, BZERO, BUNIT, BLANK, CTYPEn, CRPIXn, CRVALn, CRDELTn, CROTAn, DATAMIN and DATAMAX.

OtherList ltl::FitsHeader::otherkeys_
protectedinherited

List holding all other cards.

JunkList ltl::FitsHeader::junk_
protectedinherited

List holding the cards not complying with FITS standard.

string ltl::FitsIO::filename_
protectedinherited

Filename associated with FitsIn/Out object.

Referenced by ltl::FitsIO::getFilename().

unsigned char* ltl::FitsIO::fitsinmemptr_
protectedinherited

Pointer to in-memory fits file image.

size_t ltl::FitsIO::fitsinmemlength_
protectedinherited

Length of in-memory fits file.

unsigned char** ltl::FitsIO::ptrfitsinmemptr_
protectedinherited

In-memory fits file image allocation data.

size_t* ltl::FitsIO::ptrfitsinmemlength_
protectedinherited
unsigned char* ltl::FitsIO::fitsdataptr_
protectedinherited

Pointer to data segment map.

unsigned char* ltl::FitsIO::fitsstreamptr_
protectedinherited

Pointer to actual byte in data segment for per pixel I/O.

Referenced by ltl::FitsIn::getNextPixel(), ltl::FitsOut::setNextPixel(), and ltl::FitsIO::streampos().

size_t ltl::FitsIO::fitsmaplength_
protectedinherited

Length of data segment map, multiple of page size.

util::Region* ltl::FitsIO::regionptr_
protectedinherited
off_t ltl::FitsIO::fitsregionoffset_
protectedinherited

Offset to determine first pixel of selected region.

bool ltl::FitsExtension::primary_
protectedinherited
size_t ltl::FitsExtension::extno_
protectedinherited