Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | List of all members
FitsFileBase Class Reference

A base class for the concrete classes that wrap the cfitsio library. More...

#include <FitsFileBase.h>

Inheritance diagram for FitsFileBase:
Inheritance graph
[legend]
Collaboration diagram for FitsFileBase:
Collaboration graph
[legend]

Public Types

enum  DataType {
  ByteU = TBYTE, Short = TSHORT, ShortU = TUSHORT, Int = TINT,
  IntU = TUINT, Long = TLONG, LongU = TULONG, LongLong = TLONGLONG,
  Float = TFLOAT, Double = TDOUBLE
}
 The data types supported by cfitsio. More...
enum  HduType { Image = IMAGE_HDU, Atable = ASCII_TBL, Btable = BINARY_TBL, Any = ANY_HDU }
 The type of HDU. More...
enum  ImageType {
  ByteImg = BYTE_IMG, ShortImg = SHORT_IMG, LongImg = LONG_IMG, FloatImg = FLOAT_IMG,
  DoubleImg = DOUBLE_IMG, NoImg = 0
}
 The type of image in HDU. More...

Public Member Functions

void clearErrorMessageStack (void)
 Clear the entire error message stack.
int getHDUNumber () const
 Returns the current HDU number.
HduType getHduType () const
 Returns the type of HDU.
long getNumberOfRows () const
 Returns the number of rows in the table.
int moveToHDU (int hdunum)
 Move to a specified absolute HDU number in the FITS file and return the cfitsio status.
int moveToHDU (const std::string &name)
 Move to a specified absolute HDU with name name in the FITS file and return the cfitsio status.
int status () const
 Returns the cfitsio status code for the last operation.
virtual ~FitsFileBase ()
 Virtual destructor.

Protected Member Functions

double doubleValueForKey (const char *key) const
 Read a specified keyword value and return it as a double.
 FitsFileBase (const std::string &filename, bool write=false)
 Protected construction taking a file name as argument.
int getImageDimensions () const
 Returns the number of dimensions (axes) of an image.
ImageType getImageType () const
 Returns the image type.
int getNumberOfColumns () const
 Returns the number of columns in a table.
int getNumberOfHDU () const
 Returns the number of HDU in the file.
bool hasKey (const char *key) const
 Returns true if the keyword key exists, otherwise returns false.
int intValueForKey (const char *key) const
 Read a specified keyword value and returns it as a int.
std::string stringValueForKey (const char *key) const
 Read a specified keyword value and returns it as a string.

Protected Attributes

fitsfilem_fptr
 Pointer to the fits file data structure.
int m_status
 The status return code from the last cfitsio operation.

Private Member Functions

 FitsFileBase (const FitsFileBase &)
 Disallow copying.
int numKeywords () const
 Return the number of existing keywords (not counting the END keyword).
FitsFileBaseoperator= (const FitsFileBase &)
 Disallow assignment.

Static Private Member Functions

static HduType convert (int i)
 Converts an integer to HduType.

Detailed Description

A base class for the concrete classes that wrap the cfitsio library.

Implemented in this class are those items that do not handle arrays of data. See the derived class FitsFile for handling arrays with STL. Other derived classes may use other classes for handling arrays.

Author
Paul F. Kunz Paul_.nosp@m.Kunz.nosp@m.@slac.nosp@m..sta.nosp@m.nford.nosp@m..edu

Definition at line 32 of file FitsFileBase.h.

Member Enumeration Documentation

enum DataType

The data types supported by cfitsio.

Enumerator:
ByteU 

unsigned char

Short 

signed short

ShortU 

unsigned short

Int 

signed integer

IntU 

unsigned integer

Long 

signed long

LongU 

unsigned long

LongLong 

signed long long

Float 

32 bit floating point

Double 

64 bit floating point

Definition at line 58 of file FitsFileBase.h.

enum HduType

The type of HDU.

Enumerator:
Image 

Image.

Atable 

ASCII table.

Btable 

Binary table.

Any 

Matchs any.

Definition at line 38 of file FitsFileBase.h.

enum ImageType

The type of image in HDU.

Enumerator:
ByteImg 

8 bit integer per pixel

ShortImg 

16 bit integer per pixel

LongImg 

32 bit integer per pixel

FloatImg 

32 bit floating point per pixel

DoubleImg 

64 bit floating point per pixel

NoImg 

not an image HDU

Definition at line 47 of file FitsFileBase.h.

Constructor & Destructor Documentation

FitsFileBase ( const std::string &  filename,
bool  write = false 
)
protected

Protected construction taking a file name as argument.

Definition at line 24 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

~FitsFileBase ( )
virtual

Virtual destructor.

Definition at line 42 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

FitsFileBase ( const FitsFileBase )
private

Disallow copying.

Member Function Documentation

void clearErrorMessageStack ( void  )

Clear the entire error message stack.

Definition at line 50 of file FitsFileBase.cxx.

FitsFileBase::HduType convert ( int  i)
staticprivate
double doubleValueForKey ( const char *  key) const
protected

Read a specified keyword value and return it as a double.

Data type conversion will be performed for numeric values if the keyword value does not have the type double. If the value of the keyword is undefined (i.e., the value field is blank) then an undefined value will be returned.

Definition at line 164 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillImageDeltas(), and FitsFile::fillRefPixelValues().

int getHDUNumber ( ) const

Returns the current HDU number.

The first (primary) HDU has number value = 1.

Definition at line 144 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

FitsFileBase::HduType getHduType ( ) const

Returns the type of HDU.

Definition at line 69 of file FitsFileBase.cxx.

References FitsFileBase::convert(), FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillColumnNames(), and FitsFile::fillDoubleVectorFromColumn().

int getImageDimensions ( ) const
protected
FitsFileBase::ImageType getImageType ( ) const
protected
int getNumberOfColumns ( ) const
protected

Returns the number of columns in a table.

Definition at line 241 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillColumnNamesFromTable().

int getNumberOfHDU ( ) const
protected

Returns the number of HDU in the file.

Definition at line 110 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillHDUNames().

long getNumberOfRows ( ) const

Returns the number of rows in the table.

Definition at line 218 of file FitsFileBase.cxx.

References FitsFileBase::intValueForKey(), FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillShape().

bool hasKey ( const char *  key) const
protected
int intValueForKey ( const char *  key) const
protected

Read a specified keyword value and returns it as a int.

Data type conversion will be performed for numeric values if the keyword value does not have the type int. If the value of the keyword is undefined (i.e., the value field is blank) then an undefined value will be returned.

Definition at line 187 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillColumnNamesFromImage(), FitsFile::fillHDUNames(), FitsFile::fillRefPixelIndices(), and FitsFileBase::getNumberOfRows().

int moveToHDU ( int  hdunum)

Move to a specified absolute HDU number in the FITS file and return the cfitsio status.

When a FITS file is first opened or created it is automatically positioned to the first HDU (the primary array) in the file which has hdunum = 0 ( = 1 in cfitsio call) . The hdutype parameter of the underlying call to cfitsio function `fits_movabs_hdu()' is ignored.

Definition at line 121 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillHDUNames().

int moveToHDU ( const std::string &  name)

Move to a specified absolute HDU with name name in the FITS file and return the cfitsio status.

When a FITS file is first opened or created it is automatically positioned to the first HDU (the primary array) in the file which has hdunum = 1.

Definition at line 133 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

int numKeywords ( ) const
private

Return the number of existing keywords (not counting the END keyword).

Ignores the parameter in the underlying call to the cfitsio function `fits_get_hdrspace()' dealing with the amount of space currently available for more keywords.

Definition at line 154 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

FitsFileBase& operator= ( const FitsFileBase )
private

Disallow assignment.

int status ( ) const

Returns the cfitsio status code for the last operation.

Definition at line 211 of file FitsFileBase.cxx.

References FitsFileBase::m_status.

Referenced by FitsFile::fillIntVectorFromColumn().

string stringValueForKey ( const char *  key) const
protected

Read a specified keyword value and returns it as a string.

Data type conversion will be performed for numeric values if the keyword value does not have the type int. If the value of the keyword is undefined (i.e., the value field is blank) then an undefined value will be returned.

Definition at line 199 of file FitsFileBase.cxx.

References FitsFileBase::m_fptr, and FitsFileBase::m_status.

Referenced by FitsFile::fillColumnNamesFromImage(), FitsFile::fillHDUNames(), FitsFile::isHammerAitoff(), and FitsFile::pixCenter().

Member Data Documentation

fitsfile* m_fptr
protected
int m_status
mutableprotected

The documentation for this class was generated from the following files:

Generated for HippoDraw Class Library by doxygen