21 #include "NewKeyword.h" 
   23 #include "FitsError.h" 
  715             NoNullValue (
const string& diag, 
bool silent = 
true);
 
  738       const string& 
comment () 
const;
 
  744       const string& 
history () 
const;
 
  751       friend std::ostream& operator << (std::ostream& s, 
const CCfits::HDU& right);
 
  754       void index (
int value);
 
  757       virtual double scale () 
const;
 
  758       virtual void scale (
double value);
 
  759       virtual double zero () 
const;
 
  760       virtual void zero (
double value);
 
  766       std::pair<unsigned long,unsigned long> 
getChecksum () 
const;
 
  768       void readAllKeys (
const std::vector<int> & keyCategories = std::vector<int>());
 
  769       void copyAllKeys (
const HDU* inHdu, 
const std::vector<int> & keyCategories = std::vector<int>());
 
  770       std::map<String, Keyword*>& 
keyWord ();
 
  773       const std::map<string,Keyword*>& 
keyWord () 
const;
 
  776                            const std::vector<String>& excList,
 
  777                            bool searchFromBeginning = 
false);
 
  783       template <
typename T>
 
  784       void readKey(
const String& keyName, T& val);
 
  786       template <
typename T>
 
  787       void readKeys(std::vector<String>& keyNames, std::vector<T>& vals);
 
  789       template <
typename T>
 
  797       Keyword& 
addKey(
const String& name, 
const char* charString, 
const String& 
comment, 
bool isLongStr = 
false);
 
  799 #ifdef TEMPLATE_AMBIG_DEFECT 
  800       inline void readKeyMS(
const String& keyName, 
int & val);
 
  801       inline void readKeys(std::vector<String>& keyNames, std::vector<String>& vals);
 
  814         Keyword& readKeyword (
const String &keyname);
 
  815         void readKeywords (std::list<String>& keynames);
 
  816         virtual std::ostream & put (std::ostream &s) 
const = 0;
 
  818         bool checkImgDataTypeChange (
double zero, 
double scale) 
const;
 
  820         void naxis (
const long& value);
 
  824         void anynul (
const bool& value);
 
  827         std::vector< long >& 
naxes ();
 
  839         virtual void initRead () = 0;
 
  842         virtual bool compare (
const HDU &right) 
const;
 
  845         void copyKeys (
const HDU& right);
 
  846         String getNamedLines (
const String& name);
 
  849         void saveReadKeyword (
Keyword* newKey);
 
  850         void zeroInit (
double value);
 
  851         void scaleInit (
double value);
 
  870         std::map<string,Keyword*> m_keyWord;
 
  872         std::vector< long > m_naxes;
 
  875         static const size_t s_nCategories;
 
  876         static const int s_iKeywordCategories[];
 
  878       friend class HDUCreator;        
 
  879       friend Keyword* KeywordCreator::getKeyword(
const String& keyname, 
HDU* p);
 
  880       friend Keyword* KeywordCreator::getKeyword(
const String& keyname, 
ValueType keyType, 
HDU* p);
 
  885   template <
typename T>
 
  889     NewKeyword<T> keyCreator(
this,value);
 
  890     Keyword& newKey = *(addKeyword(keyCreator.createKeyword(name,comment,isLongStr)));
 
  894   template <
typename T>
 
  898     Keyword& key = readKeyword(keyName);
 
  902   template <
typename T>
 
  905           size_t nRead = keyNames.size();
 
  907           std::list<String> valKeys;
 
  908           std::list<T>      valList;
 
  909           for (
size_t i = 0; i < nRead; i++) valKeys.push_back(keyNames[i]);
 
  912           readKeywords(valKeys);
 
  918           std::list<String>::iterator it = valKeys.begin(); 
 
  919           while (it != valKeys.end())
 
  923                           m_keyWord[*it]->value(current);
 
  924                           valList.push_back(current);       
 
  927                   catch ( Keyword::WrongKeywordValueType )
 
  929                           it = valKeys.erase(it);                         
 
  933           keyNames.erase(keyNames.begin(),keyNames.end());       
 
  935           if (!valList.empty())
 
  937                   if (valList.size() != vals.size()) vals.resize(valList.size());
 
  940                   for (
typename std::list<T>::const_iterator it1 
 
  941                                   = valList.begin(); it1 != valList.end(); ++it1,++i)
 
  945                   for (std::list<String>::const_iterator it1= valKeys.begin(); it1 != valKeys.end(); ++it1)
 
  947                           keyNames.push_back(*it1);
 
  985     return m_naxes[
index];
 
 1032   inline void HDU::saveReadKeyword (
Keyword* newKey)
 
 1034     m_keyWord.insert(std::map<String,Keyword*>::value_type(newKey->
name(),newKey->
clone()));
 
 1044     std::map<String,Keyword*>::iterator key = m_keyWord.find(keyName);
 
 1046     return *((*key).second);
 
 1049   inline long& HDU::naxis ()
 
 1054   inline void HDU::naxis (
const long& value)
 
 1059   inline bool& HDU::anynul ()
 
 1064   inline void HDU::anynul (
const bool& value)
 
 1076     std::map<String,Keyword*>::const_iterator key = m_keyWord.find(keyname);
 
 1078     return *((*key).second);
 
 1093     return m_naxes[
index];
 
 1096   inline void HDU::naxes (
size_t index, 
const long& value)
 
 1098     m_naxes[
index] = value;
 
 1103 #ifdef SPEC_TEMPLATE_IMP_DEFECT 
 1106   inline void HDU::readKeyMS(
const String& keyName, 
int & val)
 
 1109           Keyword& key = readKeyword(keyName);
 
 1113   inline void HDU::readKeys(std::vector<String>& keyNames, std::vector<String>& vals)
 
 1115           size_t nRead = keyNames.size();
 
 1117           std::list<String> valKeys;
 
 1118           std::list<String>      valList;
 
 1119           for (
size_t i = 0; i < nRead; i++) valKeys.push_back(keyNames[i]);
 
 1122           readKeywords(valKeys);
 
 1128           std::list<String>::iterator it = valKeys.begin(); 
 
 1129           while (it != valKeys.end())
 
 1133                           m_keyWord[*it]->value(current);
 
 1134                           valList.push_back(current);       
 
 1137                   catch ( Keyword::WrongKeywordValueType )
 
 1139                           it = valKeys.erase(it);                         
 
 1143           keyNames.erase(keyNames.begin(),keyNames.end());       
 
 1145           if (!valList.empty())
 
 1147                   if (valList.size() != vals.size()) vals.resize(valList.size());
 
 1150                   std::list<String>::const_iterator it1 = valList.begin();
 
 1151                   for ( ; it1 != valList.end(); ++it1,++i)
 
 1155                   for ( it1= valKeys.begin(); it1 != valKeys.end(); ++it1)
 
 1157                           keyNames.push_back(*it1);
 
std::pair< unsigned long, unsigned long > getChecksum() const 
compute and return the checksum values for the HDU without creating or modifying the CHECKSUM/DATASUM...
Definition: HDU.cxx:532
void writeChecksum()
compute and write the DATASUM and CHECKSUM keyword values 
Definition: HDU.cxx:500
static std::vector< int > keywordCategories()
Return the default enumerated keyword categories used by copyAllKeys() 
Definition: HDU.cxx:660
void writeDate()
write a date string to *this. 
Definition: HDU.cxx:460
exception to be thrown on seek errors for keywords. 
Definition: HDU.h:701
void writeComment(const String &comment="Generic Comment")
write a comment string. 
Definition: HDU.cxx:403
FITS * parent() const 
return reference to the pointer representing the FITS object containing the HDU 
Definition: HDU.cxx:313
virtual Keyword * clone() const =0
virtual copy constructor 
long axis(size_t index) const 
return the size of axis numbered index [zero based]. 
Definition: HDU.h:983
bool operator!=(const HDU &right) const 
inequality operator 
Definition: HDU.cxx:150
NoNullValue(const string &diag, bool silent=true)
Exception ctor, prefixes the string "Fits Error: No Null Pixel Value specified for Image " before the...
Definition: HDU.cxx:76
long bitpix() const 
return the data type keyword. 
Definition: HDU.h:998
void deleteKey(const String &doomed)
delete a keyword from the header 
Definition: HDU.cxx:543
virtual HDU * clone(FITS *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 
Definition: HDU.cxx:308
const String & name() const 
return the name of a keyword 
Definition: Keyword.h:320
std::pair< int, int > verifyChecksum() const 
verify the HDU by computing the checksums and comparing them with the CHECKSUM/DATASUM keywords ...
Definition: HDU.cxx:518
exception to be thrown on seek errors for keywords. 
Definition: HDU.h:712
Abstract base class defining the interface for Keyword objects. 
Definition: Keyword.h:198
Base class for all HDU [Header-Data Unit] objects. 
Definition: HDU.h:673
std::map< String, Keyword * > & keyWord()
return the associative array containing the HDU keywords so far read. 
Definition: HDU.h:1037
virtual void resetImageRead()
force next image reading operation to read from file instead of object cache. 
Definition: HDU.h:1028
Keyword & readNextKey(const std::vector< String > &incList, const std::vector< String > &excList, bool searchFromBeginning=false)
Read the next key in the HDU which matches a string in incList, and does not match string in excList...
Definition: HDU.cxx:783
const String & getHistory()
read the history information from the HDU and add it to the FITS object. 
Definition: HDU.cxx:425
InvalidExtensionType(const string &diag, bool silent=true)
Exception ctor, prefixes the string "Fits Error: Extension Type: " before the specific message...
Definition: HDU.cxx:54
Memory object representation of a disk FITS file. 
Definition: FITS.h:628
FitsException is the base class for all exceptions thrown by this library. 
Definition: FitsError.h:93
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...
Definition: HDU.h:895
ValueType
CCfits value types and their CFITSIO equivalents (in caps) 
Definition: CCfits.h:81
int index() const 
return the HDU number 
Definition: HDU.h:993
virtual void makeThisCurrent() const 
move the fitsfile pointer to this current HDU. 
Definition: HDU.cxx:318
HDU(const HDU &right)
copy constructor 
Definition: HDU.cxx:86
void readAllKeys(const std::vector< int > &keyCategories=std::vector< int >())
read all of the keys in the header 
Definition: HDU.cxx:553
std::ostream & operator<<(std::ostream &s, const Column &right)
output operator for Column objects. 
Definition: Column.h:1337
void writeHistory(const String &history="Generic History String")
write a history string. 
Definition: HDU.cxx:438
T & value(T &val) const 
get the keyword value 
Definition: KeywordT.h:29
long axes() const 
return the number of axes in the HDU data section (always 2 for tables). 
Definition: HDU.h:978
virtual ~HDU()
destructor 
Definition: HDU.cxx:138
NoSuchKeyword(const string &diag, bool silent=true)
Exception ctor, prefixes the string "Fits Error: Keyword not found:  " before the specific message...
Definition: HDU.cxx:66
void copyAllKeys(const HDU *inHdu, const std::vector< int > &keyCategories=std::vector< int >())
copy all keys from another header 
Definition: HDU.cxx:617
const String & getComments()
read the comments from the HDU and add it to the FITS object. 
Definition: HDU.cxx:391
exception to be thrown if user requests extension type that can not be understood as ImageExt...
Definition: HDU.h:690
bool operator==(const HDU &right) const 
equality operator 
Definition: HDU.cxx:145
std::vector< long > & naxes()
return the HDU data axis array. 
Definition: HDU.h:1086
const string & history() const 
return the history string previously read by getHistory() 
Definition: HDU.h:968
virtual double scale() const 
return the BSCALE keyword value 
Definition: HDU.h:1008
virtual double zero() const 
return the BZERO keyword value 
Definition: HDU.h:1018
void updateChecksum()
update the CHECKSUM keyword value, assuming DATASUM exists and is correct 
Definition: HDU.cxx:509
InvalidImageDataType(const string &diag, bool silent=true)
Exception ctor, prefixes the string "Fits Error: Invalid Data Type for Image " before the specific me...
Definition: HDU.cxx:44
const string & comment() const 
return the comment string previously read by getComment() 
Definition: HDU.h:963
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...
Definition: HDU.h:903
Keyword & addKey(const String &name, T val, const String &comment, bool isLongStr=false)
create a new keyword in the HDU with specified value and comment fields 
Definition: HDU.h:886
virtual void suppressScaling(bool toggle=true)
turn off image scaling regardless of the BSCALE and BZERO keyword values 
Definition: HDU.cxx:483
exception to be thrown if user requests creation of an image of type not supported by cfitsio...
Definition: HDU.h:679