00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef KEYWORD_H
00013 #define KEYWORD_H 1
00014 #include "CCfits.h"
00015
00016 #ifdef _MSC_VER
00017 #include "MSconfig.h"
00018 #endif
00019
00020
00021 #include "FitsError.h"
00022
00023 namespace CCfits {
00024 class HDU;
00025
00026 }
00027
00028
00029 namespace CCfits {
00030
00061
00062
00063
00064
00065
00066
00149 class Keyword
00150 {
00151
00152 public:
00153
00154
00155
00156 class WrongKeywordValueType : public FitsException
00157 {
00158 public:
00159 WrongKeywordValueType (const String& diag, bool silent = true);
00160
00161 protected:
00162 private:
00163 private:
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
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
00195
00196 private:
00197
00198
00199 private:
00200
00201 ValueType m_keytype;
00202
00203
00204 HDU* m_parent;
00205 String m_comment;
00206 String m_name;
00207
00208
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
00225
00226
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 }
00254
00255
00256 #endif