Index: trunk/SophyaLib/BaseTools/ndatablock.cc
===================================================================
--- trunk/SophyaLib/BaseTools/ndatablock.cc	(revision 268)
+++ trunk/SophyaLib/BaseTools/ndatablock.cc	(revision 269)
@@ -9,4 +9,5 @@
 #include "pexceptions.h"
 #include "ndatablock.h"
+#include "objfio.h"
 
 using namespace PlanckDPC;
@@ -245,4 +246,6 @@
 // Re-dimension, dans ce cas re-allocation de la place
 {
+// Pas de realloc, si pas de changement de taille ?
+if (n == mSz)  return;  // $CHECK$ A verifier , Reza 26/04/99
 Alloc(n);
 }
@@ -275,5 +278,5 @@
 if(i1>=mSz || n<=0 || !p) return;
 size_t i2 = i1+n; if(i2>mSz) i2=mSz;
-size_t im = 1; bool enl;
+size_t im = 1; bool enl=false;
 while(i1<i2) {
   enl = false;
@@ -561,4 +564,82 @@
 }
 return result;
+}
+
+
+// -------------------------------------------------------------------------
+//   Les objets delegues pour la gestion de persistance 
+// -------------------------------------------------------------------------
+
+/*
+template <class T>
+void ObjFileIO< NDataBlock<T> >::ReadSelf(PInPersist& is)
+template <class T>
+void ObjFileIO< NDataBlock<T> >::WriteSelf(POutPersist& os)
+*/
+
+template <class T>
+FIO_NDataBlock<T>::FIO_NDataBlock()
+{
+dobj=new NDataBlock<T>;
+}
+
+template <class T>
+FIO_NDataBlock<T>::FIO_NDataBlock(string const & filename) 
+{
+dobj=new NDataBlock<T>; 
+Read(filename);
+}
+
+template <class T>
+FIO_NDataBlock<T>::FIO_NDataBlock(const NDataBlock<T> & obj) 
+{ 
+dobj = new NDataBlock<T>(obj); 
+}
+
+template <class T>
+FIO_NDataBlock<T>::FIO_NDataBlock(const NDataBlock<T> * obj) 
+{ 
+dobj = new NDataBlock<T>(*obj); 
+}
+
+template <class T>
+FIO_NDataBlock<T>::~FIO_NDataBlock()
+{
+if (dobj) delete dobj;
+}
+
+template <class T>
+AnyDataObj* FIO_NDataBlock<T>::DataObj()
+{
+return(dobj);
+}
+
+
+template <class T>
+void FIO_NDataBlock<T>::ReadSelf(PInPersist& is)
+{
+// On lit les 3 premiers uint_8
+uint_8 itab[3];
+is.Get(itab, 3);
+if (dobj == NULL) dobj = new NDataBlock<T>(itab[1]);
+else dobj->ReSize(itab[1]);
+// On lit le tableau de nombres
+PIOSReadArray(is, dobj->Data(), dobj->Size()); 
+}
+
+
+template <class T>
+void FIO_NDataBlock<T>::WriteSelf(POutPersist& os) const
+{
+if (dobj == NULL)   return;  // Attention - $CHECK$ Reza 26/04/99
+//  On ecrit 3 uint_4 
+//  0 : Numero de version,  1 : Taille,  2  reserve a l
+uint_8 itab[3];
+itab[0] = 1;
+itab[1] = dobj->Size();
+itab[2] = 0;
+os.Put(itab, 3);
+//  On ecrit le tableau de nombres 
+PIOSWriteArray(os, dobj->Data(), dobj->Size()); 
 }
 
@@ -577,7 +658,23 @@
 #pragma define_template NDataBlock< complex<float> >
 #pragma define_template NDataBlock< complex<double> >
-#endif
-
-#ifdef __GNU_TEMPLATES__
+
+// Instances des delegues FileIO (PPersist)
+#pragma define_template FIO_NDataBlock<uint_1>;
+#pragma define_template FIO_NDataBlock<uint_2>;
+#pragma define_template FIO_NDataBlock<int_2>;
+#pragma define_template FIO_NDataBlock<int_4>;
+#pragma define_template FIO_NDataBlock<int_8>;
+#pragma define_template FIO_NDataBlock<uint_2>;
+#pragma define_template FIO_NDataBlock<uint_4>;
+#pragma define_template FIO_NDataBlock<uint_8>;
+#pragma define_template FIO_NDataBlock<r_8>;
+#pragma define_template FIO_NDataBlock<r_4>;
+#pragma define_template FIO_NDataBlock< complex<float> >;
+#pragma define_template FIO_NDataBlock< complex<double> >;
+
+#endif
+
+
+#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
 template class NDataBlock<uint_1>;
 template class NDataBlock<uint_2>;
@@ -592,18 +689,17 @@
 template class NDataBlock< complex<float> >;
 template class NDataBlock< complex<double> >;
-#endif
-
-#if defined(__ANSI_TEMPLATES__) 
-template class NDataBlock<uint_1>;
-template class NDataBlock<uint_2>;
-template class NDataBlock<int_2>;
-template class NDataBlock<int_4>;
-template class NDataBlock<int_8>;
-template class NDataBlock<uint_2>;
-template class NDataBlock<uint_4>;
-template class NDataBlock<uint_8>;
-template class NDataBlock<r_4>;
-template class NDataBlock<r_8>;
-template class NDataBlock< complex<float> >;
-template class NDataBlock< complex<double> >;
-#endif
+
+// Instances des delegues FileIO (PPersist)
+template class FIO_NDataBlock<uint_1>;
+template class FIO_NDataBlock<uint_2>;
+template class FIO_NDataBlock<int_2>;
+template class FIO_NDataBlock<int_4>;
+template class FIO_NDataBlock<int_8>;
+template class FIO_NDataBlock<uint_2>;
+template class FIO_NDataBlock<uint_4>;
+template class FIO_NDataBlock<uint_8>;
+template class FIO_NDataBlock<r_8>;
+template class FIO_NDataBlock<r_4>;
+template class FIO_NDataBlock< complex<float> >;
+template class FIO_NDataBlock< complex<double> >;
+#endif
