Index: trunk/SophyaExt/FitsIOServer/fitsfile.h
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsfile.h	(revision 1045)
+++ trunk/SophyaExt/FitsIOServer/fitsfile.h	(revision 1047)
@@ -48,55 +48,75 @@
   static int NbBlocks(char flnm[]);
   static void getBlockType(char flnm[], int hdunum, string& typeOfExtension, int& naxis, vector<int>& naxisn, string& dataType, DVList& dvl  );
-/*! return true if the current header  corresponds to a FITS image extension */
-inline bool IsFitsImage() const { return (hdutype_ == IMAGE_HDU);}
-
-/*! return true if the current header  corresponds to a FITS ASCII or BINTABLE extension */
-inline bool IsFitsTable() const {return (hdutype_ == ASCII_TBL || hdutype_ == BINARY_TBL);}
-
-/*!
-this method is called from inherited objects : 
-
-moves to header 'hdunum' on file 'flnm'
-
-gets parameters in header 
-
-calls the method 'ReadFromFits' from the inherited delegated object
-
-*/ 
-  void   ReadF(char flnm[],int hdunum= 0);
-  FitsFile* ReadFInit(char flnm[],int hdunum=0); 
-  void ReadFFromFits(); 
+
+  protected: 
  
 /*!
 this method is called from inherited objects : 
 
+moves to header 'hdunum' on file 'flnm'
+
+gets parameters in header 
+
+calls the method 'ReadFromFits' from the inherited  object
+
+*/ 
+  void   ReadF(char flnm[],int hdunum= 0);
+  //  FitsFile* ReadFInit(char flnm[],int hdunum=0); 
+  void ReadFInit(char flnm[],int hdunum=0); 
+ 
+/*!
+this method is called from inherited objects : 
+
 opens a file 'flnm' 
 
 gets parameters in header 
 
-calls the method 'ReadFromFits' from the inherited delegated object
+calls the method 'ReadFromFits' from the inherited  object
 
 */ 
-  void    WriteF(char flnm[], bool OldFile=false); 
-
-
-  /*!
-fill the array 'map' with double data from the current extension on FITS file.
-If the extension is BINTABLE, the first column is provided. 
-
-\param <nentries>  number of data to be read
-  */
-  void    GetSingleColumn(double* map, int nentries) const;
-
-  /*! same as above with float data */
-  void    GetSingleColumn(float*  map, int nentries) const;
-
-  /*! same as above with int data */
-  void    GetSingleColumn(int* map, int nentries) const;
+  void    WriteF(char flnm[], bool OldFile=false);
+ //    virtual void    ReadFromFits(FitsFile& ff)=0;           
+
+
+
+  virtual void    ReadFromFits()=0;           
+  virtual void    WriteToFits()=0;           
+
+  static string getErrStatus(int status);
+
+
+  //////////////////////////////////////////////////////////
+  ///////   methods for managing extensions ////////////////
+  //////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////
+    //     methods with general purpose
+    ///////////////////////////////////////
+
+  /*! return a reference on a DVList containing the keywords from FITS file
+   */
+  inline const DVList& DVListFromFits() const { return dvl_;}
+
+  void moveToFollowingHeader();
+  int statusF() const; 
+
+
+/////////////////////////////////////////////////////////////
+  //       methods for managing FITS IMAGE extension
+  ///////////////////////////////////////////////////
+
+
+  //read
+  //----
+
+/*! return true if the current header  corresponds to a FITS image extension */
+inline bool IsFitsImage() const { return (hdutype_ == IMAGE_HDU);}
 
   /*! number of dimensions of an image extension : NAXIS parameter (in FITS notations)
    */
 inline int nbDimOfImage() const {return naxis_;}
-
+/*! a reference on a vector containing sizes of the NAXIS dimensions : NAXIS1, NAXIS2, NAXIS3 wtc.
+ */
+ inline const vector<int>& dimOfImageAxes() const { return naxisn_;}
 /*!
  total number of data in the current IMAGE extension
@@ -104,11 +124,47 @@
 inline int nbOfImageData() const { return nbData_; }
 
-/*! a reference on a vector containing sizes of the NAXIS dimensions : NAXIS1, NAXIS2, NAXIS3 wtc.
- */
- inline const vector<int>& dimOfImageAxes() const { return naxisn_;}
-
+
+//write
+//-----
+
+
+  /*! create an IMAGE header on FITS file.
+\param <type> type of data (see method ColTypeFromFits)
+\param <nbdim>  number of dimensions : 1D, 2D, 3D etc. = NAXIS
+\param <naxisn>  array containind sizes of the different dimensions
+  */
+  void makeHeaderImageOnFits(char type, int nbdim, int* naxisn) ;
+
+  /*! write double data from array 'map'on an IMAGE extension 
+\param <nbData>  number of data to be written
+
+   */
+  void putImageToFits( int nbData, double* map) const;
+
+  /*! same as previous method with float data */
+  void putImageToFits(int nbData, float* map ) const;
+
+  /*! same as previous method with int data */
+  void putImageToFits(int nbData, int* map) const;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+  //       methods for managing FITS BINARY TABLE or ASCII TABLE extension
+  ////////////////////////////////////////////////////////////////////////
+
+
+
+// read 
+//-----
+
+/*! return true if the current header  corresponds to a FITS ASCII or BINTABLE extension */
+inline bool IsFitsTable() const {return (hdutype_ == ASCII_TBL || hdutype_ == BINARY_TBL);}
  /*! return number of columns (return 1 if IMAGE) */
   int     NbColsFromFits() const;
-
+  /*! number of data in the current IMAGE extension on FITS file, or number
+ of data of column number 'nocol' of the current BINTABLE extension
+  */
+  int     NentriesFromFits(int nocol) const;
   /*! return a character denoting data type of column number 'nocol' in a BINTABLE :
 
@@ -123,22 +179,27 @@
   */
   char    ColTypeFromFits(int nocol) const;
-
-  /*! number of data in the current IMAGE extension on FITS file, or number
- of data of column number 'nocol' of the current BINTABLE extension
-  */
-  int     NentriesFromFits(int nocol) const;
-
   /*! name of the column number 'nocol' of the current BINTABLE extension
    */
   string  ColNameFromFits(int nocol) const;
 
-  
   /*! number of characters of each data  for the column number 'nocol' (if char* typed) of the current BINTABLE extension
    */
   int     ColStringLengthFromFits(int nocol) const;
 
-  /*! return a reference on a DVList containing the keywords from FITS file
-   */
-  inline const DVList& DVListFromFits() const { return dvl_;}
+
+
+  /*!
+get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
+  */
+  void GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char
+** cdata) ;
+
+  /*!
+get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
+  */
+  void GetBinTabLine(int NoLine, float* fdata) ;
+
+
+
 
 
@@ -158,50 +219,8 @@
   // Write elements into the FITS data array
 
-  /*!
-get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
-  */
-  void GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char
-** cdata) const;
-  /*!
-get the NoLine-th 'line'  from the current BINTABLE extension on FITS file,
-  */
-  void GetBinTabLine(int NoLine, float* fdata) const;
-
-
-
-
-  /*! write double data from array 'map'on an IMAGE extension 
-\param <nbData>  number of data to be written
-
-   */
-  void putImageToFits( int nbData, double* map) const;
-
-  /*! same as previous method with float data */
-  void putImageToFits(int nbData, float* map ) const;
-
-  /*! same as previous method with int data */
-  void putImageToFits(int nbData, int* map) const;
-
-  /*! write double data from array 'donnees ' on column number 'nocol' of a BINTABLE  extension.
-\param <nentries>  number of data to be written
-
-   */
-  void putColToFits(int nocol, int nentries, double* donnees) const;
-
-  /*! same as previous method with float data */
-  void putColToFits(int nocol, int nentries, float* donnees) const;
-
-  /*! same as previous method with int data */
-  void putColToFits(int nocol, int nentries, int* donnees) const;
-
-  /*! same as previous method with char* data */
-  void putColToFits(int nocol, int nentries, char** donnees) const;
-
-  /*! create an IMAGE header on FITS file.
-\param <type> type of data (see method ColTypeFromFits)
-\param <nbdim>  number of dimensions : 1D, 2D, 3D etc. = NAXIS
-\param <naxisn>  array containind sizes of the different dimensions
-  */
-  void makeHeaderImageOnFits(char type, int nbdim, int* naxisn) ;
+
+
+  //write
+  //-----
 
   /*! create an BINTABLE header on FITS file.
@@ -216,14 +235,47 @@
   void makeHeaderBntblOnFits ( char* fieldType, char** Noms, int nentries, int tfields, DVList &dvl, char* extname,  vector<int> taille_des_chaines) ;
 
-  void moveToFollowingHeader();
-  void readheader();
-static  void printerror(int&) ;
-static  void printerror(int&,char* texte) ;
-  protected:  
-    virtual void    ReadFromFits(FitsFile& ff)=0;           
-    virtual void    WriteToFits(FitsFile& ff)=0;           
+  /*! write double data from array 'donnees ' on column number 'nocol' of a BINTABLE  extension.
+\param <nentries>  number of data to be written
+
+   */
+  void putColToFits(int nocol, int nentries, double* donnees) const;
+
+  /*! same as previous method with float data */
+  void putColToFits(int nocol, int nentries, float* donnees) const;
+
+  /*! same as previous method with int data */
+  void putColToFits(int nocol, int nentries, int* donnees) const;
+
+  /*! same as previous method with char* data */
+  void putColToFits(int nocol, int nentries, char** donnees) const;
+
+
+/////////////////////////////////////////////////////////////
+  //       methods for managing any type of FITS extension
+  ////////////////////////////////////////////////////////
+
+
+  /*!
+fill the array 'map' with double data from the current extension on FITS file.
+If the extension is BINTABLE, the first column is provided. 
+
+\param <nentries>  number of data to be read
+  */
+  void    GetSingleColumn(double* map, int nentries) const;
+
+  /*! same as above with float data */
+  void    GetSingleColumn(float*  map, int nentries) const;
+
+  /*! same as above with int data */
+  void    GetSingleColumn(int* map, int nentries) const;
+
+
+
 private:
 
    void InitNull();
+   void ResetStatus(int& status) ; 
+   static  void printerror(int&) ;
+   static  void printerror(int&,char* texte) ;
 
 static  void GetImageParameters (fitsfile* fileptr,int& bitpix,int& naxis,vector<int>& naxisn);
@@ -279,4 +331,8 @@
   DVList dvl_;
 
+
+
+  //! last status returned by fitsio library. updated only by several methods
+  int fits_status_;
 };
 
