ltl::FitsHeader Class Reference
Representation of a complete FITS header. Holds also header I/O methods.
More...
Inherited by ltl::FitsIn, and ltl::FitsOut.
List of all members.
Public Member Functions
- FitsHeader (unsigned char *inmemptr, size_t inmemlen, const bool quiet_please=false, const bool alljunk=false)
- Construct from existing file.
- FitsHeader (const std::string &filename, const bool quiet_please=false, const bool alljunk=false)
- FitsHeader (const FitsHeader &other, const bool quiet_please=false, const bool alljunk=false)
- Construct as copy from other.
- virtual ~FitsHeader ()
- Destruct Object.
- FitsHeader & operator= (const FitsHeader &other)
- Copy values from other.
- virtual void describeSelf (std::ostream &os)
- Write Mandatories to os.
- std::string adjustKeyword (std::string keyword) const
- Return keyword trimmed (or expanded) to a width of 8 chars.
- int eraseCard (const std::string &keyword) throw (FitsException)
- Erase FITS card keyword.
- off_t getDataOffset () const
- Return the byte offset within the file to the data segment.
- off_t getDataLength () const
- Return the size of the data segment in bytes.
- std::string writeHeader (const bool with_junk=false)
- Return a new valid FITS file format header.
|
|
- void addCommentCard (const std::string &keyword, const std::string &comment)
- Add a commentary card.
- void addHistory (const std::string &history)
- Add a history of arbitrary length.
- void addComment (const std::string &comment)
- Add a history of arbitrary length.
- void addValueCard (const std::string &keyword, const std::string &value, const std::string comment="", const bool fixed=true)
- Add a string value card.
- void addValueCard (const std::string &keyword, const char *value, const std::string comment="", const bool fixed=true)
- Add a char value card.
- void addValueCard (const std::string &keyword, const bool value, const std::string comment="", const bool fixed=true)
- Add a boolean value card.
- void addValueCard (const std::string &keyword, const int value, const std::string comment="", const bool fixed=true)
- Add an integer value card.
- void addValueCard (const std::string &keyword, const long value, const std::string comment="", const bool fixed=true)
- Add an integer value card.
- void addValueCard (const std::string &keyword, const float value, const std::string comment="", const bool fixed=true)
- Add a floating point value card.
- void addValueCard (const std::string &keyword, const double value, const std::string comment="", const bool fixed=true)
- Add a floating point value card.
|
Get (and set) values of mandatories and array keys via shortcuts.
|
|
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.
- bool getBool (const std::string &keyword) const
- Return boolean value of FITS key keyword.
- long getInt (const std::string &keyword) const
- Return integer value of FITS key keyword.
- double getFloat (const std::string &keyword) const
- Return floating point value of FITS key keyword.
- bool isFixed (const std::string &keyword) const
- Indicate if value of FITS key keyword is of fixed type.
- std::string getComment (const std::string &keyword) const
- Return comment of FITS key keyword.
- std::string getComment () const
- Return complete COMMENT.
- std::string getHistory () const
- Return complete HISTORY.
- std::string getValueAsString (const std::string &keyword) const
- Return value of FITS key keyword as a string irrespective of its type.
Protected Member Functions
- FitsHeader ()
- Empty constructor is protected!
- FitsHeader (const std::string &filename, const bool quiet_please, const bool alljunk, const off_t startoffset)
- Construct extension from existing file.
- 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.
- void parseCommentToCardList (const std::string &keyword, const std::string &comment)
- Parse and add a commentstring to its list.
- void addCommentCard (FitsCard *cardptr) throw (FitsException)
- Add a commentary card to the correct list.
- void addJunkCard (const std::string &native_card)
- Just split 80 char card into keyword + rest and push it on the junk list.
- void addJunkCard (const std::string &keyword, const std::string &comment)
- Add a suitable trimmed junk card.
- void addJunkCard (FitsCard *cardptr)
- Add a preexisting ltl::FitsCard to junk list.
- void addValueCard (FitsCard *cardptr) throw (FitsException)
- Add a value holding card to its proper list.
- void clearCardList (std::list< FitsCard * > &the_list)
- Clear a whole list of cards.
- int eraseCardFromList (const std::string &keyword, std::list< FitsCard * > &the_list)
- Erase first ltl::FitsCard mathcing keyword from the_list.
- int eraseCardsFromJunkList (const std::string &keyword)
- Erase all cards matching keyword from the ltl::FitsHeader::junk_ list.
- FitsCard * findCardInList (const std::string &keyword, const std::list< FitsCard * > &the_list) const
- Return pointer to card matching keyword in the_list.
- FitsCard * getValueCard (const std::string &keyword) const throw (FitsException)
- Return pointer to first card matching keyword on any non commentary list.
- std::string writeCommentsOfList (const std::list< FitsCard * > &the_list) const
- Return string holding new line broken comments of a whole list.
- std::string writeCardsOfList (const std::list< FitsCard * > &the_list) const
- Return string holding FITS formatted cards of a list.
- void copy (const FitsHeader &other)
- Copy header from other.
- void copyCardList (std::list< FitsCard * > &dest_list, const std::list< FitsCard * > &src_list)
- Copy list of ltl::FitsCard.
- void testRegion (const util::Region &testreg) const throw (FitsException)
- Test if region complies with FITS file geometry.
|
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.
- std::string::size_type parseMandatory (const std::string &record) throw (FitsException)
- Parse the mandatory keys of record.
- 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.
- void checkNaxis () throw (FitsException)
- Check the Naxis list, ltl::FitsException on error.
|
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.
- std::string getCardComment (const std::string &teststring) const throw (FitsException)
- Return the comment of a 80 char line card remainder.
Protected Attributes
Static Protected Attributes
- static const FitsPhysical PH_C
- Structure holding physical FITS sizes.
- static const FitsKnownList KNOWN
- List of all known keywords and their types.
Card Lists
Lists representing the FITS header structure.
Detailed Description
Representation of a complete FITS header. Holds also header I/O methods.
Member Typedef Documentation
Constructor & Destructor Documentation
ltl::FitsHeader::FitsHeader |
( |
unsigned char * |
inmemptr, |
|
|
size_t |
inmemlen, |
|
|
const bool |
quiet_please = false , |
|
|
const bool |
alljunk = false | |
|
) |
| | |
Construct from existing file.
ltl::FitsHeader::FitsHeader |
( |
const std::string & |
filename, |
|
|
const bool |
quiet_please = false , |
|
|
const bool |
alljunk = false | |
|
) |
| | |
ltl::FitsHeader::FitsHeader |
( |
const FitsHeader & |
other, |
|
|
const bool |
quiet_please = false , |
|
|
const bool |
alljunk = false | |
|
) |
| | |
Construct as copy from other.
virtual ltl::FitsHeader::~FitsHeader |
( |
|
) |
[virtual] |
ltl::FitsHeader::FitsHeader |
( |
|
) |
[protected] |
Empty constructor is protected!
ltl::FitsHeader::FitsHeader |
( |
const std::string & |
filename, |
|
|
const bool |
quiet_please, |
|
|
const bool |
alljunk, |
|
|
const off_t |
startoffset | |
|
) |
| | [protected] |
Construct extension from existing file.
Member Function Documentation
virtual void ltl::FitsHeader::describeSelf |
( |
std::ostream & |
os |
) |
[virtual] |
std::string ltl::FitsHeader::adjustKeyword |
( |
std::string |
keyword |
) |
const |
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 | |
|
) |
| | |
void ltl::FitsHeader::addHistory |
( |
const std::string & |
history |
) |
|
Add a history of arbitrary length.
void ltl::FitsHeader::addComment |
( |
const std::string & |
comment |
) |
|
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 | |
|
) |
| | |
void ltl::FitsHeader::addValueCard |
( |
const std::string & |
keyword, |
|
|
const char * |
value, |
|
|
const std::string |
comment = "" , |
|
|
const bool |
fixed = true | |
|
) |
| | |
void ltl::FitsHeader::addValueCard |
( |
const std::string & |
keyword, |
|
|
const bool |
value, |
|
|
const std::string |
comment = "" , |
|
|
const bool |
fixed = true | |
|
) |
| | |
Add a boolean value card.
void ltl::FitsHeader::addValueCard |
( |
const std::string & |
keyword, |
|
|
const int |
value, |
|
|
const std::string |
comment = "" , |
|
|
const bool |
fixed = true | |
|
) |
| | |
Add an integer value card.
void ltl::FitsHeader::addValueCard |
( |
const std::string & |
keyword, |
|
|
const long |
value, |
|
|
const std::string |
comment = "" , |
|
|
const bool |
fixed = true | |
|
) |
| | |
Add an integer value card.
void ltl::FitsHeader::addValueCard |
( |
const std::string & |
keyword, |
|
|
const float |
value, |
|
|
const std::string |
comment = "" , |
|
|
const bool |
fixed = true | |
|
) |
| | |
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 | |
|
) |
| | |
Add a floating point value card.
int ltl::FitsHeader::eraseCard |
( |
const std::string & |
keyword |
) |
throw (FitsException) |
Erase FITS card keyword.
Returns 0 on success, -1 on keyword not found.
- Exceptions:
-
off_t ltl::FitsHeader::getDataOffset |
( |
|
) |
const |
Return the byte offset within the file to the data segment.
int ltl::FitsHeader::getBitpix |
( |
|
) |
const |
int ltl::FitsHeader::getBytpix |
( |
|
) |
const |
Return bytes per pixel, i.e. abs( bitpix_ ) / 8.
int ltl::FitsHeader::getNaxis |
( |
|
) |
const |
int ltl::FitsHeader::getNaxis |
( |
const int |
i |
) |
const |
double ltl::FitsHeader::getBscale |
( |
|
) |
const |
double ltl::FitsHeader::getBzero |
( |
|
) |
const |
void ltl::FitsHeader::setBscale |
( |
const double |
value |
) |
|
Set the BSCALE key to value.
void ltl::FitsHeader::setBzero |
( |
const double |
value |
) |
|
Set the BZERO key to value.
off_t ltl::FitsHeader::getDataLength |
( |
|
) |
const |
std::string ltl::FitsHeader::getString |
( |
const std::string & |
keyword |
) |
const |
Return string value of FITS key keyword.
bool ltl::FitsHeader::getBool |
( |
const std::string & |
keyword |
) |
const |
Return boolean value of FITS key keyword.
long ltl::FitsHeader::getInt |
( |
const std::string & |
keyword |
) |
const |
Return integer value of FITS key keyword.
double ltl::FitsHeader::getFloat |
( |
const std::string & |
keyword |
) |
const |
Return floating point value of FITS key keyword.
bool ltl::FitsHeader::isFixed |
( |
const std::string & |
keyword |
) |
const |
Indicate if value of FITS key keyword is of fixed type.
std::string ltl::FitsHeader::getComment |
( |
const std::string & |
keyword |
) |
const |
Return comment of FITS key keyword.
std::string ltl::FitsHeader::getComment |
( |
|
) |
const |
std::string ltl::FitsHeader::getHistory |
( |
|
) |
const |
std::string ltl::FitsHeader::getValueAsString |
( |
const std::string & |
keyword |
) |
const |
Return value of FITS key keyword as a string irrespective of its type.
std::string ltl::FitsHeader::writeHeader |
( |
const bool |
with_junk = false |
) |
|
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) [protected] |
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) [protected] |
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:
-
std::string::size_type ltl::FitsHeader::parseMandatory |
( |
const std::string & |
record |
) |
throw (FitsException) [protected] |
Parse the mandatory keys of record.
Return offset to next non-mandatory card within record.
- Exceptions:
-
std::string::size_type ltl::FitsHeader::parseNaxis |
( |
const std::string & |
record, |
|
|
std::string::size_type |
card_of_record = 0 | |
|
) |
| | [protected] |
Parse cards until Naxis parameter is matched, returns card offset in record.
void ltl::FitsHeader::checkNaxis |
( |
|
) |
throw (FitsException) [protected] |
FitsCard* ltl::FitsHeader::parseCard |
( |
const std::string & |
card |
) |
const throw (FitsException) [protected] |
Parse 80 char line into an ltl::FitsCard object.
std::string ltl::FitsHeader::getCardComment |
( |
const std::string & |
teststring |
) |
const throw (FitsException) [protected] |
Return the comment of a 80 char line card remainder.
void ltl::FitsHeader::parseCommentToCardList |
( |
const std::string & |
keyword, |
|
|
const std::string & |
comment | |
|
) |
| | [protected] |
Parse and add a commentstring to its list.
Can be long, will be broken into lines)
void ltl::FitsHeader::addCommentCard |
( |
FitsCard * |
cardptr |
) |
throw (FitsException) [protected] |
Add a commentary card to the correct list.
void ltl::FitsHeader::addJunkCard |
( |
const std::string & |
native_card |
) |
[protected] |
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 | |
|
) |
| | [protected] |
Add a suitable trimmed junk card.
void ltl::FitsHeader::addJunkCard |
( |
FitsCard * |
cardptr |
) |
[protected] |
Add a preexisting ltl::FitsCard to junk list.
void ltl::FitsHeader::addValueCard |
( |
FitsCard * |
cardptr |
) |
throw (FitsException) [protected] |
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:
-
void ltl::FitsHeader::clearCardList |
( |
std::list< FitsCard * > & |
the_list |
) |
[protected] |
Clear a whole list of cards.
int ltl::FitsHeader::eraseCardFromList |
( |
const std::string & |
keyword, |
|
|
std::list< FitsCard * > & |
the_list | |
|
) |
| | [protected] |
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 |
) |
[protected] |
FitsCard * ltl::FitsHeader::findCardInList |
( |
const std::string & |
keyword, |
|
|
const std::list< FitsCard * > & |
the_list | |
|
) |
| | const [protected] |
FitsCard * ltl::FitsHeader::getValueCard |
( |
const std::string & |
keyword |
) |
const throw (FitsException) [protected] |
Return pointer to first card matching keyword on any non commentary list.
- Exceptions:
-
std::string ltl::FitsHeader::writeCommentsOfList |
( |
const std::list< FitsCard * > & |
the_list |
) |
const [protected] |
Return string holding new line broken comments of a whole list.
std::string ltl::FitsHeader::writeCardsOfList |
( |
const std::list< FitsCard * > & |
the_list |
) |
const [protected] |
Return string holding FITS formatted cards of a list.
void ltl::FitsHeader::copy |
( |
const FitsHeader & |
other |
) |
[protected] |
void ltl::FitsHeader::copyCardList |
( |
std::list< FitsCard * > & |
dest_list, |
|
|
const std::list< FitsCard * > & |
src_list | |
|
) |
| | [protected] |
Copy list of ltl::FitsCard.
Test if region complies with FITS file geometry.
Member Data Documentation
Boolean indicating if no error messages shall be written to stderr.
Shortcut indicating extension maybe present.
Shortcuts for calculating length of extension.
Offset to first element of data segment,.
Length of data segment in bytes.
Structure holding physical FITS sizes.
List of all known keywords and their types.
List holding all mandatory cards.
List holding all NAXIS# cards.
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.
List holding the COMMENT cards.
List holding the HISTORY cards.
List holding the blank cards.
List holding array keywords cards.
These are BSCALE, BZERO, BUNIT, BLANK, CTYPEn, CRPIXn, CRVALn, CRDELTn, CROTAn, DATAMIN and DATAMAX.
List holding all other cards.
List holding the cards not complying with FITS standard.