/* Interface Fits BINARY/ASCII Table cmv 21/05/2001 */ #include "sopnamsp.h" #include "machdefs.h" #include #include #include "pexceptions.h" #include "fbtntintf.h" ////////////////////////////////////////////////////////////// FitsBTNtuIntf::FitsBTNtuIntf(string fname,int ihdu ,int_4 blen,int_4 bsens,uint_2 lp) { DbgLevel = lp; SetNulVal(); SetBuffer(blen,bsens); FitsFN = fname; IHdu = ihdu; Init(); } FitsBTNtuIntf::FitsBTNtuIntf(char * cfname,int ihdu ,int_4 blen,int_4 bsens,uint_2 lp) { DbgLevel = lp; SetNulVal(); SetBuffer(blen,bsens); FitsFN = cfname; IHdu = ihdu; Init(); } FitsBTNtuIntf::FitsBTNtuIntf(FitsBTNtuIntf& fbtnt) { DbgLevel = fbtnt.DbgLevel; SetNulVal(fbtnt.NulVal); SetBuffer(fbtnt.BuffLen,fbtnt.BuffSens); FitsFN = fbtnt.FitsFN; IHdu = fbtnt.IHdu; Init(); } FitsBTNtuIntf::FitsBTNtuIntf() { DbgLevel = 0; SetNulVal(); SetBuffer(); FitsFN = ""; IHdu = -1; Init(); } FitsBTNtuIntf::~FitsBTNtuIntf() { Delete(); } ////////////////////////////////////////////////////////////// void FitsBTNtuIntf::ChangeBuffer(int_4 blen,int_4 bsens) { SetBuffer(blen,bsens); DeAllocBuff(); AllocBuff(); } void FitsBTNtuIntf::AllocBuff(void) { if(Buffer==NULL || NBcol<=0) return; int_4 n = BuffLen; if(BuffSens==0) n++; for(int icol=0;icol=NBline) return NULL; // Pas de bufferisation, on lit betement if(BuffLen==1) { NFitsRead++; for(int icol=0;icolLineFin) { NFitsRead++; LONGLONG row1,row2,nrow; if(BuffSens>0) { // Cas remplissage forward row1 = n+1; row2 = row1+BuffLen-1; if(row2>NBline) row2 = NBline; } else if(BuffSens<0) { // Cas remplissage backward row2 = n+1; row1 = row2-BuffLen+1; if(row1<1) row1 = 1; } else { // Cas remplissage centre row1 = n+1 - BuffLen/2; if(row1<1) row1 = 1; row2 = n+1 + BuffLen/2; if(row2>NBline) row2 = NBline; } nrow = row2 - row1 + 1; LineDeb = row1-1; LineFin = row2-1; //cout<<"DBG-FitsRead: row1="<=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"; int icol; for(icol=0;icol