#ifndef FACT_Fits #define FACT_Fits #include #include #include "Description.h" using namespace CCfits; class Converter; class Fits { private: ///The CCfits object to the FITS file FITS* fFile; ///The CCfits Table Table* fTable; ///The current number of Rows in the table int fNumRows; ///Name of the "standard", i.e. data found in every fits file ///TODO make these variable static so that they are shared by every object. ///TODO add also a static boolean to initialize these only once std::vector fStandardColDesc; ///Format of the standard columns. std::vector fStandardFormats; ///the pointers to the standard variables std::vector fStandardPointers; ///the number of bytes taken by each standard variable std::vector fStandardNumBytes; ///the vector of data column names std::vector fDataColDesc; ///the data format of the data columns std::vector fDataFormats; ///the pointer to the contiguous memory location where the data is stored (i.e. the dim data pointer) void* fDataPointer; ///the size of the data, in bytes. int fDataNumBytes; ///the copy buffer. Required to put the standard and data variable in contguous memory unsigned char* fCopyBuffer; ///the total number of bytes per FITS row int fTotalNumBytes; ///to keep track of the time of the latest written entry (to update the header when closing the file) double fEndMjD; ///Write the FITS header keys void WriteHeaderKeys(); public: Fits() : fFile(NULL), fTable(NULL), fNumRows(0), fDataPointer(NULL), fDataNumBytes(0), fCopyBuffer(NULL), fTotalNumBytes(0), fEndMjD(0.0) {} virtual ~Fits() { if (IsOpen()) Close(); } ///returns wether or not the file is currently open or not bool IsOpen() {return fFile != NULL;} ///Adds a column that exists in all FITS files void AddStandardColumn(Description& desc, std::string dataFormat, void* dataPointer, long unsigned int numDataBytes); ///Adds columns specific to the service being logged. void InitDataColumns(std::vector desc, std::vector& dataFormat, void* dataPointer, int numDataBytes); ///Opens a FITS file void Open(const std::string& fileName, const std::string& tableName); ///Write one line of data. Use the given converter. void Write(Converter* conv); ///Close the currently opened file. void Close(); };//Fits #endif /*FITS_H_*/