Index: trunk/SophyaExt/FitsIOServer/fabtwriter.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fabtwriter.cc	(revision 1654)
+++ trunk/SophyaExt/FitsIOServer/fabtwriter.cc	(revision 1657)
@@ -14,9 +14,9 @@
   FitsABTWriter fbtw("myfits.fits",BINARY_TBL,3);
   fbtw.SetExtName("MY_OWN_EXTENSION");
-  fbtw.AddCol("vars",TSHORT,"","km");      // col=0
-  fbtw.AddCol("vars2",TSHORT,"","km");     // col=1
-  fbtw.AddCol("varl",TLONG,"","Degre");    // col=2
-  fbtw.AddCol("varf",TFLOAT,"","");        // col=3
-  fbtw.AddCol("vard",TDOUBLE,"","arcmin"); // col=4
+  fbtw.AddCol("vars",TSHORT,"","km");       // col=0
+  fbtw.AddCol("vars2",TSHORT,"","km");      // col=1
+  fbtw.AddCol("varl",TINT32BIT,"","Degre"); // col=2
+  fbtw.AddCol("varf",TFLOAT,"","");         // col=3
+  fbtw.AddCol("vard",TDOUBLE,"","arcmin");  // col=4
   fbtw.SetDebug(3);
   for(long i=0;i<1000;i++) {
@@ -83,5 +83,5 @@
  }
 
- // create d'un Primary HDU */
+ // create d'un Primary HDU
  //long naxes[1] = {0};
  //if(fits_create_img(FitsPtr,BYTE_IMG,0,naxes,&sta)) {
@@ -105,5 +105,5 @@
   \verbatim
   label : column label
-  datatype : TSHORT TLONG TFLOAT or TDOUBLE
+  datatype : TSHORT TINT32BIT TFLOAT or TDOUBLE
   tform : fits tform definition
           (can be automatically set if BINARY_TBL and tform="")
@@ -117,5 +117,5 @@
     throw AllocationError("FitsABTWriter::addcol: table already created\n");
 
- if(  datatype!=TSHORT && datatype!=TLONG
+ if(  datatype!=TSHORT && datatype!=TINT32BIT
    && datatype!=TFLOAT && datatype!=TDOUBLE )
    throw ParmError("FitsABTWriter::addcol: datatype not allowed\n");
@@ -126,8 +126,8 @@
  if(HduType==BINARY_TBL && strlen(tform)<=0) {
    char str[16];
-   if(datatype==TSHORT)       strcpy(str,"1I");
-   else if(datatype==TLONG)   strcpy(str,"1J");
-   else if(datatype==TFLOAT)  strcpy(str,"1E");
-   else if(datatype==TDOUBLE) strcpy(str,"1D");
+   if(datatype==TSHORT)         strcpy(str,"1I");
+   else if(datatype==TINT32BIT) strcpy(str,"1J");
+   else if(datatype==TFLOAT)    strcpy(str,"1E");
+   else if(datatype==TDOUBLE)   strcpy(str,"1D");
    TForm.push_back(str);
  } else TForm.push_back(tform);
@@ -217,17 +217,17 @@
 {
   if(FirstTime) createtbl();
-  short x[1] = {val};
-  int sta=0;
-  if(fits_write_col(FitsPtr,TSHORT,col+1,row+1,1,1,x,&sta))
+  int sta=0;
+  if(fits_write_col(FitsPtr,TSHORT,col+1,row+1,1,1,&val,&sta))
     printerrorwrite("short",col,row,sta);
 }
 
 /*! Write long data to FITS file (see below) */
-void FitsABTWriter::Write(int col,long row,long val)
-{
-  if(FirstTime) createtbl();
-  long x[1] = {val};
-  int sta=0;
-  if(fits_write_col(FitsPtr,TLONG,col+1,row+1,1,1,x,&sta))
+void FitsABTWriter::Write(int col,long row,int_4 val)
+{
+  if(FirstTime) createtbl();
+  int sta=0;
+  // Bug ou inconsistence cfitsio sur machine ou long=8Bytes ?
+  int T = (sizeof(long)==4) ? TLONG: TINT;
+  if(fits_write_col(FitsPtr,T,col+1,row+1,1,1,&val,&sta))
     printerrorwrite("long",col,row,sta);
 }
@@ -237,7 +237,6 @@
 {
   if(FirstTime) createtbl();
-  float x[1] = {val};
-  int sta=0;
-  if(fits_write_col(FitsPtr,TFLOAT,col+1,row+1,1,1,x,&sta))
+  int sta=0;
+  if(fits_write_col(FitsPtr,TFLOAT,col+1,row+1,1,1,&val,&sta))
     printerrorwrite("float",col,row,sta);
 }
@@ -247,10 +246,55 @@
 {
   if(FirstTime) createtbl();
-  double x[1] = {val};
-  int sta=0;
-  if(fits_write_col(FitsPtr,TDOUBLE,col+1,row+1,1,1,x,&sta))
+  int sta=0;
+  if(fits_write_col(FitsPtr,TDOUBLE,col+1,row+1,1,1,&val,&sta))
     printerrorwrite("double",col,row,sta);
 }
 
+//////////////////////////////////////////////////////////////
+/*!
+  Write a vector of long data to FITS file.
+  \verbatim
+  col : column number [0,ncol[
+  row : starting row number    [0,nrow[
+  val : vector to be written
+  Return: number of the last written row (remember row=[0,nrow[)
+  \endverbatim
+*/
+/*! Write a vector of long data to FITS file (see below) */
+long FitsABTWriter::Write(int col,long row,TVector<int_4>& val)
+{
+  if(FirstTime) createtbl();
+  long nel = val.Size();
+  int sta=0;
+  // Bug ou inconsistence cfitsio sur machine ou long=8Bytes ?
+  int T = (sizeof(long)==4) ? TLONG: TINT;
+  if(fits_write_col(FitsPtr,T,col+1,row+1,1,nel,val.Data(),&sta))
+    printerrorwrite("long",col,row,sta);
+  return row+nel;
+}
+
+/*! Write a vector of float data to FITS file (see below) */
+long FitsABTWriter::Write(int col,long row,TVector<float>&  val)
+{
+  if(FirstTime) createtbl();
+  long nel = val.Size();
+  int sta=0;
+  if(fits_write_col(FitsPtr,TFLOAT,col+1,row+1,1,nel,val.Data(),&sta))
+    printerrorwrite("float",col,row,sta);
+  return row+nel;
+}
+
+/*! Write a vector of double data to FITS file (see below) */
+long FitsABTWriter::Write(int col,long row,TVector<double>& val)
+{
+  if(FirstTime) createtbl();
+  long nel = val.Size();
+  int sta=0;
+  if(fits_write_col(FitsPtr,TDOUBLE,col+1,row+1,1,nel,val.Data(),&sta))
+    printerrorwrite("double",col,row,sta);
+  return row+nel;
+}
+
+//////////////////////////////////////////////////////////////
 void FitsABTWriter::printerrorwrite(char* type,int col,long row,int sta)
 {
