Keyword.h

00001 //      This is version 1.6 release dated Nov 2006
00002 //      Astrophysics Science Division,
00003 //      NASA/ Goddard Space Flight Center
00004 //      HEASARC
00005 //      http://heasarc.gsfc.nasa.gov
00006 //      e-mail: ccfits@legacy.gsfc.nasa.gov
00007 //
00008 //      Original author: Ben Dorman, L3-Communications EER Systems Inc.
00009 
00010 #ifndef KEYWORD_H
00011 #define KEYWORD_H 1
00012 #include "CCfits.h"
00013 // using namespace CCfits;
00014 #ifdef _MSC_VER
00015 #include "MSconfig.h"
00016 #endif
00017 
00018 // FitsError
00019 #include "FitsError.h"
00020 
00021 namespace CCfits {
00022   class HDU;
00023 
00024 } // namespace CCfits
00025 
00026 
00027 namespace CCfits {
00028 
00059 /* \fn friend ostream& operator << (ostream &s, const Keyword &right);
00060 
00061         \brief output operator for Keywords.
00062 
00063 */
00064 
00147   class Keyword 
00148   {
00149 
00150     public:
00151 
00152 
00153 
00154       class WrongKeywordValueType : public FitsException  //## Inherits: <unnamed>%39B0221700E2
00155       {
00156         public:
00157             WrongKeywordValueType (const String& diag, bool silent = true);
00158 
00159         protected:
00160         private:
00161         private: //## implementation
00162       };
00163         Keyword(const Keyword &right);
00164         Keyword (const String &keyname, ValueType keytype, HDU* p, const String &comment = "");
00165         virtual ~Keyword();
00166         Keyword & operator=(const Keyword &right);
00167         bool operator==(const Keyword &right) const;
00168 
00169         bool operator!=(const Keyword &right) const;
00170 
00171         virtual std::ostream & put (std::ostream &s) const = 0;
00172         virtual Keyword * clone () const = 0;
00173         virtual void write () = 0;
00174         fitsfile* fitsPointer () const;
00175         const String& comment () const;
00176         const String& name () const;
00177 
00178     public:
00179       // Additional Public Declarations
00180       template <typename T>
00181       T& value(T& val) const;
00182 
00183       template <typename T>
00184       void setValue(const T& newValue);
00185     protected:
00186         virtual void copy (const Keyword& right);
00187         virtual bool compare (const Keyword &right) const;
00188         ValueType keytype () const;
00189         void keytype (ValueType value);
00190         const HDU* parent () const;
00191 
00192       // Additional Protected Declarations
00193 
00194     private:
00195       // Additional Private Declarations
00196 
00197     private: //## implementation
00198       // Data Members for Class Attributes
00199         ValueType m_keytype;
00200 
00201       // Data Members for Associations
00202         HDU* m_parent;
00203         String m_comment;
00204         String m_name;
00205 
00206       // Additional Implementation Declarations
00207       friend std::ostream &operator << (std::ostream &s, const Keyword &right);
00208   };
00209 #ifndef SPEC_TEMPLATE_IMP_DEFECT
00210 #ifndef SPEC_TEMPLATE_DECL_DEFECT
00211   template <> float& Keyword::value(float& val) const;
00212   template <> double& Keyword::value(double& val) const;
00213   template <> int& Keyword::value(int& val) const;
00214 #endif 
00215 #endif 
00216 
00217 inline std::ostream& operator << (std::ostream &s, const Keyword &right)
00218 {
00219    return right.put(s);
00220 }  
00221 
00222   // Class CCfits::Keyword::WrongKeywordValueType 
00223 
00224   // Class CCfits::Keyword 
00225 
00226   inline ValueType Keyword::keytype () const
00227   {
00228     return m_keytype;
00229   }
00230 
00231   inline void Keyword::keytype (ValueType value)
00232   {
00233     m_keytype = value;
00234   }
00235 
00236   inline const HDU* Keyword::parent () const
00237   {
00238     return m_parent;
00239   }
00240 
00241   inline const String& Keyword::comment () const
00242   {
00243     return m_comment;
00244   }
00245 
00246   inline const String& Keyword::name () const
00247   {
00248     return m_name;
00249   }
00250 
00251 } // namespace CCfits
00252 
00253 
00254 #endif

Generated on Fri Nov 3 17:09:05 2006 for CCfits by  doxygen 1.4.7