Index: trunk/SophyaLib/BaseTools/ndatablock.cc
===================================================================
--- trunk/SophyaLib/BaseTools/ndatablock.cc	(revision 275)
+++ trunk/SophyaLib/BaseTools/ndatablock.cc	(revision 277)
@@ -608,8 +608,13 @@
 */
 
+// Pour pouvoir ecrire des tableaux de complex, en attendant 
+// PIn/POutPersist::Get/Put(complex<>)
+#include <piocmplx.h>
+
 template <class T>
 FIO_NDataBlock<T>::FIO_NDataBlock()
 {
 dobj=new NDataBlock<T>;
+ownobj=true;
 }
 
@@ -617,5 +622,6 @@
 FIO_NDataBlock<T>::FIO_NDataBlock(string const & filename) 
 {
-dobj=new NDataBlock<T>; 
+dobj=new NDataBlock<T>;
+ownobj=true; 
 Read(filename);
 }
@@ -624,11 +630,13 @@
 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);
+ownobj=true; 
+}
+
+template <class T>
+FIO_NDataBlock<T>::FIO_NDataBlock(NDataBlock<T> * obj) 
 { 
-dobj = new NDataBlock<T>(*obj); 
+dobj = obj;
+ownobj=false; 
 }
 
@@ -636,5 +644,5 @@
 FIO_NDataBlock<T>::~FIO_NDataBlock()
 {
-if (dobj) delete dobj;
+if (ownobj && dobj) delete dobj;
 }
 
@@ -653,5 +661,5 @@
 is.Get(itab, 3);
 if (dobj == NULL) dobj = new NDataBlock<T>(itab[1]);
-else dobj->ReSize(itab[1]);
+else dobj->ReSize(itab[1], false);
 // On lit le tableau de nombres
 PIOSReadArray(is, dobj->Data(), dobj->Size()); 
@@ -681,5 +689,4 @@
 #pragma define_template NDataBlock<int_4>
 #pragma define_template NDataBlock<int_8>
-#pragma define_template NDataBlock<uint_2>
 #pragma define_template NDataBlock<uint_4>
 #pragma define_template NDataBlock<uint_8>
@@ -694,5 +701,4 @@
 #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>
@@ -710,5 +716,4 @@
 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>;
@@ -723,5 +728,4 @@
 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>;
Index: trunk/SophyaLib/BaseTools/ndatablock.h
===================================================================
--- trunk/SophyaLib/BaseTools/ndatablock.h	(revision 275)
+++ trunk/SophyaLib/BaseTools/ndatablock.h	(revision 277)
@@ -159,5 +159,5 @@
 	    FIO_NDataBlock(string const & filename); 
 	    FIO_NDataBlock(const NDataBlock<T> & obj);
-	    FIO_NDataBlock(const NDataBlock<T> * obj);
+	    FIO_NDataBlock(NDataBlock<T> * obj);
   virtual   ~FIO_NDataBlock();
 
@@ -169,5 +169,5 @@
   virtual void       WriteSelf(POutPersist&) const;  
   NDataBlock<T> * dobj;
-
+  bool ownobj;
 };
 
Index: trunk/SophyaLib/BaseTools/objfio.h
===================================================================
--- trunk/SophyaLib/BaseTools/objfio.h	(revision 275)
+++ trunk/SophyaLib/BaseTools/objfio.h	(revision 277)
@@ -13,12 +13,4 @@
 namespace PlanckDPC {
 
-  /*
-// Pour gerer les Persist I/O de tableaux numerique templates
-template <class T>
-void PIOSReadArray(PInPersist & is, T* arr, size_t n);
-template <class T>
-void PIOSWriteArray(POutPersist & os, T const * arr, size_t n);
-  */
-
 
 template <class T>
@@ -26,9 +18,10 @@
 
 public :
-	    ObjFileIO() { dobj=new T; }
-	    ObjFileIO(string const & filename) { dobj=new T; Read(filename); }
-	    ObjFileIO(const T & obj) { dobj = new T(obj); }
-	    ObjFileIO(const T * obj) { dobj = new T(*obj); }
-  virtual   ~ObjFileIO() { if (dobj) delete dobj; }
+	    ObjFileIO() { dobj=new T; ownobj=true; }
+	    ObjFileIO(string const & filename) 
+                        { dobj=new T; ownobj=true; Read(filename); }
+	    ObjFileIO(const T & obj) { dobj = new T(obj); ownobj=true; }
+	    ObjFileIO(T * obj) { dobj = obj; ownobj=false; }
+  virtual   ~ObjFileIO() { if (ownobj && dobj) delete dobj; }
 
   virtual   AnyDataObj* DataObj() { return(dobj); }
@@ -40,143 +33,17 @@
 
   T * dobj;
+  bool ownobj;       // True si dobj obtenu par new
 };
 
-// Fonctions d'ecriture de tableaux numeriques
-inline
-void PIOSReadArray(PInPersist & is, uint_1 * arr, size_t n)
-{
-is.GetBytes(arr, n);
-}
+/*
+template <class T>
+inline POutPersist& operator << (POutPersist& os, T const & obj)
+{ ObjFileIO<T> fio((const_cast)&obj);  fio.Write(os);  return(os); } 
 
-inline
-void PIOSReadArray(PInPersist & is, uint_2 * arr, size_t n)
-{
-is.Get(arr, n);
-}
+template <class T>
+inline PInPersist& operator >> (PInPersist& is, T & obj)
+{ ObjFileIO<T> fio(&obj);  fio.Read(is);  return(is); }  
+*/
 
-inline
-void PIOSReadArray(PInPersist & is, int_2 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, uint_4 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, int_4 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, uint_8 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, int_8 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, r_4 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, r_8 * arr, size_t n)
-{
-is.Get(arr, n);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, complex<float> * arr, size_t n)
-{
-r_4 * pr = (r_4 *)arr;
-is.Get(pr, n*2);
-}
-
-inline
-void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n)
-{
-r_8 * pr = (r_8 *)arr;
-is.Get(pr, n*2);
-}
-
-// Fonctions d ecriture de tableaux de nombre
-inline
-void PIOSWriteArray(POutPersist & os, uint_1 const * arr, size_t n)
-{
-os.PutBytes(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, uint_2 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, int_2 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, uint_4 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, int_4 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, uint_8 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, int_8 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, r_4 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, r_8 const * arr, size_t n)
-{
-os.Put(arr, n);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, complex<float> const * arr, size_t n)
-{
-r_4 const * pr = (r_4 const *)arr;
-os.Put(pr, n*2);
-}
-
-inline
-void PIOSWriteArray(POutPersist & os, complex<double> const * arr, size_t n)
-{
-r_8 const * pr = (r_8 const *)arr;
-os.Put(pr, n*2);
-}
 
 } // Fin namespace
Index: trunk/SophyaLib/BaseTools/peidainit.cc
===================================================================
--- trunk/SophyaLib/BaseTools/peidainit.cc	(revision 275)
+++ trunk/SophyaLib/BaseTools/peidainit.cc	(revision 277)
@@ -5,4 +5,7 @@
 #include "ppersist.h"
 #include "peidainit.h"
+#include "ndatablock.h"
+#include "complex"
+
 // ---  Classe d'initialisation de PEIDA++, (PPersistMgr en particulier)
 int PeidaInitiator::FgInit = 0;
@@ -24,4 +27,16 @@
 
   PIOPersist::Initialize();
+  PPRegister(FIO_NDataBlock<uint_1>);
+  PPRegister(FIO_NDataBlock<uint_2>);
+  PPRegister(FIO_NDataBlock<int_2>);
+  PPRegister(FIO_NDataBlock<int_4>);
+  PPRegister(FIO_NDataBlock<int_8>);
+  PPRegister(FIO_NDataBlock<uint_4>);
+  PPRegister(FIO_NDataBlock<uint_8>);
+  PPRegister(FIO_NDataBlock<r_4>);
+  PPRegister(FIO_NDataBlock<r_4>);
+  PPRegister(FIO_NDataBlock< complex<float> >);
+  PPRegister(FIO_NDataBlock< complex<double> >);
+
 //DEL  PPersistMgr::classList = new PPersistMgr::ClassList;
 //DEL  PShPersist::objList    = new PShPersist::ObjList;
Index: trunk/SophyaLib/BaseTools/piocmplx.h
===================================================================
--- trunk/SophyaLib/BaseTools/piocmplx.h	(revision 277)
+++ trunk/SophyaLib/BaseTools/piocmplx.h	(revision 277)
@@ -0,0 +1,154 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Fonctions d'ecriture de tableaux numeriques
+#ifndef PIOCMPLX_H_SEEN
+#define PIOCMPLX_H_SEEN
+
+/*
+// Pour gerer les Persist I/O de tableaux numerique templates
+template <class T>
+void PIOSReadArray(PInPersist & is, T* arr, size_t n);
+template <class T>
+void PIOSWriteArray(POutPersist & os, T const * arr, size_t n);
+*/
+
+// Pour pouvoir ecrire des tableau de complex, en attendant 
+// PIn/POutPersist::Get/Put(complex<>)
+
+inline
+void PIOSReadArray(PInPersist & is, uint_1 * arr, size_t n)
+{
+is.GetBytes(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, uint_2 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, int_2 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, uint_4 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, int_4 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, uint_8 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, int_8 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, r_4 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, r_8 * arr, size_t n)
+{
+is.Get(arr, n);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, complex<float> * arr, size_t n)
+{
+r_4 * pr = (r_4 *)arr;
+is.Get(pr, n*2);
+}
+
+inline
+void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n)
+{
+r_8 * pr = (r_8 *)arr;
+is.Get(pr, n*2);
+}
+
+// Fonctions d ecriture de tableaux de nombre
+inline
+void PIOSWriteArray(POutPersist & os, uint_1 const * arr, size_t n)
+{
+os.PutBytes(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, uint_2 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, int_2 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, uint_4 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, int_4 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, uint_8 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, int_8 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, r_4 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, r_8 const * arr, size_t n)
+{
+os.Put(arr, n);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, complex<float> const * arr, size_t n)
+{
+r_4 const * pr = (r_4 const *)arr;
+os.Put(pr, n*2);
+}
+
+inline
+void PIOSWriteArray(POutPersist & os, complex<double> const * arr, size_t n)
+{
+r_8 const * pr = (r_8 const *)arr;
+os.Put(pr, n*2);
+}
+
+#endif
