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