00001
00002
00014 #ifndef _FitsFileBase_h
00015 #define _FitsFileBase_h
00016
00017 #include "fitsio.h"
00018
00019 #include <string>
00020
00021 namespace hippodraw {
00022
00032 class FitsFileBase {
00033
00034 public:
00035
00038 enum HduType
00039 { Image = IMAGE_HDU,
00040 Atable = ASCII_TBL,
00041 Btable = BINARY_TBL,
00042 Any = ANY_HDU
00043 };
00044
00047 enum ImageType
00048 { ByteImg = BYTE_IMG,
00049 ShortImg = SHORT_IMG,
00050 LongImg = LONG_IMG,
00051 FloatImg = FLOAT_IMG,
00052 DoubleImg = DOUBLE_IMG,
00053 NoImg = 0
00054 };
00055
00058 enum DataType {
00059 ByteU = TBYTE,
00060 Short = TSHORT,
00061 ShortU = TUSHORT,
00062 Int = TINT,
00063 IntU = TUINT,
00064 Long = TLONG,
00065 LongU = TULONG,
00066 LongLong = TLONGLONG,
00067 Float = TFLOAT,
00068 Double = TDOUBLE
00069 };
00070
00071 private:
00072
00075 static HduType convert ( int i );
00076
00081 int numKeywords() const;
00082
00083 protected:
00084
00087 mutable int m_status;
00088
00090 fitsfile *m_fptr;
00091
00093 FitsFileBase ( const std::string & filename, bool write = false );
00094
00097 ImageType getImageType () const;
00098
00101 int getImageDimensions ( ) const;
00102
00109 double doubleValueForKey ( const char * key ) const;
00110
00113 int getNumberOfColumns ( ) const;
00114
00117 int getNumberOfHDU () const;
00118
00121 bool hasKey ( const char * key ) const;
00122
00128 int intValueForKey( const char * key ) const;
00129
00136 std::string stringValueForKey ( const char * key ) const;
00137
00138 public:
00139
00141 virtual ~FitsFileBase();
00142
00144 void clearErrorMessageStack( void );
00145
00148 HduType getHduType () const;
00149
00153 int getHDUNumber ( ) const;
00154
00162 int moveToHDU ( int hdunum );
00163
00169 int moveToHDU ( const std::string & name );
00170
00173 int status () const;
00174
00177 long getNumberOfRows ( ) const;
00178
00179 private:
00180
00182 FitsFileBase( const FitsFileBase& );
00183
00185 FitsFileBase& operator=( const FitsFileBase&);
00186
00187 };
00188
00189 }
00190
00191 #endif // _FitsFileBase_h