Index: /trunk/ippToPsps/src/Fits.c
===================================================================
--- /trunk/ippToPsps/src/Fits.c	(revision 30861)
+++ /trunk/ippToPsps/src/Fits.c	(revision 30861)
@@ -0,0 +1,110 @@
+/** @file Fits.c
+ *
+ *  @ingroup ippToPsps
+ *
+ *  Source for all methods in the Fits class
+ *
+ *  @author IfA
+ *  Copyright 2009 Institute for Astronomy, University of Hawaii
+ */
+
+#include "Fits.h"
+
+/**
+  Destructor
+  */
+static void destroy(Fits* this) {
+
+    int status = 0;
+    if (fits_close_file(this->file, &status)) {
+
+        psError(PS_ERR_IO, false, "Unable to close FITS file");
+        fits_report_error(stderr, status);
+    }
+
+printf("destroyed...\n");
+
+    return;
+}
+
+/**
+  Gets the column number for the provided column name
+  */
+static bool getColumnNumber(Fits* this, char* name, int* number) {
+
+    int status = 0;
+    fits_get_colnum(this->file, CASESEN, name, number, &status);
+    if (status) {
+
+        psError(PS_ERR_IO, false, "Could not get column number for '%s'\n", name);
+        return false;
+    }
+
+    return true;
+}
+
+/**
+  Moves to a certain extension of provided name and type
+  */
+bool moveToExtension(Fits* this, char* name, int type) {
+
+    int status = 0;
+    if (fits_movnam_hdu(this->file, type, name, 0, &status)) {
+
+        psError(PS_ERR_IO, false, "Can't move to table extension named '%s'\n", name);
+    }
+
+    return true;
+}
+
+/**
+  Moves to a certain header extension
+  */
+bool moveToHeader(Fits* this, char* name) {
+
+    return moveToExtension(this, name, IMAGE_HDU);
+}
+
+/**
+  Moves to a certain binary table extension
+  */
+bool moveToBinaryTable(Fits* this, char* name) {
+
+    return moveToExtension(this, name, BINARY_TBL);
+}
+
+/**
+  Returns the file pointer.
+  */
+static fitsfile* getFilePtr(Fits* this) {
+
+    return this->file;
+}
+
+/**
+  Constructor. Returns a new Fits object.
+  */
+Fits* new_Fits(char* path) {
+
+    Fits* this = (Fits*)calloc(1, sizeof(Fits));
+
+    int status = 0;
+    if (fits_open_file(&this->file, path, READONLY, &status)) {
+
+        psError(PS_ERR_IO, false, "Unable to open FITS file here %s\n", path);
+    }
+
+    // method pointers
+    this->getFilePtr = getFilePtr;
+    this->getColumnNumber = getColumnNumber;
+    this->moveToExtension = moveToExtension;
+    this->moveToHeader = moveToHeader;
+    this->moveToBinaryTable = moveToBinaryTable;
+    this->destroy = destroy;
+
+    assert(this);
+
+    return this;
+}
+
+
Index: /trunk/ippToPsps/src/Fits.h
===================================================================
--- /trunk/ippToPsps/src/Fits.h	(revision 30861)
+++ /trunk/ippToPsps/src/Fits.h	(revision 30861)
@@ -0,0 +1,37 @@
+/** @file Fits.h
+ *
+ *  @brief An encapsulation of necessary cfitsio functions
+ *
+ *  @ingroup ippToPsps
+ *
+ *  @author IfA
+ *  Copyright 2009 Institute for Astronomy, University of Hawaii
+ */
+
+#ifndef IPPTOPSPS_FITS_H
+#define IPPTOPSPS_FITS_H
+
+#include <psmodules.h>
+
+/**
+  Class that encapsulates a FITS file, making an OO interface to the dreaded cfitsio
+
+  */
+typedef struct Fits {
+
+    // fields
+    fitsfile* file;
+
+    // methods
+    fitsfile* (*getFilePtr)();
+    bool (*getColumnNumber)();
+    bool (*moveToExtension)();
+    bool (*moveToHeader)();
+    bool (*moveToBinaryTable)();
+    void (*destroy)();
+
+} Fits;
+
+Fits* new_Fits(char* path);
+
+# endif // IPPTOPSPS_FITS_H 
