29 #define CHECK_FITS_ERROR if (status) throw MCS_ERROR(MSG_FITS_ERROR, fitsError(status).c_str()) 31 mcs::FITSWriter::FITSWriter()
34 mcs::FITSWriter::~FITSWriter()
38 void mcs::FITSWriter::open(
string fn,
bool compressed)
44 if (compressed) fn +=
".gz";
46 fits_create_file(&fptr, fn.c_str(), &status);
51 void mcs::FITSWriter::close()
53 fitsfile *fptr = (fitsfile*) this->fptr;
57 fits_close_file(fptr, &status);
65 void mcs::FITSWriter::newBinTable(
Record& meta,
string HDUName)
67 fitsfile *fptr = (fitsfile*) this->fptr;
83 #define FIELD_NAME_LEN 50 84 #define FIELD_TYPE_LEN 10 85 ttype = (
char**) malloc(
sizeof(
char*) * count());
86 tform = (
char**) malloc(
sizeof(
char*) * count());
87 buf = (
char*) malloc((FIELD_NAME_LEN + FIELD_TYPE_LEN + 2) *
89 memset(buf, 0, (FIELD_NAME_LEN + FIELD_TYPE_LEN + 2) * count());
92 p2 = buf + FIELD_NAME_LEN * count();
94 for (i=0; i<count(); i++) {
96 p1 = stpcpy(p1, rec[i].name().c_str());
100 rec[i].isUnsigned(), s)) {
104 throw MCS_ERROR(MSG_TYPE_NOT_HANDLED, i, rec[i].type());
108 p2 = stpcpy(p2, s.c_str());
112 fits_create_tbl(fptr, BINARY_TBL, 0, count(),
114 NULL, (
char*) HDUName.c_str(), &status);
126 void mcs::FITSWriter::newImage(
Types bitpix,
127 unsigned int naxis,
unsigned int naxes,
128 void* buf,
string name)
136 bitpix_fits = BYTE_IMG;
139 bitpix_fits = SHORT_IMG;
142 bitpix_fits = LONG_IMG;
145 bitpix_fits = LONGLONG_IMG;
148 bitpix_fits = FLOAT_IMG;
151 bitpix_fits = DOUBLE_IMG;
160 #endif //ENABLE_CFITSIO
A dynamic array of Data objects.
#define MCS_ERROR(A, rest...)
Facility to easily pass all necessary parameter to an Event constructor.
bool Types2S_FITS(Types dbt, int len, bool isunsigned, string &fits)
Convert a MCS type into a FITSIO type code.
Record & operator=(Record &from)
Assignment operator, will copy all data objects.
Main include file for all MCS based applications.
Namespace for MCS library.
Types
Enumeration of base type for Data.