Index: trunk/SophyaPI/PIext/basexecut.cc
===================================================================
--- trunk/SophyaPI/PIext/basexecut.cc	(revision 294)
+++ trunk/SophyaPI/PIext/basexecut.cc	(revision 295)
@@ -195,10 +195,11 @@
 
 // >>>>>>>>>>>  Affichage des objets 
-else if ( (kw == "disp") || (kw == "surf") ) {
-  if (tokens.size() < 1) { cout << "Usage: disp/surf nameobj [opt]" << endl; return(0); }
+else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
+  if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
   string opt = "n";
   if (tokens.size() > 1)  opt = tokens[1];
   if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
   else if (kw == "surf")  mObjMgr->DisplaySurf3D(tokens[0], opt);
+  else if (kw == "imag")  mObjMgr->DisplayImage(tokens[0], opt);
   }
 
@@ -478,4 +479,8 @@
 mpiac->RegisterCommand(kw, usage, this);
 
+kw = "listobjs";
+usage = "Prints the list of objects";
+usage += "\n Usage: listobjs";
+mpiac->RegisterCommand(kw, usage, this);
 kw = "rename";
 usage = "Rename an object \n Usage: rename nameobj namenew";
@@ -512,4 +517,8 @@
 usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
 usage += "\n  Related commands: surf nt2d nt3d ";  
+mpiac->RegisterCommand(kw, usage, this);
+kw = "imag";
+usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
+usage += "\n  Related commands: disp surf nt2d nt3d ";  
 mpiac->RegisterCommand(kw, usage, this);
 kw = "surf";
Index: trunk/SophyaPI/PIext/dlftypes.h
===================================================================
--- trunk/SophyaPI/PIext/dlftypes.h	(revision 294)
+++ trunk/SophyaPI/PIext/dlftypes.h	(revision 295)
@@ -16,5 +16,5 @@
 typedef double (* DlFunctionOfX) (double x);
 typedef double (* DlFunctionOfXY) (double x, double y);
-typedef int (* PlotExprFunc) (float* x, float* rx, float* ry, float* rz, float* wt);
+typedef int (* PlotExprFunc) (double* x, double* rx, double* ry, double* rz, double* wt);
 typedef void (* DlUserProcFunction) (vector<string>& args);
 typedef void (* DlFunction) ();
Index: trunk/SophyaPI/PIext/nobjmgr.cc
===================================================================
--- trunk/SophyaPI/PIext/nobjmgr.cc	(revision 294)
+++ trunk/SophyaPI/PIext/nobjmgr.cc	(revision 295)
@@ -3,4 +3,5 @@
 #include <ctype.h>
 
+#include <typeinfo>
 #include <iostream.h>
 #include <string>
@@ -20,7 +21,4 @@
 #include "pistdimgapp.h"
 
-#include "pclassids.h"
-#include "poly.h"
-#include "dvlist.h"
 #include "matrix.h"
 #include "cvector.h"
@@ -29,5 +27,4 @@
 #ifdef SANS_EVOLPLANCK
 #include "fitsimage.h"  
-#include "zfidu.h"  
 #endif
 
@@ -35,21 +32,14 @@
 #include "fct2dfit.h"
 
-#include "pimgadapter.h"
+#include "pisurfdr.h"
 #include "pipodrw.h"
-
 #include "pihisto.h"
 #include "hisprof.h"
 #include "pihisto2d.h"
 #include "pintuple.h"
-#include "pisurfdr.h"  
 #include "pintup3d.h"
 #include "pigfd1.h"
 #include "pigfd2.h"
 
-//  Si le module StarReco++ a ete compile (Pour les StarList, Transfo, etc ...
-#ifdef SANS_EVOLPLANCK 
-#include "pistlist.h"
-#include "transfo.h"
-#endif
 
 //++
@@ -74,5 +64,6 @@
 // ......  Gestion des objets nommes, variables globales ............
 struct nobj_item {
-  PPersist* obj;
+  AnyDataObj* obj;
+  NObjMgrAdapter* obja;
   int num;
   list<int> wrsid;
@@ -162,5 +153,5 @@
 //--
 //++
-// void AddObj(PPersist* obj, string& nom)
+// void AddObj(AnyDataObj* obj, string& nom)
 //	Ajoute l'objet "obj" à la liste, identifié par "nom".
 //	Si un objet de même nom existe, l'ancien objet est renommé en concaténant 
@@ -171,5 +162,5 @@
 //	Supprime l'ensemble des objets dont le nom correspond au patron "patt".
 //	Le patron peut contenir les caractères "*" et "?" . Les objets sont détruits si "fgd==true"
-// PPersist*  GetObj(string const& nom) 
+// AnyDataObj*  GetObj(string const& nom) 
 //	Retourne l'objet identifié par "nom" dans la liste. Retourne "NULL" si "nom" n'est 
 //	pas dans la liste.
@@ -182,5 +173,5 @@
 
 /* --Methode-- */
-void NamedObjMgr::AddObj(PPersist* obj, string& nom)
+void NamedObjMgr::AddObj(AnyDataObj* obj, string& nom, bool)
 {
 
@@ -198,5 +189,5 @@
 
 myNObj++;
-if (nom.length() < 1) nom = servnobjm->PClassIdToShortClassName(obj->ClassId());
+if (nom.length() < 1) nom = typeid(*obj).name();
 NObjList::iterator it = myObjs->find(nom);
 if (it != myObjs->end()) { // l'objet existe deja
@@ -210,13 +201,14 @@
 nobj_item no;
 no.obj = obj;
+no.obja = servnobjm->GetAdapter(obj);  // L'adaptateur
 no.num =  myNObj;
 (*myObjs)[(*lastobj)] = no;
 if (myImgApp)  { 
-  string str = (*lastobj) + "    (T= " + servnobjm->PClassIdToClassName(obj->ClassId()) + ")" ;
+  string str = (*lastobj) + "    (T= " + typeid(*obj).name() + ")" ;
   (myImgApp->ObjMgrW())->AddObj(str.c_str(), myNObj+1000);
 }
  
 cout << "NamedObjMgr::AddObj()  Object " << (*lastobj) << " ( "  
-     << servnobjm->PClassIdToClassName(obj->ClassId()) << " ) added (Total= " << myObjs->size() << ")" << endl;  
+     << typeid(*obj).name() << " ) added (Total= " << myObjs->size() << ")" << endl;  
 return;
 }
@@ -234,4 +226,5 @@
   (myImgApp->ObjMgrW())->DelObj((*it).second.num+1000);
 }
+delete (*it).second.obj;  // destruction de l'adaptateur 
 if (fgd) delete (*it).second.obj;
 myObjs->erase(it);
@@ -256,5 +249,5 @@
 
 /* --Methode-- */
-PPersist* NamedObjMgr::GetObj(string const& nom)
+AnyDataObj* NamedObjMgr::GetObj(string const& nom)
 {
 NObjList::iterator it = myObjs->find(nom);
@@ -264,7 +257,15 @@
 
 /* --Methode-- */
+NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string const& nom)
+{
+NObjList::iterator it = myObjs->find(nom);
+if (it == myObjs->end()) return(NULL); 
+return((*it).second.obja);
+}
+
+/* --Methode-- */
 void NamedObjMgr::RenameObj(string const& nom, string& nomnew)
 {
-PPersist* obj = GetObj(nom);
+AnyDataObj* obj = GetObj(nom);
 if (obj == NULL) return;
 DelObj(nom, false);
@@ -309,5 +310,5 @@
 if (!ok)  return;
 if (nobj.length()<1)  nobj = servnobjm->FileName2Name(flnm);
-AddObj(obj, nobj);
+AddObj(obj->DataObj(), nobj);
 return;
 }
@@ -336,5 +337,5 @@
   if (!ok)  return;
   nom = "";
-  AddObj(obj, nom);
+  AddObj(obj->DataObj(), nom);
 }
  
@@ -353,5 +354,5 @@
     ok = false; 
   } ENDTRY;
-  if (ok)  AddObj(obj, nom);  
+  if (ok)  AddObj(obj->DataObj(), nom);  
 }
 
@@ -376,5 +377,5 @@
 if (obj) {
   string nom = servnobjm->FileName2Name(flnm);
-  AddObj(obj, nom);
+  AddObj(obj->DataObj(), nom);
   }
 else ReadObj((*ppin), -1);
@@ -404,5 +405,5 @@
 if (ok) { 
   if (nobj.length()<1)  nobj = servnobjm->FileName2Name(flnm);
-  AddObj((PPersist*)obj, nobj);
+  AddObj((AnyDataObj*)obj, nobj);
 }
 return;
@@ -414,12 +415,10 @@
 void NamedObjMgr::SaveObj(string const& nom, POutPersist& s)
 {
-PPersist* obj=NULL;
-obj = GetObj(nom);
-if (obj == NULL)  return;
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL)  return;
 printf("NamedObjMgr::SaveObj(%s, )  (Type=%s) \n",  
-       nom.c_str(), servnobjm->PClassIdToClassName(obj->ClassId()));
-string nm = nom;  // A cause de const 
-obj->Write(s,  key_for_write, nm);
-key_for_write++;
+       nom.c_str(), typeid(*(obja->GetDataObj())).name());
+obja->SavePPF(s, nom);
 return; 
 }
@@ -446,59 +445,8 @@
 void NamedObjMgr::SaveFits(string const& nom, string const & flnm)
 {
-
-#ifndef SANS_EVOLPLANCK 
-printf("NamedObjMgr::SaveFITS( NON-Disponible EVOL-PLANCK) \n"); 
-return;
-
-#else
-
-PPersist* obj=NULL;
-obj = GetObj(nom);
-if (obj == NULL)  return;
-int cid = obj->ClassId();
-if ( (cid < ClassId_Image) && ( cid > ClassId_Image+kr_8) ) {
-  printf("NamedObjMgr::SaveFits(%s, ) Error - Object is NOT an image (type=%s) \n",
-         nom.c_str(), servnobjm->PClassIdToClassName(obj->ClassId()) );
-  return;
-}
-
-RzImage* pim = (RzImage*)obj;
-TRY { 
-  switch (pim->PixelType()) {
-    case kuint_2:
-      {
-      FitsImageU2 imgfits(*pim);
-      imgfits.Save(flnm); 
-      }
-    break;
-    case kint_2:
-      {
-      FitsImageI2 imgfits(*pim);
-      imgfits.Save(flnm); 
-      }
-      break;
-    case kint_4:
-      {
-      FitsImageI4 imgfits(*pim);
-      imgfits.Save(flnm); 
-      }
-      break;
-    case kr_4:
-      {
-      FitsImageR4 imgfits(*pim);
-      imgfits.Save(flnm); 
-      }
-      break;
-    default :
-      printf("NamedObjMgr::SaveObj()/Error Type d'image (%d) NON supporte en FITS \n", 
-             (int)pim->PixelType());
-      break;
-  }
-}  CATCH(merr) { 
-  printf("NamedObjMgr::SaveObj()/Error Exception= %ld (%s) \n", (long)merr, PeidaExc(merr));
-} ENDTRY;
-
-#endif
-
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL)  return;
+obja->SaveFits(flnm);
 return;
 }
@@ -509,8 +457,7 @@
 {
 int k;
-PPersist* obj=NULL;
+AnyDataObj* obj=NULL;
 string ctyp;
 char strg[256];
-int cid;
 
 cout << "NamedObjMgr::ListObjs() NObjs= " << myObjs->size() << "\n" ;
@@ -519,7 +466,6 @@
   obj = (*it).second.obj;
 
-  cid = obj->ClassId();
-  ctyp = servnobjm->PClassIdToClassName(cid);
-  sprintf(strg, "%2d/ %16s : %s", k, servnobjm->PClassIdToClassName(obj->ClassId()), ((*it).first).c_str()); 
+  ctyp = typeid(*obj).name();
+  sprintf(strg, "%2d/ %16s : %s", k, typeid(*obj).name(), ((*it).first).c_str()); 
   ctyp = strg;
   cout << ctyp << "\n" ;
@@ -533,98 +479,12 @@
 void NamedObjMgr::PrintObj(string const& nom)
 {
-PPersist* obj=GetObj(nom);
-if (obj == NULL) {
-  cout << "NamedObjMgr::PrintObj() Error , Pas d'objet de nom " << nom << endl; 
-  return;
-}
-
-int cid = obj->ClassId();
-string ctyp = servnobjm->PClassIdToClassName(cid);
-
-cout << "NamedObjMgr::PrintObj(" << nom << ") Type: " << ctyp 
-     << "Cid= " << cid << ")" << endl;
-
-int i4dum;
-switch (cid) {
-  case ClassId_Poly1 : 
-    ((Poly*)obj)->Print(cout);
-    break;
-  case ClassId_Poly2 : 
-    ((Poly2*)obj)->Print(cout);
-    break;
-  case ClassId_Matrix : 
-  case ClassId_Vector : 
-    cout << *((Matrix*)obj);
-    break;
-
-  case ClassId_DVList : 
-    ((DVList*)obj)->Print();
-    break;
-
-  case ClassId_Histo1D : 
-    ((Histo*)obj)->Print(60);
-    break;
-  case ClassId_Histo2D : 
-    ((Histo2D*)obj)->Print();
-    break;
-  case ClassId_HProf : 
-    ((HProf*)obj)->Print(60);
-    break;
-  case ClassId_NTuple : 
-    cout << ((NTuple*)obj)->Info();
-    cout << *((NTuple*)obj);
-    break;
-  case ClassId_GeneralFitData : 
-    ((GeneralFitData*)obj)->PrintStatus();
-    i4dum = ((GeneralFitData*)obj)->NData();
-    if(i4dum>0) {
-      ((GeneralFitData*)obj)->PrintData(0);
-      ((GeneralFitData*)obj)->PrintData(i4dum-1);
-    }
-    break;
-
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 : 
-  case ClassId_Image + kint_1 : 
-  case ClassId_Image + kuint_2 : 
-  case ClassId_Image + kint_2 : 
-  case ClassId_Image + kuint_4 : 
-  case ClassId_Image + kint_4 : 
-  case ClassId_Image + kr_4 : 
-  case ClassId_Image + kr_8 : 
-    ((RzImage*)obj)->Print();
-    break;
-
-#ifdef SANS_EVOLPLANCK 
-  case ClassId_ZFidu : 
-    ((ZFidu*)obj)->Print();
-    break;
-
-  case ClassId_StarList : 
-    ((StarList*)obj)->Print(10, 1, 50);
-    break;
-  case ClassId_Transfo : 
-    ((Transfo*)obj)->Print(cout);
-    break;
-  case ClassId_PSF : 
-    break;
-
-  case ClassId_Star + BStar_Type : 
-  case ClassId_Star + RzStar_Type : 
-  case ClassId_Star + PSFStar_Type : 
-  case ClassId_Star + MCStar_Type : 
-  case ClassId_Star + CircRFixStar_Type : 
-  case ClassId_Star + PSFDHStar_Type : 
-  case ClassId_Star + PSFSEStar_Type : 
-  case ClassId_Star + MCDHStar_Type : 
-    ((BStar*)obj)->Print(1);
-    break;
-#endif
-
-// - Ajout objet PPF
-  default:
-    break;
-  }
-cout << endl;
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL)  return;
+
+string ctyp = typeid(*obja->GetDataObj()).name();
+cout << "NamedObjMgr::PrintObj(" << nom << ") Type: " << ctyp << endl;
+obja->Print(cout);
+
 return;
 }
@@ -633,6 +493,7 @@
 void NamedObjMgr::DisplayObj(string const& nom, string dopt) 
 {
-PPersist* obj=GetObj(nom);
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::DisplayObj() Error , Pas d'objet de nom " << nom << endl; 
   return;
@@ -640,129 +501,25 @@
 if (!myImgApp)  return;
  
-int cid = obj->ClassId();
-string ctyp = servnobjm->PClassIdToClassName(cid);
+PIDrawer * dr = NULL;
+P2DArrayAdapter* arr = NULL;
+dr = obja->GetDrawer(dopt);
+if (!dr) arr = obja->Get2DArray(dopt);
+
+if (!dr && !arr) { 
+  string ctyp = typeid(*(obja->GetDataObj())).name();
+  cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl; 
+  return;
+  }
 
 int wrsid = 0;
 bool fgsr = true;
-// On veut tracer une ligne pour vecteur et histo1D par defaut
-if ( (cid == ClassId_Vector) || (cid == ClassId_Histo1D) )  dopt = "thinline," + dopt;
-else if(cid == ClassId_HProf)  dopt = "fcirclemarker5," + dopt;
 int opt = servnobjm->DecodeDispOption(dopt, fgsr);
 
-switch (cid) {
-  case ClassId_Poly1 : 
-  case ClassId_Poly2 : 
-  case ClassId_DVList : 
-    cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl; 
-    break;
-
-  case ClassId_Matrix : 
-    {
-    wrsid = myImgApp->DispImage(new POMatrixAdapter((Matrix*)obj, false), nom, opt);
-    break;
-    }
-  case ClassId_Vector : 
-    {
-    PIYfXDrawer* dr = new   PIYfXDrawer( new POVectorAdapter((Vector*)obj, false), NULL, true);
-    wrsid = myImgApp->DispScDrawer( (PIDrawer*)dr, nom, opt);    
-    break;
-    }
-  case ClassId_Histo1D : 
-    {
-    PIHisto* pih = new PIHisto(((Histo*)obj), false);
-    wrsid = myImgApp->DispScDrawer( (PIDrawer*)pih, nom, opt);
-    break;
-    }
-  case ClassId_Histo2D : 
-    {
-    PIHisto2D* pih2 = new PIHisto2D(((Histo2D*)obj), false);
-    wrsid = myImgApp->DispScDrawer( (PIDrawer*)pih2, nom, opt, nom, true);
-    break;
-    }
-  case ClassId_HProf : 
-    {
-    PIHisto* pihp = new PIHisto(((Histo*)obj), false);
-    wrsid = myImgApp->DispScDrawer( (PIDrawer*)pihp, nom, opt);
-    break;
-    }
-  case ClassId_GeneralFitData : 
-    {
-    GeneralFitData* gfd = (GeneralFitData*)obj;
-    if(gfd->NVar()==1) {
-      PIGenFitDat* pigfd = new PIGenFitDat(gfd,false);
-      wrsid = myImgApp->DispScDrawer((PIDrawer*)pigfd,nom,opt);
-    } else if(gfd->NVar()==2) {
-      PIGenFitDat3D* pigfd = new PIGenFitDat3D(gfd,false);
-      wrsid = myImgApp->Disp3DDrawer(pigfd,nom,opt);
-    } else {
-      cout<<"NamedObjMgr::DisplayObj() Error , Utilisez DisplayGFD pour GeneralFitData "
-          <<ctyp<<"\n de "<<gfd->NVar()<<" variables (!=1,2)"<<endl; 
-    }
-    break;
-    }
-
-  case ClassId_NTuple : 
-    cout << "NamedObjMgr::DisplayObj() Error , Utilisez DisplayNt pour NTuple " << ctyp << endl; 
-    break;
-
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 : 
-  case ClassId_Image + kint_1 : 
-  case ClassId_Image + kr_8 : 
-  case ClassId_Image + kuint_4 : 
-    wrsid = myImgApp->DispImage(new RzImageAdapter((RzImage*)obj, false), nom, opt);
-    break;
-  case ClassId_Image + kuint_2 : 
-    wrsid = myImgApp->DispImage(new ImageAdapter<uint_2>((ImageU2*)obj, false), nom, opt);
-    break;
-  case ClassId_Image + kint_2 : 
-    wrsid = myImgApp->DispImage(new ImageAdapter<int_2>((ImageI2*)obj, false), nom, opt);
-    break;
-  case ClassId_Image + kint_4 : 
-    wrsid = myImgApp->DispImage(new ImageAdapter<int_4>((ImageI4*)obj, false), nom, opt);
-    break;
-  case ClassId_Image + kr_4 : 
-    wrsid = myImgApp->DispImage(new ImageAdapter<r_4>((ImageR4*)obj, false), nom, opt);
-    break;
-
-#ifdef SANS_EVOLPLANCK 
-  case ClassId_ZFidu : 
-    {
-    int nx = ((ZFidu*)obj)->XMax() -  ((ZFidu*)obj)->XMin();
-    int ny = ((ZFidu*)obj)->YMax() -  ((ZFidu*)obj)->YMin();
-    if (nx > 1024)  nx = 1024;
-    if (ny > 1024)  ny = 1024;
-    if (nx < 128)  nx = 128;
-    if (ny < 128)  nx = 128;
-    ImageU2* msk = ((ZFidu*)obj)->MakeBadZoneMask(nx, ny);
-    myImgApp->DispImage(new ImageAdapter<uint_2>((ImageU2*)msk, true), nom, opt);
-    break;
-    }
-
-  case ClassId_StarList : 
-    {
-    PIStarList* pist = new PIStarList(((StarList*)obj), false);
-    wrsid = myImgApp->DispScDrawer( (PIDrawer*)pist, nom, opt);
-    break;
-    }
-
-  case ClassId_Transfo : 
-  case ClassId_PSF : 
-  case ClassId_Star + BStar_Type : 
-  case ClassId_Star + RzStar_Type : 
-  case ClassId_Star + PSFStar_Type : 
-  case ClassId_Star + MCStar_Type : 
-  case ClassId_Star + CircRFixStar_Type : 
-  case ClassId_Star + PSFDHStar_Type : 
-  case ClassId_Star + PSFSEStar_Type : 
-  case ClassId_Star + MCDHStar_Type : 
-    cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl; 
-    break;
-#endif
-
-// - Ajout objet PPF
-  default:
-    break;
-  }
+if (dr) { 
+  PIDrawer3D * dr3 = dynamic_cast<PIDrawer3D *>(dr);
+  if(dr3)  wrsid = myImgApp->Disp3DDrawer(dr3, nom, opt);
+  else wrsid = myImgApp->DispScDrawer( dr, nom, opt); 
+  }
+else if (arr) wrsid = myImgApp->DispImage(arr, nom, opt);
 
 if(wrsid != 0) {
@@ -775,4 +532,76 @@
 }
 
+/* --Methode-- */
+void NamedObjMgr::DisplayImage(string const& nom, string dopt)
+{
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
+  cout << "NamedObjMgr::DisplayImage() Error , Pas d'objet de nom " << nom << endl; 
+  return;
+}
+if (!myImgApp)  return;
+ 
+P2DArrayAdapter* arr = obja->Get2DArray(dopt);
+
+if (!arr) { 
+  string ctyp = typeid(*(obja->GetDataObj())).name();
+  cout << "NamedObjMgr::DisplayImage() Error , Non supporte pour " << ctyp << endl; 
+  return;
+  }
+
+int wrsid = 0;
+bool fgsr = true;
+int opt = servnobjm->DecodeDispOption(dopt, fgsr);
+wrsid = myImgApp->DispImage(arr, nom, opt);
+
+if(wrsid != 0) {
+  NObjList::iterator it = myObjs->find(nom);
+  if (it == myObjs->end()) return; 
+  (*it).second.wrsid.push_back(wrsid);
+  }
+if (fgsr) myImgApp->RestoreGraphicAtt(); 
+return;
+}
+/* --Methode-- */
+void NamedObjMgr::DisplaySurf3D(string const& nom, string dopt)
+{
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
+  cout << "NamedObjMgr::DisplayImage() Error , Pas d'objet de nom " << nom << endl; 
+  return;
+}
+if (!myImgApp)  return;
+ 
+P2DArrayAdapter* arr = obja->Get2DArray(dopt);
+
+if (!arr) { 
+  string ctyp = typeid(*(obja->GetDataObj())).name();
+  cout << "NamedObjMgr::DisplaySurf3D() Error , Non supporte pour " << ctyp << endl; 
+  return;
+  }
+
+if ((arr->XSize() > 250) || (arr->YSize() > 250)) {
+  cout << "NamedObjMgr::DisplaySurf3D() Error , 2D-Array(" <<  arr->XSize() 
+       << "x" << arr->YSize() << ") trop grand (max=250x250)" << endl; 
+  delete arr;
+  return;
+  }
+
+int wrsid = 0;
+bool fgsr = true;
+int opt = servnobjm->DecodeDispOption(dopt, fgsr);
+PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true);
+wrsid = myImgApp->Disp3DDrawer(sdr, nom, opt);
+if(wrsid >= 0) {
+  NObjList::iterator it = myObjs->find(nom);
+  if (it == myObjs->end()) return; 
+  (*it).second.wrsid.push_back(wrsid);
+  }
+
+if (fgsr) myImgApp->RestoreGraphicAtt();  
+return; 
+}
 
 /* --Methode-- */
@@ -780,5 +609,5 @@
                             string& erx, string& ery, string& erz, string dopt)
 {
-PPersist* obj=GetObj(nom);
+AnyDataObj* obj=GetObj(nom);
 if (obj == NULL) {
   cout << "NamedObjMgr::DisplayNT() Error , Pas d'objet de nom " << nom << endl; 
@@ -787,7 +616,6 @@
 if (!myImgApp)  return; 
 
-int cid = obj->ClassId();
-if (cid != ClassId_NTuple) { 
-  string ctyp = servnobjm->PClassIdToClassName(cid);
+if (typeid(*obj) != typeid(NTuple)) { 
+  string ctyp = typeid(*obj).name();
   cout << "NamedObjMgr::DisplayNT() Error , Objet n'est pas un NTuple " << ctyp << endl; 
   return;
@@ -837,12 +665,11 @@
 //|  opt = options generales pour le display.
 {
-PPersist* obj=GetObj(nom);
+AnyDataObj* obj=GetObj(nom);
 if(obj == NULL)
   {cout << "NamedObjMgr::DisplayGFD() Error , Pas d'objet de nom " << nom << endl; 
    return;}
 if(!myImgApp) return; 
-int cid = obj->ClassId();
-if(cid != ClassId_GeneralFitData)
-  {string ctyp = servnobjm->PClassIdToClassName(cid);
+if(typeid(*obj) != typeid(GeneralFitData))
+  {string ctyp = typeid(*obj).name();
    cout<<"NamedObjMgr::DisplayGFD() Error , Objet n'est pas un GeneralFitData "<<ctyp<<endl; 
    return;}
@@ -894,73 +721,4 @@
 
 
-/* --Methode-- */
-void NamedObjMgr::DisplaySurf3D(string const& nom, string dopt)
-{
-PPersist* obj=GetObj(nom);
-if (obj == NULL) {
-  cout << "NamedObjMgr::DisplaySurf3D() Error , Pas d'objet de nom " << nom << endl; 
-  return;
-}
-if (!myImgApp)  return; 
-
-int cid = obj->ClassId();
-
-
-P2DArrayAdapter* arr=NULL;
-switch (cid) {
-  case ClassId_Matrix : 
-    arr = new POMatrixAdapter((Matrix*)obj, false);
-    break;
-  case ClassId_Histo2D : 
-    arr = new POH2DAdapter((Histo2D*)obj, false);
-    break;
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 : 
-  case ClassId_Image + kint_1 : 
-  case ClassId_Image + kr_8 : 
-  case ClassId_Image + kuint_4 : 
-    arr = new RzImageAdapter((RzImage*)obj, false);
-    break;
-  case ClassId_Image + kuint_2 : 
-    arr = new ImageAdapter<uint_2>((ImageU2*)obj, false);
-    break;
-  case ClassId_Image + kint_2 : 
-    arr = new ImageAdapter<int_2>((ImageI2*)obj, false);
-    break;
-  case ClassId_Image + kint_4 : 
-    arr = new ImageAdapter<int_4>((ImageI4*)obj, false);
-    break;
-  case ClassId_Image + kr_4 : 
-    arr = new ImageAdapter<r_4>((ImageR4*)obj, false);
-    break;
-
-  default :
-    cout << "NamedObjMgr::DisplaySurf3D() Error , Pas de display pour " << servnobjm->PClassIdToClassName(cid) << endl; 
-    return;
-  }
-
-if (!arr) return;
-if ((arr->XSize() > 250) || (arr->YSize() > 250)) {
-  cout << "NamedObjMgr::DisplaySurf3D() Error , 2D-Array(" <<  arr->XSize() 
-       << "x" << arr->YSize() << ") trop grand (max=250x250)" << endl; 
-  delete arr;
-  return;
-  }
-
-int wrsid = 0;
-bool fgsr = true;
-int opt = servnobjm->DecodeDispOption(dopt, fgsr);
-if (cid == ClassId_Histo2D)  arr->DefineXYCoordinates(0., 0., 1., 1.);
-PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true);
-wrsid = myImgApp->Disp3DDrawer(sdr, nom, opt);
-if(wrsid >= 0) {
-  NObjList::iterator it = myObjs->find(nom);
-  if (it == myObjs->end()) return; 
-  (*it).second.wrsid.push_back(wrsid);
-  }
-
-if (fgsr) myImgApp->RestoreGraphicAtt();  
-return; 
-}
 
 
@@ -984,9 +742,10 @@
                                   string& expcut, string dopt)
 {
-PPersist* obj=GetObj(nom);
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::DisplayPoints2D() Error , Pas d'objet de nom " << nom << endl; 
   return;
-}
+  }
 if (!myImgApp)  return; 
 
@@ -999,5 +758,5 @@
 else {  haserr = false;  experrx = experry = "0."; nt = new NTuple(2, ntn); }
 
-servnobjm->Nobj_ComputeExpressions(obj, expx, expy, experrx, experry, expcut, nt, NULL, NULL);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expy, experrx, experry, expcut, nt, NULL, NULL);
 
 if (nt->NEntry() < 1) {
@@ -1025,6 +784,7 @@
                                   string& expcut, string dopt)
 {
-PPersist* obj=GetObj(nom);
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::DisplayPoints3D() Error , Pas d'objet de nom " << nom << endl; 
   return;
@@ -1036,5 +796,5 @@
 
 string expwt = "1.";
-servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expz, expwt, expcut, nt, NULL, NULL);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, expwt, expcut, nt, NULL, NULL);
 
 if (nt->NEntry() < 1) {
@@ -1064,7 +824,7 @@
 void NamedObjMgr::ProjectH1(string const& nom, string& expx, string& expwt, string& expcut, string& nomh1, string dopt)
 {
-PPersist* obj=GetObj(nom);
-
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::ProjectH1() Error , Pas d'objet de nom " << nom << endl; 
   return;
@@ -1074,8 +834,8 @@
 Histo* h1 = NULL;
 NTuple* nt = NULL;
-PPersist* oh = NULL; 
+AnyDataObj* oh = NULL; 
 if (nomh1.length() > 0) oh=GetObj(nomh1);
 else nomh1 = "H1Proj";
-if ( (oh != NULL) && (oh->ClassId() == ClassId_Histo1D) )  h1 = (Histo*)oh;  // Pas de remise a zero ! h1->Zero();
+if ( (oh != NULL) && (typeid(*oh) == typeid(Histo)) )  h1 = (Histo*)oh;  // Pas de remise a zero ! h1->Zero();
 else {
   char* ntn[2]= {"hxval", "hwt"};
@@ -1083,5 +843,5 @@
   }
 string expz = "0.";   
-servnobjm->Nobj_ComputeExpressions(obj, expx, expwt, expz, expwt, expcut, nt, h1, NULL);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expwt, expz, expwt, expcut, nt, h1, NULL);
 
 if ((!h1) && (!nt)) return;
@@ -1113,7 +873,7 @@
                             string& nomh2, string dopt)
 {
-PPersist* obj=GetObj(nom);
-
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::ProjectH2() Error , Pas d'objet de nom " << nom << endl; 
   return;
@@ -1123,8 +883,8 @@
 Histo2D* h2 = NULL;
 NTuple* nt = NULL;
-PPersist* oh = NULL;
+AnyDataObj* oh = NULL;
 if (nomh2.length() > 0)  oh=GetObj(nomh2);
 else nomh2 = "H2Proj";
-if ( (oh != NULL) && (oh->ClassId() == ClassId_Histo2D) )  h2 = (Histo2D*)oh;  // Pas de remise a zero ! h2->Zero();
+if ( (oh != NULL) && (typeid(*oh) == typeid(Histo2D)) )  h2 = (Histo2D*)oh;  // Pas de remise a zero ! h2->Zero();
 else {
   char* ntn[3]= {"hxval", "hyval", "hwt"};
@@ -1132,5 +892,5 @@
   }
 string expz = "0.";   
-servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expwt, expwt, expcut, nt, NULL, h2);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, nt, NULL, h2);
 
 if ((!h2) && (!nt)) return;
@@ -1174,7 +934,7 @@
 //| opt = options generales pour le display.
 {
-PPersist* obj=GetObj(nom);
-
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::ProjectHProf() Error , Pas d'objet de nom " << nom << endl; 
   return;
@@ -1184,8 +944,8 @@
 HProf* hprof = NULL;
 NTuple* nt = NULL;
-PPersist* oh = NULL;
+AnyDataObj* oh = NULL;
 if (nomprof.length() > 0)  oh=GetObj(nomprof);
 else nomprof = "ProfProj";
-if( (oh!=NULL) && (oh->ClassId()== ClassId_HProf) )  hprof = (HProf*)oh;
+if( (oh!=NULL) && (typeid(*oh) == typeid(HProf)) )  hprof = (HProf*)oh;
 else {
   char* ntn[3]= {"hxval", "hyval", "hwt"};
@@ -1193,5 +953,5 @@
 }
 string expz = "0.";
-servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expwt, expwt, expcut, nt, NULL, NULL, hprof);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, nt, NULL, NULL, hprof);
 
 if((!hprof) && (!nt)) return;
@@ -1223,7 +983,7 @@
 void NamedObjMgr::FillVect(string const& nom, string& expx, string& expcut, string& nomvec, string dopt)
 {
-PPersist* obj=GetObj(nom);
-
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::FillVect() Error , Pas d'objet de nom " << nom << endl; 
   return;
@@ -1239,5 +999,5 @@
 string expwt = "1.";
 string expz = "0.";   
-servnobjm->Nobj_ComputeExpressions(obj, expx, expz, expz, expwt, expcut, nt, NULL, NULL);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expz, expz, expwt, expcut, nt, NULL, NULL);
 
 if (!nt) return;
@@ -1265,7 +1025,7 @@
                          string& expcut, string& nomnt)
 {
-PPersist* obj=GetObj(nom);
-
-if (obj == NULL) {
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
   cout << "NamedObjMgr::FillNT() Error , Pas d'objet de nom " << nom << endl; 
   return;
@@ -1275,8 +1035,8 @@
 bool fgnnt = false;
 NTuple* nt = NULL;
-PPersist* oh = NULL;
+AnyDataObj* oh = NULL;
 if (nomnt.length() > 0)  oh=GetObj(nomnt);
 else nomnt = "NTFill";
-if ( (oh != NULL) && (oh->ClassId() == ClassId_NTuple) )  { 
+if ( (oh != NULL) && (typeid(*oh) == typeid(HProf)) )  { 
   nt = (NTuple*)oh;
   if (nt->NVar() > 10) {
@@ -1291,5 +1051,5 @@
   }
 
-servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expz, expt, expcut, nt, NULL, NULL);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, expt, expcut, nt, NULL, NULL);
 
 if (fgnnt) AddObj(nt, nomnt);
@@ -1311,8 +1071,10 @@
 //| nomgfd = nom du GeneralFitData engendre (optionnel)
 {
-PPersist* obj=GetObj(nom);
-if(obj == NULL)
-  {cout<<"NamedObjMgr::FillGFD() Error , Pas d'objet de nom "<<nom<<endl;
-   return;}
+NObjMgrAdapter* obja=NULL;
+obja = GetObjAdapter(nom);
+if (obja == NULL) {
+  cout << "NamedObjMgr::FillGFD() Error , Pas d'objet de nom "<<nom<<endl;
+  return;
+  }
 if(!myImgApp)  return;
 
@@ -1321,54 +1083,6 @@
 if(expy.length()<=0) {nvar = 1; expy = "0.";}
 
-// Que faut-il copier dans GeneralFitData
-int ndata=0;
-int cid = obj->ClassId();
-switch (cid) {
-  case ClassId_Vector :
-    ndata=((Vector*)obj)->NElts();
-    break;
-  case ClassId_Matrix :
-    ndata=((Matrix*)obj)->NCol()*((Matrix*)obj)->NRows();
-    break;
-  case ClassId_Histo1D :
-  case ClassId_HProf : 
-    ndata=((Histo*)obj)->NBins();
-    break;
-  case ClassId_Histo2D :
-    ndata=((Histo2D*)obj)->NBinX()*((Histo2D*)obj)->NBinY();
-    break;
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 :
-  case ClassId_Image + kint_1 :
-  case ClassId_Image + kr_8 :
-  case ClassId_Image + kuint_4 :
-  case ClassId_Image + kuint_2 :
-  case ClassId_Image + kint_2 :
-  case ClassId_Image + kint_4 :
-  case ClassId_Image + kr_4 :
-    ndata=((RzImage*)obj)->XSize()*((RzImage*)obj)->YSize();
-    break;
-#ifdef SANS_EVOLPLANCK 
-  case ClassId_StarList : 
-    ndata=((StarList*)obj)->NbStars();
-    break;
-#endif
-  case ClassId_NTuple :
-    ndata=((NTuple*)obj)->NEntry();
-    break;
-  case ClassId_GeneralFitData :
-    ndata=((GeneralFitData*)obj)->NData();
-    break;
-  default :
-    cout<<"FillGFD Erreur: N/A to  "<<servnobjm->PClassIdToClassName(cid)<<endl; 
-    return;
-}
-
-// Nom du GeneralFitData cree.
-if (nomgfd.length() <= 0) nomgfd = "GFDFill";
-// Consistence ndata.
-if(ndata<=0)
-  {cout<<"NamedObjMgr::FillGFD() Warning   ndata="<<ndata<<endl; 
-   return;}
+// $CHECK$ - cmv calculait le nombre d'entree ndata
+// en fonction de chaque objet - Je l'ai vire Reza 11/05/99
 
 // Creation NTuple Buffer
@@ -1377,5 +1091,5 @@
 
 // Remplissage NTuple buffer
-servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expz, experr, expcut, nt, NULL, NULL);
+servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, experr, expcut, nt, NULL, NULL);
 if(nt->NEntry() < 1)
   {cout<<"NamedObjMgr::FillGFD() Warning  Zero points satisfy cut !"<<endl; 
@@ -1383,5 +1097,11 @@
 
 //Remplissage de la structure GeneraFitData
-GeneralFitData* gfd = new GeneralFitData(nvar,ndata,0);
+if (nt->NEntry() <= 0) {
+  cout<<"NamedObjMgr::FillGFD() Warning - NData= " << nt->NEntry() << endl;
+  delete nt;
+  return;
+  }
+
+GeneralFitData* gfd = new GeneralFitData(nvar,nt->NEntry(),0);
 int k;
 float* xn;
@@ -1724,5 +1444,5 @@
 //|2D     yaa.b et y = idem "xaa.b et x" mais pour y
 {
-PPersist* obj=GetObj(nom);
+AnyDataObj* obj=GetObj(nom);
 if (obj == NULL) {
   cout<<"NamedObjMgr::Fit12D() Error , Pas d'objet de nom "<<nom<<endl;
@@ -1733,6 +1453,5 @@
   {cout<<"NamedObjMgr::Fit12D() Donnez un nom de fonction a fitter."<<endl;
    return;}
-int cid = obj->ClassId();
-string ctyp = servnobjm->PClassIdToClassName(cid);
+string ctyp = typeid(*obj).name();
 
 int ndim = 0, nbinx=0, nbiny=0, ndata = 0;
@@ -1740,49 +1459,40 @@
 Matrix* m = NULL; Histo2D* h2 = NULL; RzImage* im = NULL;
 GeneralFitData* g = NULL;
-switch (cid) {
+
   // 1D
-  case ClassId_Vector :
-    ndim = 1;
-    v = (Vector*) obj; nbinx = v->NElts(); nbiny = 1;
-    break;
-  case ClassId_HProf :
-  case ClassId_Histo1D :
-    ndim = 1;
-    h = (Histo*)  obj; nbinx = h->NBins(); nbiny = 1;
-    break;
-  // 2D
-  case ClassId_Matrix :
-    ndim = 2;
-    m = (Matrix*) obj; nbinx = m->NCol(); nbiny = m->NRows();
-    break;
-  case ClassId_Histo2D :
-    ndim = 2;
-    h2 = (Histo2D*) obj; nbinx = h2->NBinX(); nbiny = h2->NBinY();
-    break;
-  // 1D ou 2D selon
-  case ClassId_GeneralFitData :
-    g = (GeneralFitData*) obj; nbinx = g->NData(); nbiny = 1;
-    if(     g->NVar()==1) ndim = 1;
-    else if(g->NVar()==2) ndim = 2;
-    else {
-      cout<<"GeneralFitData ne peut avoir que 1 ou 2 variables d'abscisse: "
-          <<((GeneralFitData*) obj)->NVar()<<endl; return;}
-    break;
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 : 
-  case ClassId_Image + kuint_2 : 
-  case ClassId_Image + kint_2 : 
-  case ClassId_Image + kint_4 : 
-  case ClassId_Image + kr_4 :
-  case ClassId_Image + kr_8 : 
-    ndim = 2;
-    im = (RzImage*) obj; nbinx = im->XSize(); nbiny = im->YSize();
-    break;
-  default:
-    cout<<"NamedObjMgr::Fit12D() Error , Objet n'est pas un "
-        <<"Histo1D/HProf/Vector/Histo2D/Image/Matrix/GeneralFitData "<<ctyp<<endl;
-    return;
-    break;
-}
+if (typeid(*obj) == typeid(Vector)) {
+  ndim = 1;
+  v = (Vector*) obj; nbinx = v->NElts(); nbiny = 1;
+  }
+else if ( (typeid(*obj) == typeid(HProf)) || (typeid(*obj) == typeid(Histo)) ) {
+  ndim = 1;
+  h = (Histo*)  obj; nbinx = h->NBins(); nbiny = 1;
+  }
+else if (typeid(*obj) == typeid(Matrix)) {
+  ndim = 2;
+  m = (Matrix*) obj; nbinx = m->NCol(); nbiny = m->NRows();
+  }
+else if (typeid(*obj) == typeid(Histo2D)) {
+  ndim = 2;
+  h2 = (Histo2D*) obj; nbinx = h2->NBinX(); nbiny = h2->NBinY();
+  }
+else if (typeid(*obj) == typeid(GeneralFitData)) {
+  g = (GeneralFitData*) obj; nbinx = g->NData(); nbiny = 1;
+  if(     g->NVar()==1) ndim = 1;
+  else if(g->NVar()==2) ndim = 2;
+  else {
+     cout<<"GeneralFitData ne peut avoir que 1 ou 2 variables d'abscisse: "
+         <<((GeneralFitData*) obj)->NVar()<<endl; return; }
+  }
+else if (dynamic_cast<RzImage*>(obj)) {
+  ndim = 2;
+  im = (RzImage*) obj; nbinx = im->XSize(); nbiny = im->YSize();
+  }
+else  {
+  cout<<"NamedObjMgr::Fit12D() Error , Objet n'est pas un "
+      <<"Histo1D/HProf/Vector/Histo2D/Image/Matrix/GeneralFitData "<<ctyp<<endl;
+  return; 
+  }
+
 ndata = nbinx*nbiny;
 if(ndata<=0)
Index: trunk/SophyaPI/PIext/nobjmgr.h
===================================================================
--- trunk/SophyaPI/PIext/nobjmgr.h	(revision 294)
+++ trunk/SophyaPI/PIext/nobjmgr.h	(revision 295)
@@ -9,5 +9,7 @@
 #include "ppersist.h"
 #include "dlftypes.h"
+#include "anydataobj.h"
 
+class NObjMgrAdapter;
 class PIStdImgApp;
 class Services2NObjMgr;
@@ -15,4 +17,5 @@
 class NamedObjMgr {
 public:
+// Constructeur et destructeur
 			NamedObjMgr();
   virtual		~NamedObjMgr();
@@ -22,8 +25,8 @@
 
 //  Pour ajouter, supprimer et acceder aux objets PPersist
-  virtual void		AddObj(PPersist* obj, string& nom);
+  virtual void		AddObj(AnyDataObj* obj, string& nom, bool crd=false);
   virtual void          DelObj(string const& nom, bool fgd=true);
   virtual void		DelObjects(string const& patt, bool fgd=true); 
-  virtual PPersist*	GetObj(string const& nom);
+  virtual AnyDataObj*	GetObj(string const& nom);
   virtual void		RenameObj(string const& nom, string& nomnew);
   virtual string        LastObjName();  // Renvoie le nom du dernier objet ajoute
@@ -44,9 +47,9 @@
 //  Affichage des objets 
   virtual void          DisplayObj(string const& nom, string dopt="");
+  virtual void          DisplayImage(string const& nom, string dopt="");
   virtual void          DisplaySurf3D(string const& nom, string dopt="");
   virtual void          DisplayNT(string const& nom, string& nmx, string& nmy, string& nmz,  
                                   string& erx, string& ery, string& erz, string dopt="");
   virtual void          DisplayGFD(string const& nom, string& numvarx, string& numvary, string& err, string dopt="");
-// virtual void          DisplayImage(string const& nom, string dopt=""); C'est necessaire ??
 
   virtual void		SetGraphicAttributes(string gratt="");
@@ -87,8 +90,10 @@
                               string par,string step,string min,string max,string opt);
 
-
 // Acces au PIApplication et a la classe de service 
   virtual PIStdImgApp*		GetImgApp();
   virtual Services2NObjMgr* 	GetServiceObj();
+
+protected :
+  virtual NObjMgrAdapter*	GetObjAdapter(string const& nom);
 };
 
Index: trunk/SophyaPI/PIext/nomgadapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nomgadapter.cc	(revision 295)
+++ trunk/SophyaPI/PIext/nomgadapter.cc	(revision 295)
@@ -0,0 +1,83 @@
+#include "machdefs.h"
+#include <stdlib.h>
+#include <typeinfo>
+#include <iostream.h>
+#include <string>
+#include "nomgadapter.h"
+
+/* --Methode-- */
+NObjMgrAdapter::NObjMgrAdapter(AnyDataObj* o)
+{
+mObj = o;
+}
+
+/* --Methode-- */
+NObjMgrAdapter::~NObjMgrAdapter()
+{
+}
+
+/* --Methode-- */
+NObjMgrAdapter* NObjMgrAdapter::Clone(AnyDataObj* o)
+{
+return(new NObjMgrAdapter(o));
+}
+
+/* --Methode-- */
+AnyDataObj* NObjMgrAdapter::GetDataObj()
+{
+return(mObj);
+}
+
+/* --Methode-- */
+void NObjMgrAdapter::ReadFits(string const & )
+{
+string s = typeid(*mObj).name();
+cout << "NObjMgrAdapter::ReadFits() - Error : Not supported for " << s << endl;
+}
+
+/* --Methode-- */
+void NObjMgrAdapter::SaveFits(string const & )
+{
+string s = typeid(*mObj).name();
+cout << "NObjMgrAdapter::SaveFits() - Error : Not supported for " << s << endl;
+}
+
+/* --Methode-- */
+void NObjMgrAdapter::SavePPF(POutPersist&, string const & )
+{
+string s = typeid(*mObj).name();
+cout << "NObjMgrAdapter::SavePPF() - Error : Not supported for " << s << endl;
+}
+
+/* --Methode-- */
+void NObjMgrAdapter::Print(ostream& )
+{
+string s = typeid(*mObj).name();
+cout << "NObjMgrAdapter::Print() - Error : Not supported for " << s << endl;
+}
+
+/* --Methode-- */
+PIDrawer* NObjMgrAdapter::GetDrawer(string &)
+{
+return(NULL);
+}
+
+/* --Methode-- */
+P2DArrayAdapter* NObjMgrAdapter::Get2DArray(string &)
+{
+return(NULL);
+}
+
+/* --Methode-- */
+NTupleInterface* NObjMgrAdapter::GetNTupleInterface()
+{
+string s = typeid(*mObj).name();
+cout << "NObjMgrAdapter::GetNTupleInterface() - Error : Not supported for " << s << endl;
+return(NULL);
+}
+
+
+
+
+
+
Index: trunk/SophyaPI/PIext/nomgadapter.h
===================================================================
--- trunk/SophyaPI/PIext/nomgadapter.h	(revision 295)
+++ trunk/SophyaPI/PIext/nomgadapter.h	(revision 295)
@@ -0,0 +1,41 @@
+// This may look like C code, but it is really -*- C++ -*-
+//  Adaptateur pour objets gere par   NamedObjMgr (piapp)
+//                                    Reza 05/99
+//  LAL-IN2P3/CNRS               CEA-DAPNIA      
+
+#ifndef NOMGADAPTER_H_SEEN
+#define NOMGADAPTER_H_SEEN
+
+#include "machdefs.h"
+#include "ppersist.h"
+#include "anydataobj.h"
+#include "pidrawer.h"
+#include "parradapter.h"
+#include "ntupintf.h"
+
+
+// Classe d'adaptateur d'objets de donnees pour la gestion d'objets
+// nommes (NamedObjMgr) de piapp
+
+class NObjMgrAdapter {
+public:
+				NObjMgrAdapter(AnyDataObj* o);
+  virtual			~NObjMgrAdapter();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+
+  virtual AnyDataObj*		GetDataObj();
+
+  virtual void			ReadFits(string const & flnm);
+  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual PIDrawer*		GetDrawer(string& dopt);
+  virtual P2DArrayAdapter*	Get2DArray(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface();
+protected:
+  AnyDataObj* mObj;
+};
+
+#endif
Index: trunk/SophyaPI/PIext/nomhistadapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nomhistadapter.cc	(revision 295)
+++ trunk/SophyaPI/PIext/nomhistadapter.cc	(revision 295)
@@ -0,0 +1,332 @@
+#include "machdefs.h"
+#include <stdlib.h>
+#include <typeinfo>
+#include <iostream.h>
+#include <string>
+
+#include "nomhistadapter.h"
+#include "pihisto.h"
+#include "pihisto2d.h"
+#include "pipodrw.h"
+
+//-------------------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Histo / HProf
+//-------------------------------------------------------------------------
+
+/* --Methode-- */
+NOMAdapter_Histo::NOMAdapter_Histo(Histo* o)
+  : NObjMgrAdapter(o)
+{
+mHis = o;
+}
+
+/* --Methode-- */
+NOMAdapter_Histo::~NOMAdapter_Histo()
+{
+}
+
+/* --Methode-- */
+NObjMgrAdapter* NOMAdapter_Histo::Clone(AnyDataObj* o)
+{
+Histo* h = dynamic_cast<Histo *>(o);
+if (h) return ( new NOMAdapter_Histo(h) );
+return ( new NObjMgrAdapter(o) );
+}
+
+
+/* --Methode-- */
+void NOMAdapter_Histo::SavePPF(POutPersist& pos, string const & nom)
+{
+#ifdef SANS_EVOLPLANCK
+// PEIDA-EROS L'histo est lui-meme PPersist
+string tag = nom;  // A cause de const
+mHis->Write(pos,0,tag);
+#else
+string s = typeid(*mObj).name();
+cout << "NOMAdapter_Histo::SavePPF() - Error : Not supported for " << s << endl;
+#endif
+}
+
+/* --Methode-- */
+void NOMAdapter_Histo::Print(ostream& os)
+{
+mHis->Print(60);
+}
+
+/* --Methode-- */
+PIDrawer* NOMAdapter_Histo::GetDrawer(string & dopt)
+{
+if (typeid(*mHis) == typeid(HProf))  dopt = "fcirclemarker5," + dopt;
+else dopt = "thinline," + dopt;
+return( new PIHisto(mHis, false) );
+}
+
+/* --Methode-- */
+NTupleInterface* NOMAdapter_Histo::GetNTupleInterface()
+{
+return( new NTupInt_Histo(mHis) );
+}
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+NTupInt_Histo::NTupInt_Histo(Histo* h)
+{
+mHis = h;
+}
+
+/* --Methode-- */
+NTupInt_Histo::~NTupInt_Histo()
+{
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Histo::NbLines()
+{
+return(mHis->NBins());
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Histo::NbColumns()
+{
+return(4);
+}
+
+/* --Methode-- */
+r_8* NTupInt_Histo::GetLineD(int k)
+{
+int i;
+if ((k < 0) || (k >= mHis->NBins())) 
+    for(i=0; i<4; i++)  mRet[i] = 0.;
+else { 
+  mRet[0] = k;  mRet[1] = mHis->BinCenter(k);
+  mRet[2] = (*mHis)(k); mRet[3] = mHis->Error(k); 
+  }
+return(mRet);
+}
+
+/* --Methode-- */
+string NTupInt_Histo::VarList_C(const char* nx)
+{
+string nomx;
+if (nx) nomx = nx;
+else nomx = "_xh_";
+string vardec = "double i,x,val,err; \n";
+vardec += "i = " + nomx + "[0];  x = " + nomx + "[1]; \n";
+vardec += "val = " + nomx + "[2];  err = " + nomx + "[3]; \n";
+return(vardec);
+}
+
+//-------------------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Histo2D
+//-------------------------------------------------------------------------
+
+
+/* --Methode-- */
+NOMAdapter_Histo2D::NOMAdapter_Histo2D(Histo2D* o)
+  : NObjMgrAdapter(o)
+{
+mHis = o;
+}
+
+/* --Methode-- */
+NOMAdapter_Histo2D::~NOMAdapter_Histo2D()
+{
+}
+
+/* --Methode-- */
+NObjMgrAdapter* NOMAdapter_Histo2D::Clone(AnyDataObj* o)
+{
+Histo2D* h = dynamic_cast<Histo2D *>(o);
+if (h) return ( new NOMAdapter_Histo2D(h) );
+return ( new NObjMgrAdapter(o) );
+}
+
+
+/* --Methode-- */
+void NOMAdapter_Histo2D::SavePPF(POutPersist& pos, string const & nom)
+{
+#ifdef SANS_EVOLPLANCK
+// PEIDA-EROS L'histo est lui-meme PPersist
+string tag = nom;  // A cause de const
+mHis->Write(pos,0,tag);
+#else
+string s = typeid(*mObj).name();
+cout << "NOMAdapter_Histo2D::SavePPF() - Error : Not supported for " << s << endl;
+#endif
+}
+
+/* --Methode-- */
+void NOMAdapter_Histo2D::Print(ostream& os)
+{
+mHis->Print();
+}
+
+/* --Methode-- */
+PIDrawer* NOMAdapter_Histo2D::GetDrawer(string & dopt)
+{
+dopt = "thinline," + dopt;
+return( new PIHisto2D(mHis, false) );
+}
+
+/* --Methode-- */
+P2DArrayAdapter* NOMAdapter_Histo2D::Get2DArray(string & dopt)
+{
+return (new POH2DAdapter(mHis, false) );
+}
+
+/* --Methode-- */
+NTupleInterface* NOMAdapter_Histo2D::GetNTupleInterface()
+{
+return( new NTupInt_Histo2D(mHis) );
+}
+
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+NTupInt_Histo2D::NTupInt_Histo2D(Histo2D* h)
+{
+mHis = h;
+}
+
+/* --Methode-- */
+NTupInt_Histo2D::~NTupInt_Histo2D()
+{
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Histo2D::NbLines()
+{
+return(mHis->NBinX()*mHis->NBinY());
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Histo2D::NbColumns()
+{
+return(6);
+}
+
+/* --Methode-- */
+r_8* NTupInt_Histo2D::GetLineD(int n)
+{
+int i,j;
+float f2,f3;
+if ((n < 0) || (n >= mHis->NBinX()*mHis->NBinY())) 
+    for(i=0; i<6; i++)  mRet[i] = 0.;
+else { 
+  i = n%mHis->NBinX();  j = n/mHis->NBinX(); 
+  mRet[0] = i;  mRet[1] = j;
+  mHis->BinCenter(i,j,f2,f3);
+  mRet[2] = f2;  mRet[3] = f3;  
+  mRet[4] =  (*mHis)(i,j);  mRet[5] = mHis->Error(i, j);
+  }
+return(mRet);
+}
+
+/* --Methode-- */
+string NTupInt_Histo2D::VarList_C(const char* nx)
+{
+string nomx;
+if (nx) nomx = nx;
+else nomx = "_xh_";
+string vardec = "double i,j,x,y,val,err; \n";
+vardec += "i = " + nomx + "[0];  j = " + nomx + "[1]; \n";
+vardec += "x = " + nomx + "[2];  y = " + nomx + "[3]; \n";
+vardec += "val = " + nomx + "[4];  err = " + nomx + "[5]; \n";
+return(vardec);
+}
+
+
+
+//-------------------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet NTuple
+//-------------------------------------------------------------------------
+
+/* --Methode-- */
+NOMAdapter_NTuple::NOMAdapter_NTuple(NTuple* o)
+  : NObjMgrAdapter(o)
+{
+mNt = o;
+}
+
+/* --Methode-- */
+NOMAdapter_NTuple::~NOMAdapter_NTuple()
+{
+}
+
+/* --Methode-- */
+NObjMgrAdapter* NOMAdapter_NTuple::Clone(AnyDataObj* o)
+{
+NTuple* nt = dynamic_cast<NTuple *>(o);
+if (nt) return ( new NOMAdapter_NTuple(nt) );
+return ( new NObjMgrAdapter(o) );
+}
+
+
+/* --Methode-- */
+void NOMAdapter_NTuple::SavePPF(POutPersist& pos, string const & nom)
+{
+#ifdef SANS_EVOLPLANCK
+// PEIDA-EROS L'histo est lui-meme PPersist
+string tag = nom;  // A cause de const
+mNt->Write(pos,0,tag);
+#else
+string s = typeid(*mObj).name();
+cout << "NOMAdapter_NTuple::SavePPF() - Error : Not supported for " << s << endl;
+#endif
+}
+
+/* --Methode-- */
+void NOMAdapter_NTuple::Print(ostream& os)
+{
+os << mNt->Info();
+os << *(mNt);
+}
+
+
+/* --Methode-- */
+NTupleInterface* NOMAdapter_NTuple::GetNTupleInterface()
+{
+return( new NTupInt_NTuple(mNt) );
+}
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+NTupInt_NTuple::NTupInt_NTuple(NTuple* nt)
+{
+mNt = nt;
+}
+
+/* --Methode-- */
+NTupInt_NTuple::~NTupInt_NTuple()
+{
+}
+
+/* --Methode-- */
+uint_4 NTupInt_NTuple::NbLines()
+{
+return(mNt->NEntry());
+}
+
+/* --Methode-- */
+uint_4 NTupInt_NTuple::NbColumns()
+{
+return(mNt->NVar());
+}
+
+/* --Methode-- */
+r_8* NTupInt_NTuple::GetLineD(int n)
+{
+return(mNt->GetVecD(n));
+}
+
+/* --Methode-- */
+string NTupInt_NTuple::VarList_C(const char* nx)
+{
+return(mNt->VarList_C(nx));
+}
Index: trunk/SophyaPI/PIext/nomhistadapter.h
===================================================================
--- trunk/SophyaPI/PIext/nomhistadapter.h	(revision 295)
+++ trunk/SophyaPI/PIext/nomhistadapter.h	(revision 295)
@@ -0,0 +1,127 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Adaptateur d objets (pour NamedObjMgr) pour Histos/NTuple
+//                                    Reza 05/99
+//  LAL-IN2P3/CNRS               CEA-DAPNIA     
+ 
+#ifndef NOMHISTADAPTER_H_SEEN
+#define NOMHISTADAPTER_H_SEEN
+
+#include "nomgadapter.h"
+#include "histos.h"
+#include "histos2.h"
+#include "hisprof.h"
+#include "ntuple.h"
+
+//-------------------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Histo / HProf
+//-------------------------------------------------------------------------
+
+class NOMAdapter_Histo : public NObjMgrAdapter {
+public:
+				NOMAdapter_Histo(Histo* h = NULL);
+  virtual			~NOMAdapter_Histo();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+
+  //  virtual void			ReadFits(string const & flnm);
+  //  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual PIDrawer*		GetDrawer(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface();
+
+protected:
+  Histo* mHis;
+};
+
+// Class Interface NTuple pour Histo / HProf
+class NTupInt_Histo : public NTupleInterface {
+public:
+			NTupInt_Histo(Histo* h);
+  virtual		~NTupInt_Histo();
+  virtual uint_4        NbLines();
+  virtual uint_4        NbColumns();
+  virtual r_8 *         GetLineD(int n);
+  virtual string        VarList_C(const char* nomx=NULL);
+protected:
+  Histo* mHis;
+  r_8 mRet[4];
+};
+
+//-------------------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Histo2D
+//-------------------------------------------------------------------------
+
+class NOMAdapter_Histo2D : public NObjMgrAdapter {
+public:
+				NOMAdapter_Histo2D(Histo2D* h = NULL);
+  virtual			~NOMAdapter_Histo2D();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+
+  //  virtual void			ReadFits(string const & flnm);
+  //  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual PIDrawer*		GetDrawer(string& dopt);
+  virtual P2DArrayAdapter*      Get2DArray(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface();
+
+protected:
+  Histo2D* mHis;
+};
+
+// Class Interface NTuple pour Histo2D
+class NTupInt_Histo2D : public NTupleInterface {
+public:
+			NTupInt_Histo2D(Histo2D* h);
+  virtual		~NTupInt_Histo2D();
+  virtual uint_4        NbLines();
+  virtual uint_4        NbColumns();
+  virtual r_8 *         GetLineD(int n);
+  virtual string        VarList_C(const char* nomx=NULL);
+protected:
+  Histo2D* mHis;
+  r_8 mRet[6];
+};
+
+
+//-------------------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet NTuple 
+//-------------------------------------------------------------------------
+
+class NOMAdapter_NTuple : public NObjMgrAdapter {
+public:
+				NOMAdapter_NTuple(NTuple* h = NULL);
+  virtual			~NOMAdapter_NTuple();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+
+  //  virtual void			ReadFits(string const & flnm);
+  //  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual NTupleInterface*	GetNTupleInterface();
+
+protected:
+  NTuple* mNt;
+};
+
+// Class Interface NTuple pour NTuple 
+class NTupInt_NTuple : public NTupleInterface {
+public:
+			NTupInt_NTuple(NTuple* nt);
+  virtual		~NTupInt_NTuple();
+  virtual uint_4        NbLines();
+  virtual uint_4        NbColumns();
+  virtual r_8 *         GetLineD(int n);
+  virtual string        VarList_C(const char* nomx=NULL);
+protected:
+  NTuple* mNt;
+};
+
+
+#endif
Index: trunk/SophyaPI/PIext/nomimagadapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nomimagadapter.cc	(revision 295)
+++ trunk/SophyaPI/PIext/nomimagadapter.cc	(revision 295)
@@ -0,0 +1,167 @@
+#include "machdefs.h"
+#include <stdlib.h>
+#include <typeinfo>
+#include <iostream.h>
+#include <string>
+
+#include "nomimagadapter.h"
+#include "fitsimage.h"
+#include "pimgadapter.h"
+
+
+//---------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Image<T> 
+//---------------------------------------------------------------
+
+
+/* --Methode-- */
+template <class T>
+NOMAdapter_Image<T>::NOMAdapter_Image(Image<T> * o)
+  : NObjMgrAdapter(o)
+{
+mImg = o;
+}
+
+/* --Methode-- */
+template <class T>
+NOMAdapter_Image<T>::~NOMAdapter_Image()
+{
+}
+
+/* --Methode-- */
+template <class T>
+NObjMgrAdapter* NOMAdapter_Image<T>::Clone(AnyDataObj* o)
+{
+Image<T>* im = dynamic_cast<Image<T> *>(o);
+if (im) return ( new NOMAdapter_Image<T>(im) );
+return ( new NObjMgrAdapter(o) );
+}
+
+
+/* --Methode-- */
+template <class T>
+void NOMAdapter_Image<T>::SaveFits(string const & flnm)
+{
+#ifdef SANS_EVOLPLANCK
+FitsImage<T> fim(*mImg, 1);
+fim.Save(flnm);
+#else
+cout << "NOMAdapter_Image<T>::SaveFits() - Error : Not supported for " << s << endl;
+#endif
+}
+
+/* --Methode-- */
+template <class T>
+void NOMAdapter_Image<T>::SavePPF(POutPersist& pos, string const & nom)
+{
+#ifdef SANS_EVOLPLANCK
+// PEIDA-EROS L'histo est lui-meme PPersist
+string tag = nom;  // A cause de const
+mImg->Write(pos,0,tag);
+#else
+string s = typeid(*mObj).name();
+cout << "NOMAdapter_Image<T>::SavePPF() - Error : Not supported for " << s << endl;
+#endif
+}
+
+/* --Methode-- */
+template <class T>
+void NOMAdapter_Image<T>::Print(ostream& os)
+{
+os << (*mImg);
+}
+
+
+/* --Methode-- */
+template <class T>
+P2DArrayAdapter* NOMAdapter_Image<T>::Get2DArray(string &)
+{
+return ( new ImageAdapter<T>(mImg, false) );
+}
+
+/* --Methode-- */
+template <class T>
+NTupleInterface* NOMAdapter_Image<T>::GetNTupleInterface()
+{
+return( new NTupInt_Image<T>(mImg) );
+}
+
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+template <class T>
+NTupInt_Image<T>::NTupInt_Image(Image<T>* m)
+{
+mImg = m;
+}
+
+/* --Methode-- */
+template <class T>
+NTupInt_Image<T>::~NTupInt_Image()
+{
+}
+
+/* --Methode-- */
+template <class T>
+uint_4 NTupInt_Image<T>::NbLines()
+{
+return( mImg->XSize() * mImg->YSize() );
+}
+
+/* --Methode-- */
+template <class T>
+uint_4 NTupInt_Image<T>::NbColumns()
+{
+return(3);
+}
+
+/* --Methode-- */
+template <class T>
+r_8* NTupInt_Image<T>::GetLineD(int n)
+{
+int i,j;
+if ((n < 0) || (n >= mImg->XSize() * mImg->YSize() )) 
+    for(i=0; i<3; i++)  mRet[i] = 0.;
+else { 
+  i = n%mImg->XSize();  j = n/mImg->XSize(); 
+  mRet[0] = i;  mRet[1] = j;  mRet[2] = (*mImg)(i,j);
+  }
+return(mRet);
+}
+
+/* --Methode-- */
+template <class T>
+string NTupInt_Image<T>::VarList_C(const char* nx)
+{
+string nomx;
+if (nx) nomx = nx;
+else nomx = "_xh_";
+string vardec = "double x,y,pix,i,j,val; \n";
+vardec += "x = i = " + nomx + "[0]; y = j = " + nomx + "[1];  pix = val = " + nomx + "[2]; \n";
+return(vardec);
+}
+
+#ifdef __CXX_PRAGMA_TEMPLATES__
+#pragma define_template NOMAdapter_Image<uint_2>
+#pragma define_template NOMAdapter_Image<int_2>
+#pragma define_template NOMAdapter_Image<int_4>
+#pragma define_template NOMAdapter_Image<r_4>
+#pragma define_template NTupInt_Image<uint_2>
+#pragma define_template NTupInt_Image<int_2>
+#pragma define_template NTupInt_Image<int_4>
+#pragma define_template NTupInt_Image<r_4>
+#endif
+#if defined(__ANSI_TEMPLATES__)
+template class NOMAdapter_Image<uint_2>;
+template class NOMAdapter_Image<int_2>;
+template class NOMAdapter_Image<int_4>;
+template class NOMAdapter_Image<r_4>;
+template class NTupInt_Image<uint_2>;
+template class NTupInt_Image<int_2>;
+template class NTupInt_Image<int_4>;
+template class NTupInt_Image<r_4>;
+#endif
+
+
Index: trunk/SophyaPI/PIext/nomimagadapter.h
===================================================================
--- trunk/SophyaPI/PIext/nomimagadapter.h	(revision 295)
+++ trunk/SophyaPI/PIext/nomimagadapter.h	(revision 295)
@@ -0,0 +1,55 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Adaptateur d objets (pour NamedObjMgr) pour Histos/NTuple
+//                                    Reza 05/99
+//  LAL-IN2P3/CNRS               CEA-DAPNIA     
+ 
+#ifndef NOMIMAGADAPTER_H_SEEN
+#define NOMIMAGADAPTER_H_SEEN
+
+#include "nomgadapter.h"
+#include "cimage.h"
+
+
+
+//---------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet  Image<T> 
+//---------------------------------------------------------------
+
+template <class T>
+class NOMAdapter_Image : public NObjMgrAdapter {
+public:
+				NOMAdapter_Image(Image<T> * o = NULL);
+  virtual			~NOMAdapter_Image();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+
+  //  virtual void			ReadFits(string const & flnm);
+  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual P2DArrayAdapter*	Get2DArray(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface();
+
+protected:
+  Image<T> * mImg;
+};
+
+// Class Interface NTuple pour Image
+
+template <class T>
+class NTupInt_Image : public NTupleInterface {
+public:
+			NTupInt_Image(Image<T> * m);
+  virtual		~NTupInt_Image();
+  virtual uint_4        NbLines();
+  virtual uint_4        NbColumns();
+  virtual r_8 *         GetLineD(int n);
+  virtual string        VarList_C(const char* nomx=NULL);
+protected:
+  Image<T> * mImg;
+  r_8 mRet[3];
+};
+
+
+#endif
Index: trunk/SophyaPI/PIext/nommatvecadapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nommatvecadapter.cc	(revision 295)
+++ trunk/SophyaPI/PIext/nommatvecadapter.cc	(revision 295)
@@ -0,0 +1,225 @@
+#include "machdefs.h"
+#include <stdlib.h>
+#include <typeinfo>
+#include <iostream.h>
+#include <string>
+
+#include "nommatvecadapter.h"
+#include "piscdrawwdg.h"
+#include "pipodrw.h"
+
+//---------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Vector 
+//---------------------------------------------------------------
+
+/* --Methode-- */
+NOMAdapter_Vector::NOMAdapter_Vector(Vector* o)
+  : NObjMgrAdapter(o)
+{
+mVec = o;
+}
+
+/* --Methode-- */
+NOMAdapter_Vector::~NOMAdapter_Vector()
+{
+}
+
+/* --Methode-- */
+NObjMgrAdapter* NOMAdapter_Vector::Clone(AnyDataObj* o)
+{
+Vector* v = dynamic_cast<Vector *>(o);
+if (v) return ( new NOMAdapter_Vector(v) );
+return ( new NObjMgrAdapter(o) );
+}
+
+
+/* --Methode-- */
+void NOMAdapter_Vector::SavePPF(POutPersist& pos, string const & nom)
+{
+#ifdef SANS_EVOLPLANCK
+// PEIDA-EROS L'histo est lui-meme PPersist
+string tag = nom;  // A cause de const
+mVec->Write(pos,0,tag);
+#else
+string s = typeid(*mObj).name();
+cout << "NOMAdapter_Vector::SavePPF() - Error : Not supported for " << s << endl;
+#endif
+}
+
+/* --Methode-- */
+void NOMAdapter_Vector::Print(ostream& os)
+{
+os << (*mVec);
+}
+
+/* --Methode-- */
+PIDrawer* NOMAdapter_Vector::GetDrawer(string & dopt)
+{
+dopt = "thinline," + dopt;
+return( new PIYfXDrawer( new POVectorAdapter(mVec, false), NULL, true) );
+}
+
+/* --Methode-- */
+NTupleInterface* NOMAdapter_Vector::GetNTupleInterface()
+{
+return( new NTupInt_Vector(mVec) );
+}
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+NTupInt_Vector::NTupInt_Vector(Vector* v)
+{
+mVec = v;
+}
+
+/* --Methode-- */
+NTupInt_Vector::~NTupInt_Vector()
+{
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Vector::NbLines()
+{
+return(mVec->NElts());
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Vector::NbColumns()
+{
+return(2);
+}
+
+/* --Methode-- */
+r_8* NTupInt_Vector::GetLineD(int n)
+{
+int i;
+if ((n < 0) || (n >= mVec->NElts() )) 
+    for(i=0; i<2; i++)  mRet[i] = 0.;
+else { 
+  mRet[0] = n;  mRet[1] = (*mVec)(n);
+  }
+return(mRet);
+}
+
+/* --Methode-- */
+string NTupInt_Vector::VarList_C(const char* nx)
+{
+string nomx;
+if (nx) nomx = nx;
+else nomx = "_xh_";
+string vardec = "double i,val; \n";
+vardec += "i = " + nomx + "[0];  val = " + nomx + "[1]; \n";
+return(vardec);
+}
+
+
+//---------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Matrix 
+//---------------------------------------------------------------
+
+
+/* --Methode-- */
+NOMAdapter_Matrix::NOMAdapter_Matrix(Matrix* o)
+  : NObjMgrAdapter(o)
+{
+mMtx = o;
+}
+
+/* --Methode-- */
+NOMAdapter_Matrix::~NOMAdapter_Matrix()
+{
+}
+
+/* --Methode-- */
+NObjMgrAdapter* NOMAdapter_Matrix::Clone(AnyDataObj* o)
+{
+Matrix* m = dynamic_cast<Matrix *>(o);
+if (m) return ( new NOMAdapter_Matrix(m) );
+return ( new NObjMgrAdapter(o) );
+}
+
+
+/* --Methode-- */
+void NOMAdapter_Matrix::SavePPF(POutPersist& pos, string const & nom)
+{
+#ifdef SANS_EVOLPLANCK
+// PEIDA-EROS L'histo est lui-meme PPersist
+string tag = nom;  // A cause de const
+mMtx->Write(pos,0,tag);
+#else
+string s = typeid(*mObj).name();
+cout << "NOMAdapter_Matrix::SavePPF() - Error : Not supported for " << s << endl;
+#endif
+}
+
+/* --Methode-- */
+void NOMAdapter_Matrix::Print(ostream& os)
+{
+os << (*mMtx);
+}
+
+
+/* --Methode-- */
+P2DArrayAdapter* NOMAdapter_Matrix::Get2DArray(string &)
+{
+return ( new POMatrixAdapter(mMtx, false) );
+}
+
+/* --Methode-- */
+NTupleInterface* NOMAdapter_Matrix::GetNTupleInterface()
+{
+return( new NTupInt_Matrix(mMtx) );
+}
+
+
+
+// -------------------------------------------------------------
+
+/* --Methode-- */
+NTupInt_Matrix::NTupInt_Matrix(Matrix* m)
+{
+mMtx = m;
+}
+
+/* --Methode-- */
+NTupInt_Matrix::~NTupInt_Matrix()
+{
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Matrix::NbLines()
+{
+return( mMtx->NRows()*mMtx->NCol() );
+}
+
+/* --Methode-- */
+uint_4 NTupInt_Matrix::NbColumns()
+{
+return(3);
+}
+
+/* --Methode-- */
+r_8* NTupInt_Matrix::GetLineD(int n)
+{
+int i,j;
+if ((n < 0) || (n >= mMtx->NRows()*mMtx->NCol() )) 
+    for(i=0; i<3; i++)  mRet[i] = 0.;
+else { 
+  i = n/mMtx->NCol(); j = n%mMtx->NCol(); 
+  mRet[0] = i;  mRet[1] = j;  mRet[2] = (*mMtx)(i,j);
+  }
+return(mRet);
+}
+
+/* --Methode-- */
+string NTupInt_Matrix::VarList_C(const char* nx)
+{
+string nomx;
+if (nx) nomx = nx;
+else nomx = "_xh_";
+string vardec = "double i,j,val; \n";
+vardec += "i = " + nomx + "[0]; j = " + nomx + "[1];  val = " + nomx + "[2]; \n";
+return(vardec);
+}
Index: trunk/SophyaPI/PIext/nommatvecadapter.h
===================================================================
--- trunk/SophyaPI/PIext/nommatvecadapter.h	(revision 295)
+++ trunk/SophyaPI/PIext/nommatvecadapter.h	(revision 295)
@@ -0,0 +1,91 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Adaptateur d objets (pour NamedObjMgr) pour Histos/NTuple
+//                                    Reza 05/99
+//  LAL-IN2P3/CNRS               CEA-DAPNIA     
+ 
+#ifndef NOMMATVECADAPTER_H_SEEN
+#define NOMMATVECADAPTER_H_SEEN
+
+#include "nomgadapter.h"
+#include "matrix.h"
+#include "cvector.h"
+
+//---------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Vector 
+//---------------------------------------------------------------
+
+class NOMAdapter_Vector : public NObjMgrAdapter {
+public:
+				NOMAdapter_Vector(Vector* v = NULL);
+  virtual			~NOMAdapter_Vector();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+
+  //  virtual void			ReadFits(string const & flnm);
+  //  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual PIDrawer*		GetDrawer(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface();
+
+protected:
+  Vector* mVec;
+};
+
+// Class Interface NTuple pour Vector
+class NTupInt_Vector : public NTupleInterface {
+public:
+			NTupInt_Vector(Vector* v);
+  virtual		~NTupInt_Vector();
+  virtual uint_4        NbLines();
+  virtual uint_4        NbColumns();
+  virtual r_8 *         GetLineD(int n);
+  virtual string        VarList_C(const char* nomx=NULL);
+protected:
+  Vector* mVec;
+  r_8 mRet[2];
+};
+
+
+
+//---------------------------------------------------------------
+// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet Matrix 
+//---------------------------------------------------------------
+
+class NOMAdapter_Matrix : public NObjMgrAdapter {
+public:
+				NOMAdapter_Matrix(Matrix* m = NULL);
+  virtual			~NOMAdapter_Matrix();
+
+  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);
+
+  //  virtual void			ReadFits(string const & flnm);
+  //  virtual void			SaveFits(string const & flnm);
+  virtual void			SavePPF(POutPersist& s, string const & nom);
+
+  virtual void			Print(ostream& os);
+  virtual P2DArrayAdapter*	Get2DArray(string& dopt);
+  virtual NTupleInterface*	GetNTupleInterface();
+
+protected:
+  Matrix* mMtx;
+};
+
+// Class Interface NTuple pour Matrix
+
+class NTupInt_Matrix : public NTupleInterface {
+public:
+			NTupInt_Matrix(Matrix* m);
+  virtual		~NTupInt_Matrix();
+  virtual uint_4        NbLines();
+  virtual uint_4        NbColumns();
+  virtual r_8 *         GetLineD(int n);
+  virtual string        VarList_C(const char* nomx=NULL);
+protected:
+  Matrix* mMtx;
+  r_8 mRet[3];
+};
+
+
+#endif
Index: trunk/SophyaPI/PIext/ntupintf.h
===================================================================
--- trunk/SophyaPI/PIext/ntupintf.h	(revision 295)
+++ trunk/SophyaPI/PIext/ntupintf.h	(revision 295)
@@ -0,0 +1,18 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Interface de type NTuple           Reza 05/99
+// LAL-IN2P3/CNRS               CEA-DAPNIA      
+
+#ifndef NTUPLEINTERFACE_H_SEEN
+#define NTUPLEINTERFACE_H_SEEN
+#include "machdefs.h"
+
+class NTupleInterface {
+public:
+  virtual		~NTupleInterface() { } 
+  virtual uint_4        NbLines()=0;
+  virtual uint_4        NbColumns()=0;
+  virtual r_8 *         GetLineD(int n)=0;
+  virtual string	VarList_C(const char* nomx=NULL)=0;
+};
+
+#endif
Index: trunk/SophyaPI/PIext/pihisto.cc
===================================================================
--- trunk/SophyaPI/PIext/pihisto.cc	(revision 294)
+++ trunk/SophyaPI/PIext/pihisto.cc	(revision 295)
@@ -1,3 +1,5 @@
 #include <stdio.h>
+#include <typeinfo>
+
 #include "pihisto.h"
 #include "hisprof.h"
@@ -21,5 +23,5 @@
   float hmax = mHisto->VMax()+0.2*(mHisto->VMax()-mHisto->VMin());
   // si HBProf min,max calcules en tenant compte des erreurs
-  if( mHisto->ClassId() == HProf::classId ) {
+  if( typeid(*mHisto) == typeid(HProf) ) {
     float v1,v2;
     for (int i=1; i<mHisto->NBins(); i++) {
@@ -43,5 +45,5 @@
   if (!mHisto)  return;  
 
-  if (mMrk != PI_NotDefMarker || mHisto->ClassId() == HProf::classId ) {
+  if (mMrk != PI_NotDefMarker ||  ( typeid(*mHisto) == typeid(HProf) ) )  {
     // Marqeurs definis OU HBProf => marqueurs+Erreurs si il y en a
     if (mLAtt == PI_NotDefLineAtt) g->SelLine(PI_ThinLine);
Index: trunk/SophyaPI/PIext/piinit.cc
===================================================================
--- trunk/SophyaPI/PIext/piinit.cc	(revision 294)
+++ trunk/SophyaPI/PIext/piinit.cc	(revision 295)
@@ -1,17 +1,42 @@
 #include "machdefs.h"
 #include "piinit.h"
+#include "nobjmgr.h"
+#include "servnobjm.h"
+#include "nomhistadapter.h"
+#include "nommatvecadapter.h"
+#include "nomimagadapter.h"
+#include "fitsimage.h"
 
 
-int PeidaInteractiveInitiator::FgInit = 0;
+int PIAppInitiator::FgInit = 0;
 
-PeidaInteractiveInitiator::PeidaInteractiveInitiator()
+PIAppInitiator::PIAppInitiator(PIStdImgApp * app)
  : PeidaOutilsInitiator()
 {
   FgInit++;
   if (FgInit > 1)  return;
+
+  Services2NObjMgr* serv = app->ObjMgr()->GetServiceObj();
+
+  serv->RegisterClass(new Histo, new NOMAdapter_Histo );
+  serv->RegisterClass(new Histo2D, new NOMAdapter_Histo2D );
+  serv->RegisterClass(new NTuple, new NOMAdapter_NTuple );
+
+  serv->RegisterClass(new Vector, new NOMAdapter_Vector );
+  serv->RegisterClass(new Matrix, new NOMAdapter_Matrix );
+
+  serv->RegisterClass(new Image<uint_2>, new  NOMAdapter_Image<uint_2> );
+  serv->RegisterClass(new Image<int_2>, new  NOMAdapter_Image<int_2> );
+  serv->RegisterClass(new Image<int_4>, new  NOMAdapter_Image<int_4> );
+  serv->RegisterClass(new Image<r_4>, new  NOMAdapter_Image<r_4> );
+  
+  serv->RegisterClass(new FitsImage<uint_2>, new  NOMAdapter_Image<uint_2> );
+  serv->RegisterClass(new FitsImage<int_2>, new  NOMAdapter_Image<int_2> );
+  serv->RegisterClass(new FitsImage<int_4>, new  NOMAdapter_Image<int_4> );
+  serv->RegisterClass(new FitsImage<r_4>, new  NOMAdapter_Image<r_4> );
   
 } 
 
-PeidaInteractiveInitiator::~PeidaInteractiveInitiator()
+PIAppInitiator::~PIAppInitiator()
 {
   FgInit--;
@@ -21,5 +46,2 @@
 }
 
-// On met un objet initiator en statique, pour les loaders qui savent 
-// appeler le constructeur des objets statiques   Reza 08/98
-static PeidaInteractiveInitiator  pinteractivexxinit;
Index: trunk/SophyaPI/PIext/piinit.h
===================================================================
--- trunk/SophyaPI/PIext/piinit.h	(revision 294)
+++ trunk/SophyaPI/PIext/piinit.h	(revision 295)
@@ -3,17 +3,16 @@
 
 #include "outilsinit.h"
+#include "pistdimgapp.h"
 
-// Classe d'initialisation pour le module PI de PEIDA
+// Classe d initialisation pour le module PI de PEIDA
 
-class PeidaInteractiveInitiator : public PeidaOutilsInitiator {
+class PIAppInitiator : public PeidaOutilsInitiator {
 private:
   static int FgInit;
 public:
-  		PeidaInteractiveInitiator();
- virtual	~PeidaInteractiveInitiator();
+  		PIAppInitiator(PIStdImgApp *);
+ virtual	~PIAppInitiator();
 };
 
-#undef PeidaInit
-#define PeidaInit() PeidaInteractiveInitiator peidainitiator
 
 #endif
Index: trunk/SophyaPI/PIext/pisiadw.cc
===================================================================
--- trunk/SophyaPI/PIext/pisiadw.cc	(revision 294)
+++ trunk/SophyaPI/PIext/pisiadw.cc	(revision 295)
@@ -3,4 +3,6 @@
 #include <stdio.h>
 #include <string.h>
+
+#include <typeinfo>
 
 #include "perrors.h"
@@ -215,5 +217,6 @@
   if (ln <= 0)  nom = "?";
   else { strncpy(noms, mPin->TagName(i).c_str(), 31);  noms[31] = '\0'; nom = noms; }
-  sprintf(strg, "%s  (T=%s, Key=%d)",  nom, dap->ObjMgr()->GetServiceObj()->PClassIdToClassName(cid), key);
+//  sprintf(strg, "%s  (T=%s, Key=%d)",  nom, dap->ObjMgr()->GetServiceObj()->PClassIdToClassName(cid), key);
+  sprintf(strg, "%s  (T=%s, Key=%d)",  nom, " DataObject ?", key);
   objlist->AppendItem(strg, 5000+i);
 }
Index: trunk/SophyaPI/PIext/pistdimgapp.cc
===================================================================
--- trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 294)
+++ trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 295)
@@ -3,4 +3,6 @@
 #include <stdio.h>
 #include <string.h>
+
+#include <typeinfo>
 
 #include <string>
@@ -28,4 +30,6 @@
 
 #include "pistzwin.h"
+
+#include "piinit.h"
 
 
@@ -192,4 +196,6 @@
 SaveGraphicAtt();
 
+// Initialisation 
+PIAppInitiator * piai = new PIAppInitiator(this);
 SetReady();
 }
@@ -421,5 +427,5 @@
 
 /* --Methode-- */
-int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, bool h2d)
+int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title)
 {
 if (scd == NULL)
@@ -452,5 +458,6 @@
 sy = 200+mFgScSz*100;
 win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
-if (!h2d) scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
+if (typeid(*scd) != typeid(PIHisto2D)) 
+   scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
 else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
 scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
@@ -458,5 +465,5 @@
 scw->SetAxesFlags(mAxesFlags);
 
-if (!h2d) scw->AddScDrawer(scd, true);
+if (typeid(*scd) != typeid(PIHisto2D)) scw->AddScDrawer(scd, true);
 else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
 //   Titre du plot
Index: trunk/SophyaPI/PIext/pistdimgapp.h
===================================================================
--- trunk/SophyaPI/PIext/pistdimgapp.h	(revision 294)
+++ trunk/SophyaPI/PIext/pistdimgapp.h	(revision 295)
@@ -47,5 +47,5 @@
 
      int  DispImage(P2DArrayAdapter* nouv, string const & name, int opt);
-     int  DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="", bool h2d=false);
+     int  DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="");
      int  Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="");
 
Index: trunk/SophyaPI/PIext/servnobjm.cc
===================================================================
--- trunk/SophyaPI/PIext/servnobjm.cc	(revision 294)
+++ trunk/SophyaPI/PIext/servnobjm.cc	(revision 295)
@@ -3,4 +3,5 @@
 #include <ctype.h>
 
+#include <typeinfo>
 #include <iostream.h>
 #include <string>
@@ -14,5 +15,4 @@
 
 #include "strutil.h"
-#include "datatypes.h"
 
 #include "nobjmgr.h"
@@ -20,20 +20,9 @@
 #include "pistdimgapp.h"
 
-#include "pclassids.h"
 #include "histos.h"
 #include "histos2.h"
 #include "ntuple.h"
 #include "hisprof.h"
-#include "generaldata.h"
-
-#include "cimage.h"
-#include "cvector.h"
-#include "matrix.h"
-
-//  Si le module StarReco++ a ete compile (Pour les StarList, Transfo, etc ...
-#ifdef SANS_EVOLPLANCK 
-#include "stlist.h"
-#include "star.h"
-#endif
+
 
 
@@ -55,66 +44,33 @@
 
 /* --Methode-- */
-void Services2NObjMgr::Nobj_ComputeExpressions(PPersist* obj, string& expx, string& expy, string& expz, 
+void Services2NObjMgr::RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa)
+{
+ObjAdaptList::iterator it;
+for(it = objadaplist.begin(); it != objadaplist.end(); it++) 
+    if (typeid(*o) == typeid(*((*it).obj)))  THROW(dupIdErr);
+
+dataobj_adapter oba;
+oba.obj = o;
+oba.obja = oa;
+objadaplist.push_back(oba);
+}
+
+/* --Methode-- */
+NObjMgrAdapter* Services2NObjMgr::GetAdapter(AnyDataObj* o)
+{
+ObjAdaptList::iterator it;
+for(it = objadaplist.begin(); it != objadaplist.end(); it++) 
+  if (typeid(*o) == typeid(*((*it).obj)))  return((*it).obja->Clone(o));
+return(new NObjMgrAdapter(o));
+}
+
+/* --Methode-- */
+void Services2NObjMgr::Nobj_ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, string& expz, 
                           string& expwt, string& expcut, NTuple* nt, Histo* h1, Histo2D* h2, HProf* hp)
 {
-int cid = obj->ClassId();
-
-string vardec;
-switch (cid) {
-  case ClassId_Vector : 
-    vardec = "double i,val; \n";
-    vardec += "i = _zz61qq_[0];  val = _zz61qq_[1]; \n";
-    break;
-
-  case ClassId_Matrix : 
-    vardec = "double i,j,val; \n";
-    vardec += "i = _zz61qq_[0];  j = _zz61qq_[1];  val = _zz61qq_[2]; \n";
-    break;
-
-  case ClassId_Histo1D : 
-  case ClassId_HProf : 
-    vardec = "double i,x,val,err; \n";
-    vardec += "i = _zz61qq_[0];  x = _zz61qq_[1];  val = _zz61qq_[2];  err = _zz61qq_[3]; \n";
-    break;
-
-  case ClassId_Histo2D : 
-    vardec = "double i,j,x,y,val,err; \n";
-    vardec += "i = _zz61qq_[0];  j = _zz61qq_[1]; \n";  
-    vardec += "x = _zz61qq_[2];  y = _zz61qq_[3]; \n";  
-    vardec += "val = _zz61qq_[4]; err = _zz61qq_[5]; \n";
-    break;
-
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 : 
-  case ClassId_Image + kint_1 : 
-  case ClassId_Image + kr_8 : 
-  case ClassId_Image + kuint_4 : 
-  case ClassId_Image + kuint_2 : 
-  case ClassId_Image + kint_2 : 
-  case ClassId_Image + kint_4 : 
-  case ClassId_Image + kr_4 : 
-    vardec = "double x,y,pix,i,j,val; \n";
-    vardec += "x = i = _zz61qq_[0];  y = j = _zz61qq_[1];  pix = val = _zz61qq_[2]; \n";
-    break;
-
-#ifdef SANS_EVOLPLANCK 
-  case ClassId_StarList : 
-    vardec = "double x,y,flux,fond; \n";
-    vardec += "x = _zz61qq_[0];  y = _zz61qq_[1];  flux = _zz61qq_[2];  fond =  _zz61qq_[3]; \n";
-    break;
-#endif
-
-  case ClassId_NTuple :
-    vardec = ((NTuple*)obj)->VarList_C("_zz61qq_");
-    break;
-
-  case ClassId_GeneralFitData :
-    vardec = ((GeneralFitData*)obj)->VarList_C("_zz61qq_");
-    break;
-
-  default :
-    cerr << "NamedObjMgr_ComputeExpressions() Error , N/A to " << PClassIdToClassName(cid) << endl; 
-    return;
-  }
+if (obja == NULL) return;
+NTupleInterface* objnt = obja->GetNTupleInterface();
+if (objnt == NULL)  return;
+string  vardec = objnt->VarList_C("_zz61qq_");
 
 PlotExprFunc f = LinkExprFunc(vardec, expx, expy, expz, expwt, expcut);
@@ -124,162 +80,26 @@
   }
 
-float x[10], xnt[10];
+double xnt[10];
+float  fxnt[10];
 
 int i,j,k;
-for(i=0; i<10; i++) x[i] = xnt[i] = 0.;
-
-TRY {                                 
-switch (cid) {
-  case ClassId_Vector :
-    { 
-    Vector* vv = (Vector*)obj;
-    for(k=0; k<vv->NElts(); k++) {
-      x[0] = k;   x[1] = (*vv)(k);
-      if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-        if (nt) nt->Fill(xnt);
-        if (h1) h1->Add(xnt[0], xnt[3]);
-        if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-        if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-        }
+for(i=0; i<10; i++) xnt[i] = 0.;
+
+TRY  {
+  double* xn;
+  for(k=0; k<objnt->NbLines(); k++)    {
+    xn = objnt->GetLineD(k);
+    if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
+      if (nt) { 
+         for(i=0; i<4; i++) fxnt[i] = xnt[i]; 
+         nt->Fill(fxnt);
+         }
+      if (h1) h1->Add(xnt[0], xnt[3]);
+      if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
+      if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
       }
     }
-    break;
-
-  case ClassId_Matrix : 
-    {
-    Matrix* mm = (Matrix*)obj;
-    for(j=0; j<mm->NCol(); j++)
-      for(i=0; i<mm->NRows(); i++) {
-      x[0] = i; x[1] = j;  x[2] = (*mm)(i,j);
-      if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-        if (nt) nt->Fill(xnt);
-        if (h1) h1->Add(xnt[0], xnt[3]);
-        if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-        if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-        }
-      }
-    }
-    break;
-
-  case ClassId_Histo1D : 
-  case ClassId_HProf : 
-    {
-    Histo* hh = (Histo*)obj;
-    for(k=0; k<hh->NBins(); k++) {
-      x[0] = k;  x[1] = hh->BinCenter(k);   
-      x[2] = (*hh)(k);  x[3] = hh->Error(k);
-      if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-        if (nt) nt->Fill(xnt);
-        if (h1) h1->Add(xnt[0], xnt[3]);
-        if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-        if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-        }
-      }
-    }
-    break;
-
-  case ClassId_Histo2D : 
-    {
-    Histo2D* hh = (Histo2D*)obj;
-    for(j=0; j<hh->NBinY(); j++)
-      for(i=0; i<hh->NBinX(); i++) {
-      x[0] = i;   x[1] = j; 
-      hh->BinCenter(i,j,x[2],x[3]); 
-      x[4] = (*hh)(i,j);  x[5] = hh->Error(i, j);
-      if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-        if (nt) nt->Fill(xnt);
-        if (h1) h1->Add(xnt[0], xnt[3]);
-        if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-        if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-        }
-      }
-    }
-    break;
-
-
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 : 
-  case ClassId_Image + kint_1 : 
-  case ClassId_Image + kr_8 : 
-  case ClassId_Image + kuint_4 : 
-  case ClassId_Image + kuint_2 : 
-  case ClassId_Image + kint_2 : 
-  case ClassId_Image + kint_4 : 
-  case ClassId_Image + kr_4 :
-    {
-    RzImage* img = (RzImage*)obj; 
-    for(j=0; j<img->YSize(); j++)
-      for(i=0; i<img->XSize(); i++) {
-        x[0] = i;  x[1] = j;  x[2] = img->FValue(i, j);
-        if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-          if (nt) nt->Fill(xnt);
-          if (h1) h1->Add(xnt[0], xnt[3]);
-          if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-          if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-          }
-      }
-    }
-    break;
-
-#ifdef SANS_EVOLPLANCK 
-  case ClassId_StarList : 
-    {
-    StarList* stl = (StarList*)obj;
-    BStar *sti;
-    for(k=0; k<stl->NbStars(); k++) {
-      sti = stl->Star(k);
-      if ( (!sti) || !(sti->Nice(BStar::flagOK)) )  continue;
-      x[0] = sti->PosX();   x[1] = sti->PosY();
-      x[2] = sti->Flux();   x[3] =  sti->Fond();  
-      if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-        if (nt) nt->Fill(xnt);
-        if (h1) h1->Add(xnt[0], xnt[3]);
-        if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-        if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-        }
-      }
-    }
-    break;
-#endif
-
-  case ClassId_NTuple :
-    {
-    NTuple* ntp = (NTuple*)obj;
-    r_4* xn;
-    for(k=0; k<ntp->NEntry(); k++)    {
-      xn = ntp->GetVec(k);
-      if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-        if (nt) nt->Fill(xnt);
-        if (h1) h1->Add(xnt[0], xnt[3]);
-        if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-        if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-        }
-      }
-    }
-    break;
-
-  case ClassId_GeneralFitData :
-    {
-    GeneralFitData* data = (GeneralFitData*)obj;
-    r_4* xn;
-    int iok = 2*data->NVar()+2;
-    for(k=0; k<data->NData(); k++) {
-      xn = data->GetVecR4(k);
-      if(xn[iok]<0.001) continue;
-      if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
-        if (nt) nt->Fill(xnt);
-        if (h1) h1->Add(xnt[0], xnt[3]);
-        if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
-        if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
-      }
-    }
-    }
-    break;
-
-  default :
-    cout << "NamedObjMgr_ComputeExpressions() Erreur: N/A to  " << PClassIdToClassName(cid) << endl; 
-    return;
-  }
-} CATCH(merr) {
+ }
+CATCH(merr) {
   fflush(stdout); 
   cout << endl; 
@@ -318,5 +138,5 @@
 // constitution du fichier a compiler
 fputs("#include <math.h> \n", fip);
-fputs("int expf_pia_dl_func(float* _zz61qq_, float* _rx_61qq_, float* _ry_61qq_, float* _rz_61qq_, float* _wt_61qq_) \n{\n", fip);
+fputs("int expf_pia_dl_func(double* _zz61qq_, double* _rx_61qq_, double* _ry_61qq_, double* _rz_61qq_, double* _wt_61qq_) \n{\n", fip);
 fprintf(fip,"%s \n", vardec.c_str());
 fprintf(fip, "if (!(%s)) { *_rx_61qq_ = *_ry_61qq_ = *_rz_61qq_ = *_wt_61qq_ = 0.;  return(0); } \n", cut.c_str());
@@ -465,148 +285,5 @@
 }
 
-/* --Methode-- */
-char* Services2NObjMgr::PClassIdToClassName(int cid)
-{
-switch (cid) {
-  case ClassId_Poly1 : 
-    return("Poly1");
-  case ClassId_Poly2 : 
-    return("Poly2");
-  case ClassId_Matrix : 
-    return("Matrix");
-  case ClassId_Vector : 
-    return("Vector");
-
-  case ClassId_DVList : 
-    return("DVList");
-
-  case ClassId_Histo1D : 
-    return("Histo1D");
-  case ClassId_Histo2D : 
-    return("Histo2D");
-  case ClassId_HProf : 
-    return("HProf");
-  case ClassId_NTuple : 
-    return("NTuple");
-  case ClassId_GeneralFitData : 
-    return("GeneralFitData");
-
-  case ClassId_Image : 
-    return("RzImage");
-  case ClassId_Image + kuint_1 : 
-    return("ImageU1");
-  case ClassId_Image + kint_1 : 
-    return("ImageI1");
-  case ClassId_Image + kuint_2 : 
-    return("ImageU2");
-  case ClassId_Image + kint_2 : 
-    return("ImageI2");
-  case ClassId_Image + kuint_4 : 
-    return("ImageU4");
-  case ClassId_Image + kint_4 : 
-    return("ImageI4");
-  case ClassId_Image + kr_4 : 
-    return("ImageR4");
-  case ClassId_Image + kr_8 : 
-    return("ImageR8");
-
-  case ClassId_ZFidu : 
-    return("ZFidu");
-
-#ifdef SANS_EVOLPLANCK 
-  case ClassId_StarList : 
-    return("StarList");
-  case ClassId_Transfo : 
-    return("Transfo");
-  case ClassId_PSF : 
-    return("PSF");
-
-  case ClassId_Star + BStar_Type : 
-    return("BStar");
-  case ClassId_Star + RzStar_Type : 
-    return("RzStar");
-  case ClassId_Star + PSFStar_Type : 
-    return("PSFStar");
-  case ClassId_Star + MCStar_Type : 
-    return("MCStar");
-  case ClassId_Star + CircRFixStar_Type : 
-    return("CircRFixStar");
-  case ClassId_Star + PSFDHStar_Type : 
-    return("PSFDHStar");
-  case ClassId_Star + PSFSEStar_Type : 
-    return("PSFSEStar");
-  case ClassId_Star + MCDHStar_Type : 
-    return("MCDHStar");
-#endif
-
-// - Ajout objet PPF
-  default:
-    return("Unknown");
-  }
-}  
-
-/* --Methode-- */
-char* Services2NObjMgr::PClassIdToShortClassName(int cid)
-{
-switch (cid) {
-  case ClassId_Poly1 : 
-  case ClassId_Poly2 : 
-    return("Poly");
-  case ClassId_Matrix : 
-    return("Mtx");
-  case ClassId_Vector : 
-    return("Vec");
-  case ClassId_DVList : 
-    return("Dvl");
-
-  case ClassId_Histo1D : 
-    return("H1D");
-  case ClassId_Histo2D : 
-    return("H2D");
-  case ClassId_HProf : 
-    return("HPF");
-  case ClassId_NTuple : 
-    return("NT");
-  case ClassId_GeneralFitData : 
-    return("GFD");
-
-  case ClassId_Image : 
-  case ClassId_Image + kuint_1 : 
-  case ClassId_Image + kint_1 : 
-  case ClassId_Image + kuint_2 : 
-  case ClassId_Image + kint_2 : 
-  case ClassId_Image + kuint_4 : 
-  case ClassId_Image + kint_4 : 
-  case ClassId_Image + kr_4 : 
-  case ClassId_Image + kr_8 : 
-    return("Img");
-
-  case ClassId_ZFidu : 
-    return("Fidu");
-
-#ifdef SANS_EVOLPLANCK 
-  case ClassId_StarList : 
-    return("Stl");
-  case ClassId_Transfo : 
-    return("Tr");
-  case ClassId_PSF : 
-    return("PSF");
-
-  case ClassId_Star + BStar_Type : 
-  case ClassId_Star + RzStar_Type : 
-  case ClassId_Star + PSFStar_Type : 
-  case ClassId_Star + MCStar_Type : 
-  case ClassId_Star + CircRFixStar_Type : 
-  case ClassId_Star + PSFDHStar_Type : 
-  case ClassId_Star + PSFSEStar_Type : 
-  case ClassId_Star + MCDHStar_Type : 
-    return("Star");
-#endif
-
-// - Ajout objet PPF
-  default:
-    return("U");
-  }
-}  
+
 
 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Index: trunk/SophyaPI/PIext/servnobjm.h
===================================================================
--- trunk/SophyaPI/PIext/servnobjm.h	(revision 294)
+++ trunk/SophyaPI/PIext/servnobjm.h	(revision 295)
@@ -9,9 +9,15 @@
 #include "machdefs.h"
 #include <string>
-
-#include "ctimer.h"
+#include <list>
+#include <map>
+#if defined(__KCC__)
+using std::string ;
+#include <list.h>
+#include <map.h>
+#endif
 
 #include "pdlmgr.h"
 #include "dlftypes.h"
+#include "nomgadapter.h"
 
 class NTuple;
@@ -26,7 +32,12 @@
 		~Services2NObjMgr();
 
+// Pour enregistrer les objets de donnees et leurs adaptateurs
+  void			RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa);
+// Pour recuperer l'adaptateur pour un objet o 
+  NObjMgrAdapter*	GetAdapter(AnyDataObj* o);
+
   inline void   SetImgApp(PIStdImgApp* app) {mImgapp = app; }
 
-  void 		Nobj_ComputeExpressions(PPersist* obj, string& expx, string& expy, string& expz, 
+  void 		Nobj_ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, string& expz, 
                                         string& expwt, string& expcut,
                                         NTuple* nt=NULL, Histo* h1=NULL,
@@ -37,10 +48,16 @@
   void 		CloseDLL();  
 
-  char* 	PClassIdToClassName(int cid);
-  char* 	PClassIdToShortClassName(int cid);
   string 	FileName2Name(string const & fn);
   int 		DecodeDispOption(string& dopt, bool& fgsrgr);
 
+protected:
   void 		InitGrAttNames();
+
+// Pour enregister les objets et leurs adaptateurs pour NamedObjMgr
+  struct dataobj_adapter {
+    AnyDataObj* obj;  NObjMgrAdapter* obja;
+  };
+  typedef list<dataobj_adapter> ObjAdaptList;
+  ObjAdaptList objadaplist;
 
 //   Variables membre , en public pour le moment
@@ -49,5 +66,5 @@
   };
   typedef map<string, gratt_item, less<string> > GrAttNames;
-
+  
 //  Pour les changements d'attributs graphiques / de visualisation
   GrAttNames GrAcolors;
