Index: trunk/SophyaExt/FitsIOServer/fitsxntuple.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsxntuple.cc	(revision 1499)
+++ trunk/SophyaExt/FitsIOServer/fitsxntuple.cc	(revision 2197)
@@ -86,15 +86,44 @@
   for (k=0; k<nbcols;k++)
     {
+
       FitsFile::FitsDataType ss= is.ColTypeFromFits(k);
-      if (ss == FitsFile::FitsDataType_double) DfitsCol.push_back(k);
-      else if (ss == FitsFile::FitsDataType_float) FfitsCol.push_back(k);
-      else if (ss == FitsFile::FitsDataType_int) IfitsCol.push_back(k);
-      else if (ss == FitsFile::FitsDataType_long) IfitsCol.push_back(k);
-      else if (ss == FitsFile::FitsDataType_byte) IfitsCol.push_back(k);
-      else if (ss == FitsFile::FitsDataType_char) SfitsCol.push_back(k);
-      else {
-	cout << " FITS_XNTuple: colonne fits " << k << " type= " << (int) ss << endl;
-	throw  IOExc("type de champ inconnu");
-      }
+      switch (ss) 
+	{
+	case  FitsFile::FitsDataType_double :
+	  {
+	    DfitsCol.push_back(k);
+	    break;
+	  }
+	case FitsFile::FitsDataType_float :
+	  {
+	    FfitsCol.push_back(k);
+	    break;
+	  }
+	case FitsFile::FitsDataType_int :
+	  {
+	    IfitsCol.push_back(k);
+	    break;
+	  }
+	case FitsFile::FitsDataType_long :
+	  {
+	    IfitsCol.push_back(k);
+	    break;
+	  }
+	case FitsFile::FitsDataType_byte :
+	  {
+	    IfitsCol.push_back(k);
+	    break;
+	  }
+	case FitsFile::FitsDataType_char :
+	  {
+	    SfitsCol.push_back(k);
+	    break;
+	  }
+	default :
+	  {
+	    cout << " FITS_XNTuple: colonne fits " << k << " type= " << (int) ss << endl;
+	    throw  IOExc("type de champ inconnu");
+	  }
+	}
     }
   char ** ColName = new char*[nbcols];
@@ -143,5 +172,5 @@
 	  if (ND != dobj_->NDVar() || NF != dobj_->NFVar() ||  NI != dobj_->NIVar() || NS != dobj_->NSVar())
 	    {
-	      cout << " WARNING : FITS_XNTuple : XNTuple reconfigured " << endl;
+	      //	      cout << " WARNING : FITS_XNTuple : XNTuple reconfigured " << endl;
 	      (*dobj_)= XNTuple(ND, NF, NI, NS,ColName);
 	    }
@@ -155,7 +184,7 @@
   delete [] ColName;
 
-    double* dligne;
-    float* fligne;
-    int* iligne;
+    r_8* dligne;
+    r_4* fligne;
+    int_4* iligne;
     char** cligne;
 
@@ -188,6 +217,62 @@
   for (numLigne=firstln; numLigne < lastln; numLigne++)
     {
-      is.GetBinTabLine(numLigne, dligne, fligne, iligne, cligne );
-      dobj_->Fill((r_8*)dligne, (r_4*)fligne, (int_4*)iligne, cligne);    
+      const FitsFile::BufferLine& bfligne = is.GetBufferLine(numLigne);
+      int k;
+      int rang;
+      int dcount =0;
+      int fcount =0;
+      int icount =0;
+      int ccount = 0;
+      for (k=0; k<nbcols;k++)
+	{
+	  rang = bfligne.identificateur()[k].second;
+	  switch (bfligne.identificateur()[k].first)
+	    {
+	    case  FitsFile::FitsDataType_double :
+	      {
+		dligne[dcount++] =  bfligne.r_8Array(rang);
+		break;
+	      }
+	    case  FitsFile::FitsDataType_float :
+	      {
+		fligne[fcount++] =  bfligne.r_4Array(rang);
+		break;
+	      }
+	    case  FitsFile::FitsDataType_short :
+	      {
+		iligne[icount++] =  bfligne.int_2Array(rang);
+		break;
+	      }
+	    case  FitsFile::FitsDataType_int :
+	      {
+		iligne[icount++] =  bfligne.int_4Array(rang);
+		break;
+	      }
+	    case  FitsFile::FitsDataType_long :
+	      {
+		iligne[icount++] =  (int_4)bfligne.int_8Array(rang);
+		break;
+	      }
+	    case  FitsFile::FitsDataType_byte :
+	      {
+		iligne[icount++] =  (int_4)bfligne.u_charArray(rang);
+		break;
+	      }
+	    case FitsFile::FitsDataType_char :
+	      {
+		strncpy( cligne[ccount++], bfligne.stringArray(rang).c_str(),bfligne.stringArray(rang).length());
+		break;
+	      }
+
+	    default:
+	      {  
+		throw PException(" FITS_XNTuple::ReadFromFits : unsupported FITS data type");
+	      }
+	    }
+	
+	}
+      //      is.GetBinTabLine(numLigne, dligne, fligne, iligne, cligne );
+      //      dobj_->Fill((r_8*)dligne, (r_4*)fligne, (int_4*)iligne, cligne);    
+      dobj_->Fill(dligne, fligne, iligne, cligne);    
     }
     delete [] dligne;
@@ -234,5 +319,5 @@
   for (k=0; k<dobj_->NIVar();k++)
     {
-      types+='I';
+      types+='J';
     }
   for (k=0; k<dobj_->NSVar();k++)
@@ -277,4 +362,7 @@
 	 {
 	   for(int j = 0; j < nrows; j++) icolumn[j]= dobj_->GetIVal(j,compt);
+	   cout << " fitsx.. va ecrire la colonne " << endl;
+	   for(int j = 0; j < nrows; j++) cout << icolumn[j] << endl;;
+
 	   os.PutColToFits(compt, nrows, icolumn);
 	   compt++;
