Index: trunk/SophyaLib/BaseTools/objfio.h
===================================================================
--- trunk/SophyaLib/BaseTools/objfio.h	(revision 269)
+++ 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
