FitsFileBase.h
Go to the documentation of this file.
1 /* -*- mode:c++ -*- */
2 
14 #ifndef _FitsFileBase_h
15 #define _FitsFileBase_h
16 
17 #include "fitsio.h"
18 
19 #include <string>
20 
21 namespace hippodraw {
22 
32 class FitsFileBase {
33 
34 public:
35 
38  enum HduType
39  { Image = IMAGE_HDU,
40  Atable = ASCII_TBL,
41  Btable = BINARY_TBL,
42  Any = ANY_HDU
43  };
44 
47  enum ImageType
48  { ByteImg = BYTE_IMG,
49  ShortImg = SHORT_IMG,
50  LongImg = LONG_IMG,
51  FloatImg = FLOAT_IMG,
52  DoubleImg = DOUBLE_IMG,
53  NoImg = 0
54  };
55 
58  enum DataType {
59  ByteU = TBYTE,
60  Short = TSHORT,
61  ShortU = TUSHORT,
62  Int = TINT,
63  IntU = TUINT,
64  Long = TLONG,
65  LongU = TULONG,
66  LongLong = TLONGLONG,
67  Float = TFLOAT,
68  Double = TDOUBLE
69  };
70 
71 private:
72 
75  static HduType convert ( int i );
76 
81  int numKeywords() const;
82 
83 protected:
84 
87  mutable int m_status;
88 
91 
93  FitsFileBase ( const std::string & filename, bool write = false );
94 
97  ImageType getImageType () const;
98 
101  int getImageDimensions ( ) const;
102 
109  double doubleValueForKey ( const char * key ) const;
110 
113  int getNumberOfColumns ( ) const;
114 
117  int getNumberOfHDU () const;
118 
121  bool hasKey ( const char * key ) const;
122 
128  int intValueForKey( const char * key ) const;
129 
136  std::string stringValueForKey ( const char * key ) const;
137 
138 public:
139 
141  virtual ~FitsFileBase();
142 
144  void clearErrorMessageStack( void );
145 
148  HduType getHduType () const;
149 
153  int getHDUNumber ( ) const;
154 
162  int moveToHDU ( int hdunum );
163 
169  int moveToHDU ( const std::string & name );
170 
173  int status () const;
174 
177  long getNumberOfRows ( ) const;
178 
179 private:
180 
182  FitsFileBase( const FitsFileBase& );
183 
186 
187 };
188 
189 } // namespace hippodraw
190 
191 #endif // _FitsFileBase_h
FitsFileBase(const std::string &filename, bool write=false)
Protected construction taking a file name as argument.
The C struct used by cfitsio to maintain status of FITS file.
Definition: fits.dir:16
32 bit floating point per pixel
Definition: FitsFileBase.h:51
int getNumberOfHDU() const
Returns the number of HDU in the file.
FitsFileBase & operator=(const FitsFileBase &)
Disallow assignment.
int getHDUNumber() const
Returns the current HDU number.
int moveToHDU(int hdunum)
Move to a specified absolute HDU number in the FITS file and return the cfitsio status.
int numKeywords() const
Return the number of existing keywords (not counting the END keyword).
long getNumberOfRows() const
Returns the number of rows in the table.
32 bit floating point
Definition: FitsFileBase.h:67
int getImageDimensions() const
Returns the number of dimensions (axes) of an image.
16 bit integer per pixel
Definition: FitsFileBase.h:49
int write(const std::vector< double > &a)
Given the vector it writes it to std stream.
Definition: NumLinAlg.cxx:421
HduType getHduType() const
Returns the type of HDU.
64 bit floating point per pixel
Definition: FitsFileBase.h:52
32 bit integer per pixel
Definition: FitsFileBase.h:50
std::string stringValueForKey(const char *key) const
Read a specified keyword value and returns it as a string.
DataType
The data types supported by cfitsio.
Definition: FitsFileBase.h:58
ImageType getImageType() const
Returns the image type.
Displays on the Z axis the values of a single column treated as a matrix of values.
Definition: Image.h:45
A base class for the concrete classes that wrap the cfitsio library.
Definition: FitsFileBase.h:32
int intValueForKey(const char *key) const
Read a specified keyword value and returns it as a int.
void clearErrorMessageStack(void)
Clear the entire error message stack.
ImageType
The type of image in HDU.
Definition: FitsFileBase.h:47
int getNumberOfColumns() const
Returns the number of columns in a table.
double doubleValueForKey(const char *key) const
Read a specified keyword value and return it as a double.
64 bit floating point
Definition: FitsFileBase.h:68
8 bit integer per pixel
Definition: FitsFileBase.h:48
virtual ~FitsFileBase()
Virtual destructor.
bool hasKey(const char *key) const
Returns true if the keyword key exists, otherwise returns false.
HduType
The type of HDU.
Definition: FitsFileBase.h:38
int status() const
Returns the cfitsio status code for the last operation.
static HduType convert(int i)
Converts an integer to HduType.
fitsfile * m_fptr
Pointer to the fits file data structure.
Definition: FitsFileBase.h:90
int m_status
The status return code from the last cfitsio operation.
Definition: FitsFileBase.h:87

Generated for HippoDraw Class Library by doxygen