/** @file Fits.h
 *
 *  @brief An encapsulation of necessary cfitsio functions
 *
 *  @ingroup ippToPsps
 *
 *  @author IfA
 *  Copyright 2011 Institute for Astronomy, University of Hawaii
 */

#ifndef IPPTOPSPS_FITS_H
#define IPPTOPSPS_FITS_H

#include <psmodules.h>

#include "Logger.h"

/**

  Class that encapsulates a FITS file, making an OO interface to the dreaded cfitsio

  */
typedef struct Fits {

    // fields
    fitsfile* file;             // cfitsio file pointer
    char path[1000];            // FITS path
    Logger* logger;             // logger object

    // accessor methods
    fitsfile* (*getFilePtr)();
    int (*getDataType)();
    char* (*getPath)();
    bool (*countRows)();
    bool (*getColumnMeta)();
    bool (*getColumnNumber)();
    bool (*getColumnVector)();
    bool (*readColumn)();
    bool (*readColumnUsingName)();
    bool (*getHeaderKeyValue)();

    // mutators
    bool (*moveToExtension)();
    bool (*moveToHeader)();
    bool (*moveToBinaryTable)();
    bool (*moveToBinaryTableAndCountRows)();
    bool (*createBinaryTable)();
    bool (*writeColumn)();
    bool (*deleteRows)();
    bool (*delete)();

    // destructor
    void (*destroy)();

} Fits;

// constructors
Fits* existing_Fits(const char* path, Logger* logger);
Fits* new_Fits(const char* path, Logger* logger);

// non-class methods
int Fits_getDataType(char *typename);

# endif // IPPTOPSPS_FITS_H 
