/* Interface Fits BINARY/ASCII Table cmv 21/05/2001 */ #include "machdefs.h" #include #include #include "pexceptions.h" #include "fbtntintf.h" ////////////////////////////////////////////////////////////// FitsBTNtuIntf::FitsBTNtuIntf(string fname,int ihdu,uint_4 blen,uint_2 lp) { BuffLen = (blen==0) ? 100 : blen; DbgLevel = lp; SetNulVal(); FitsFN = fname; IHdu = ihdu; Init(); } FitsBTNtuIntf::FitsBTNtuIntf(char * cfname,int ihdu,uint_4 blen,uint_2 lp) { BuffLen = (blen==0) ? 100 : blen; DbgLevel = lp; SetNulVal(); FitsFN = cfname; IHdu = ihdu; Init(); } FitsBTNtuIntf::FitsBTNtuIntf(FitsBTNtuIntf& fbtnt) { BuffLen = fbtnt.BuffLen; DbgLevel = fbtnt.DbgLevel; NulVal = fbtnt.NulVal; FitsFN = fbtnt.FitsFN; IHdu = fbtnt.IHdu; Init(); } FitsBTNtuIntf::FitsBTNtuIntf() { BuffLen = 100; DbgLevel = 0; SetNulVal(); FitsFN = ""; IHdu = -1; Init(); } FitsBTNtuIntf::~FitsBTNtuIntf() { Delete(); } ////////////////////////////////////////////////////////////// void FitsBTNtuIntf::Init() { NBcol = 0; NBline = 0; LineDeb = LineFin = -1; ColName.resize(0); ColReadable = NULL; Buffer = NULL; mRet = NULL; NFitsRead = 0; if(FitsFN.size() <= 0 ) { FitsPtr = NULL; IHdu = -1; return; } ////////////////////////// // Ouverture du fichier // ////////////////////////// int sta=0,nhdu,hdutype; const char * cfitsfn = FitsFN.c_str(); // Open fits if(fits_open_file(&FitsPtr,cfitsfn,READONLY,&sta)) printerror(sta); // Get number of hdu if(fits_get_num_hdus(FitsPtr,&nhdu,&sta)) printerror(sta); if(DbgLevel) cout<<"FitsBTNtuIntf::Init nhdu="<nhdu) for(int ihdu=1;ihdu<=nhdu;ihdu++) { if(fits_movabs_hdu(FitsPtr,ihdu,&hdutype,&sta)) printerror(sta); if(DbgLevel) cout<<"...Init ihdu=" <=NBline) return NULL; // Pas de bufferisation, on lit betement if(BuffLen==1) { NFitsRead++; for(int icol=0;icolLineFin) { NFitsRead++; long row1 = n+1; long row2 = row1+BuffLen-1; if(row2>NBline) row2 = NBline; long nrow = row2 - row1 + 1; LineDeb = n; LineFin = row2-1; for(int icol=0;icol=NBline || k<0 || k>=NBcol) return 0.; r_8 * r = GetLineD(n); return r[k]; } /*! Retourne une chaine de caracteres avec la declaration des noms de variables. si "nomx!=NULL" , des instructions d'affectation a partir d'un tableau "nomx[i]" sont ajoutees (pour interface NTuple). */ string FitsBTNtuIntf::VarList_C(const char* nomx) const { string rets; rets = "\ndouble"; for(int icol=0;icol