Keyword.h

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

Generated on Thu Jun 28 11:49:08 2007 for CCfits by  doxygen 1.4.7