Index: /trunk/SophyaExt/FitsIOServer/fiosinit.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fiosinit.cc	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fiosinit.cc	(revision 2897)
@@ -7,4 +7,10 @@
 #include "fitshdtable.h"
 #include "fitsarrhand.h"
+
+#include "fitsntuple.h"
+#include "fitsspherehealpix.h"
+#include "fitsspherethetaphi.h"
+#include "fitslocalmap.h"
+
 
 #include <iostream> 
@@ -33,4 +39,19 @@
   FitsManager::RegisterHandler(new FitsHandler<BaseDataTable>, 1, "DataTable");
 
+  // Enregistrement des classes heritant de FitsIOHandler
+  FitsManager::RegisterHandler(new FITS_NTuple, 0, "NTuple");
+  
+  FitsManager::RegisterHandler(new FITS_SphereHEALPix<r_4> , 0, "SphereHEALPix<r_4>");
+  FitsManager::RegisterHandler(new FITS_SphereHEALPix<r_8> , 0, "SphereHEALPix<r_8>");
+  FitsManager::RegisterHandler(new FITS_SphereHEALPix<int_4> , 0, "SphereHEALPix<int_4>");
+
+  FitsManager::RegisterHandler(new FITS_SphereThetaPhi<r_4> , 0, "SphereThetaPhi<r_4>");
+  FitsManager::RegisterHandler(new FITS_SphereThetaPhi<r_8> , 0, "SphereThetaPhi<r_8>");
+  FitsManager::RegisterHandler(new FITS_SphereThetaPhi<int_4> , 0, "SphereThetaPhi<int_4>");
+
+  FitsManager::RegisterHandler(new FITS_LocalMap<r_4> , 0, "LocalMap<r_4>");
+  FitsManager::RegisterHandler(new FITS_LocalMap<r_8> , 0, "LocalMap<r_8>");
+  FitsManager::RegisterHandler(new FITS_LocalMap<int_4> , 0, "LocalMap<int_4>");
+
   cout << " ---- FitsIOServerInitiator / DEBUG ---- ListHandlers() : " << endl;
   FitsManager::ListHandlers();
Index: /trunk/SophyaExt/FitsIOServer/fitsfile.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 2897)
@@ -244,4 +244,11 @@
 }
 
+void FitsIOHandler::Read(FitsInOutFile& is) 
+{
+  FitsInFile fis(is);
+  fis.ReadHeader(0);
+  ReadFromFits(fis);
+}
+
   /*! \fn void SOPHYA::FitsIOHandler::Read(FitsInFile& is, int hdunum)
 Read the data on extension hdunum (or primary header, if hdunum=1) from FitsInFIle. If hdunum is not addressed, , one reads the next extension, with respect to the current position. 
@@ -271,10 +278,11 @@
 {
   FitsOutFile of(flnm, FitsFile::unknown);
-  Write(of);
-}
-
-void FitsIOHandler::Write(FitsOutFile& os) 
-{
-  WriteToFits(os);
+  WriteToFits(of);
+}
+
+void FitsIOHandler::Write(FitsInOutFile& os) 
+{
+  FitsOutFile fos(os);
+  WriteToFits(fos);
 }
 
Index: /trunk/SophyaExt/FitsIOServer/fitsfile.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsfile.h	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsfile.h	(revision 2897)
@@ -5,4 +5,5 @@
 #include "dvlist.h"
 #include "fitsinoutfile.h" 
+#include "fitshandler.h" 
 
 #define OPENFILE    0
@@ -52,5 +53,5 @@
 //! Class for managing Interface for SOPHYA objects to FITS Format Files (uses cfitsio lib)
 
-class FitsIOHandler {
+class FitsIOHandler : public FitsHandlerInterface {
 
 
@@ -60,7 +61,16 @@
    void   Read(char flnm[],int hdunum= 0);
    void   Write(char flnm[]) ;
-   void   Read(FitsInFile& ifts, int hdunum=0);
-   void   Write(FitsOutFile& ofts) ;
-
+
+   //Implementation par defaut de l'interface FitsHandlerInterface
+   virtual AnyDataObj* DataObj() { return NULL; }
+   virtual int         CheckHandling(AnyDataObj & o) { return 0; }
+   virtual void        SetDataObj(AnyDataObj & o) { return; }
+   virtual int         CheckReadability(FitsInOutFile& is) { return 0; }
+   virtual FitsHandlerInterface* Clone() { return NULL; }
+
+   virtual void   Read(FitsInOutFile& ifts);
+   virtual void   Write(FitsInOutFile& ofts) ;
+
+   virtual void   Read(FitsInFile& ifts, int hdunum=0);
 
  protected:
Index: /trunk/SophyaExt/FitsIOServer/fitslocalmap.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitslocalmap.cc	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitslocalmap.cc	(revision 2897)
@@ -68,4 +68,39 @@
     ownobj_ = false; 
   }    
+
+template <class T>
+int FITS_LocalMap<T>::CheckHandling(AnyDataObj & o)
+{
+  if ( typeid(o) == typeid( LocalMap< T > ) ) return 2;
+  LocalMap<T> * po = dynamic_cast< LocalMap<T> * >(&o);
+  if (po == NULL) return 0;
+  else return 1;
+}
+
+template <class T>
+int FITS_LocalMap<T>::CheckReadability(FitsInOutFile& is)
+{
+  if (is.CurrentHDUType() !=  BINARY_TBL ) return 0;
+  string key;
+  key = "Content";
+  string clsnm = is.KeyValue(key);
+  if (clsnm != "LocalMap") return 0;
+
+  vector<string> colnames; 
+  vector<int> coltypes;
+  vector<long> repcnt;
+  vector<long> width;
+  long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 
+  if (ncols < 1) return 0;
+  T x;
+  if (coltypes[0] == FitsTypes::DataType(x)) return 2 ;
+  else return 1;
+}
+
+template <class T>
+FitsHandlerInterface* FITS_LocalMap<T>::Clone()
+{
+  return new FITS_LocalMap<T>() ; 
+}
 
 template <class T>
@@ -195,8 +230,11 @@
   dvl["Content"]= "LocalMap";
   dvl.SetComment("Content", "name of SOPHYA object");
+  dvl["SOPCLSNM"]= "SOPHYA::LocalMap<T>";
+  dvl.SetComment("SOPCLSNM", "SOPHYA class name");
   // On ecrit les dataBlocks 
   vector<string> Noms;   
   Noms.push_back(dvl.GetS("Content"));
-  string extname("SIMULATION");
+  //  string extname("SIMULATION");
+  string extname = os.NextExtensionName();
 
   // sortie sur image fits
Index: /trunk/SophyaExt/FitsIOServer/fitslocalmap.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitslocalmap.h	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitslocalmap.h	(revision 2897)
@@ -32,4 +32,8 @@
 inline operator LocalMap<T>() { return(*dobj_); }
 
+virtual int         CheckHandling(AnyDataObj & o) ;
+virtual int         CheckReadability(FitsInOutFile& is);
+virtual FitsHandlerInterface* Clone();
+
 protected :
 
Index: /trunk/SophyaExt/FitsIOServer/fitsntuple.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsntuple.cc	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsntuple.cc	(revision 2897)
@@ -53,4 +53,13 @@
   if (ownobj_ && dobj_ != NULL) delete dobj_;
   //  if (column_ != NULL) delete [] column_;
+}
+
+int  FITS_NTuple::CheckReadability(FitsInOutFile& is)
+{
+  if (is.CurrentHDUType() == IMAGE_HDU ) return 0;
+  string key = "SOPCLSNM"; 
+  string clsnm = is.KeyValue(key);
+  if (clsnm == "SOPHYA::NTuple")  return 2;
+  else return 1;
 }
 
@@ -167,6 +176,9 @@
   dvl["Content"]= "NTuple";
   dvl.SetComment("Content", "name of SOPHYA object");
+  dvl["SOPCLSNM"]= "SOPHYA::NTuple";
+  dvl.SetComment("SOPCLSNM", "SOPHYA class name");
   // extension name
-  string extname("NTuple_Binary_tbl"); 
+  // string extname("NTuple_Binary_tbl"); 
+  string extname = os.NextExtensionName();
 
   vector<string> Noms(ncols);   
Index: /trunk/SophyaExt/FitsIOServer/fitsntuple.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsntuple.h	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsntuple.h	(revision 2897)
@@ -35,5 +35,16 @@
     ownobj_ = false; 
   }    
+virtual   int         CheckHandling(AnyDataObj & o) 
+  {  
+    if (typeid(o) == typeid(NTuple)) return 2;
+    NTuple * po = dynamic_cast< NTuple * >(& o); 
+    if (po == NULL) return 0;
+    else return 1;
+  }
 
+virtual int         CheckReadability(FitsInOutFile& is);
+
+virtual FitsHandlerInterface* Clone() 
+    { return new FITS_NTuple() ; }
 
 /*!
Index: /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc	(revision 2897)
@@ -71,4 +71,45 @@
 } 
 
+template <class T>
+int FITS_SphereHEALPix<T>::CheckHandling(AnyDataObj & o)
+{
+  if ( typeid(o) == typeid( SphereHEALPix< T > ) ) return 2;
+  SphereHEALPix<T> * po = dynamic_cast< SphereHEALPix<T> * >(&o);
+  if (po == NULL) return 0;
+  else return 1;
+}
+
+template <class T>
+int FITS_SphereHEALPix<T>::CheckReadability(FitsInOutFile& is)
+{
+  if (is.CurrentHDUType() !=  BINARY_TBL ) return 0;
+  string key;
+  key = "PIXTYPE";
+  if ( is.KeyValue(key) != "HEALPIX")  return 0;
+
+  bool nosk = false;
+  key = "ORDERING";
+  is.KeyValue(key, nosk);
+  bool nosk2 = false;
+  key = "NSIDE";
+  is.KeyValue(key, nosk2);
+  if (nosk || nosk2) return 0;
+
+  vector<string> colnames; 
+  vector<int> coltypes;
+  vector<long> repcnt;
+  vector<long> width;
+  long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 
+  if (ncols < 1) return 0;
+  T x;
+  if (coltypes[0] == FitsTypes::DataType(x)) return 2 ;
+  else return 1;
+}
+
+template <class T>
+FitsHandlerInterface* FITS_SphereHEALPix<T>::Clone()
+{
+  return new FITS_SphereHEALPix<T>() ; 
+}
 
 
@@ -104,9 +145,12 @@
   dvl["Content"]= "SphereHEALPix";
   dvl.SetComment("Content", "name of SOPHYA object");
+  dvl["SOPCLSNM"]= "SOPHYA::SphereHEALPix<T>";
+  dvl.SetComment("SOPCLSNM", "SOPHYA class name");
   
   // On ecrit les dataBlocks 
   vector<string> Noms;   
   Noms.push_back(dvl.GetS("Content"));
-  string extname("SIMULATION");
+  //  string extname("SIMULATION");
+  string extname = os.NextExtensionName();
 
   string Type;
Index: /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h	(revision 2897)
@@ -27,4 +27,8 @@
 virtual AnyDataObj* DataObj();
 virtual void        SetDataObj(AnyDataObj & o);
+
+virtual int         CheckHandling(AnyDataObj & o) ;
+virtual int         CheckReadability(FitsInOutFile& is);
+virtual FitsHandlerInterface* Clone();
 
 void Mollweide_picture_projection(char flnm[]);
Index: /trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc	(revision 2897)
@@ -68,4 +68,41 @@
   ownobj_ = false;
 } 
+
+template <class T>
+int FITS_SphereThetaPhi<T>::CheckHandling(AnyDataObj & o)
+{
+  if ( typeid(o) == typeid( SphereThetaPhi< T > ) ) return 2;
+  SphereThetaPhi<T> * po = dynamic_cast< SphereThetaPhi<T> * >(&o);
+  if (po == NULL) return 0;
+  else return 1;
+}
+
+template <class T>
+int FITS_SphereThetaPhi<T>::CheckReadability(FitsInOutFile& is)
+{
+  if (is.CurrentHDUType() !=  BINARY_TBL ) return 0;
+  string key;
+  key = "PIXTYPE";
+  if ( is.KeyValue(key) != "TETAFI")  return 0;
+  key = "Content";
+  if ( is.KeyValue(key) != "SphereThetaPhi")  return 0;
+  
+  vector<string> colnames; 
+  vector<int> coltypes;
+  vector<long> repcnt;
+  vector<long> width;
+  long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 
+  if (ncols < 1) return 0;
+  T x;
+  if (coltypes[0] == FitsTypes::DataType(x)) return 2 ;
+  else return 1;
+}
+
+template <class T>
+FitsHandlerInterface* FITS_SphereThetaPhi<T>::Clone()
+{
+  return new FITS_SphereThetaPhi<T>() ; 
+}
+
 
 template <class T>
@@ -100,4 +137,6 @@
   dvl["Content"]= "SphereThetaPhi";
   dvl.SetComment("Content", "name of SOPHYA object");
+  dvl["SOPCLSNM"]= "SOPHYA::SphereThetaPhi<T>";
+  dvl.SetComment("SOPCLSNM", "SOPHYA class name");
   
   // On ecrit les dataBlocks 
@@ -116,6 +155,6 @@
   Noms[2] = "CumulPixParBande";
   Noms[3] = "ThetaBande";
-  string extname("SIMULATION");
-
+  //string extname("SIMULATION");
+  string extname = os.NextExtensionName();
 
   string Type;
Index: /trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.h	(revision 2896)
+++ /trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.h	(revision 2897)
@@ -26,4 +26,8 @@
 virtual AnyDataObj* DataObj();
 virtual void        SetDataObj(AnyDataObj & o);
+
+virtual int         CheckHandling(AnyDataObj & o) ;
+virtual int         CheckReadability(FitsInOutFile& is);
+virtual FitsHandlerInterface* Clone();
 
 void Mollweide_picture_projection(char flnm[]);
