| 1 | // This may look like C code, but it is really -*- C++ -*-
 | 
|---|
| 2 | // Classe de services destinee a NamedObjMgr pour piapp
 | 
|---|
| 3 | // Reza                             Aout 98
 | 
|---|
| 4 | // CEA-DAPNIA      LAL-IN2P3/CNRS
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #ifndef SERVNOBJM_H_SEEN
 | 
|---|
| 7 | #define SERVNOBJM_H_SEEN
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #include "machdefs.h"
 | 
|---|
| 10 | #include <string>
 | 
|---|
| 11 | #include <list>
 | 
|---|
| 12 | #include <map>
 | 
|---|
| 13 | #include <functional>
 | 
|---|
| 14 | 
 | 
|---|
| 15 | #include "pdlmgr.h"
 | 
|---|
| 16 | #include "dlftypes.h"
 | 
|---|
| 17 | #include "anydataobj.h"
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #ifdef SANS_EVOLPLANCK
 | 
|---|
| 20 | class NTuple;
 | 
|---|
| 21 | class Histo;
 | 
|---|
| 22 | class Histo2D;
 | 
|---|
| 23 | class HProf;
 | 
|---|
| 24 | #else
 | 
|---|
| 25 | namespace SOPHYA { 
 | 
|---|
| 26 | class NTuple;
 | 
|---|
| 27 | class Histo;
 | 
|---|
| 28 | class Histo2D;
 | 
|---|
| 29 | class HProf;
 | 
|---|
| 30 | }
 | 
|---|
| 31 | #endif
 | 
|---|
| 32 | 
 | 
|---|
| 33 | class NamedObjMgr;
 | 
|---|
| 34 | class PIStdImgApp;
 | 
|---|
| 35 | class NObjMgrAdapter;
 | 
|---|
| 36 | 
 | 
|---|
| 37 | class Services2NObjMgr {
 | 
|---|
| 38 | public:
 | 
|---|
| 39 |                 Services2NObjMgr(NamedObjMgr* omg, string& tmpdir);
 | 
|---|
| 40 |   virtual       ~Services2NObjMgr();
 | 
|---|
| 41 | 
 | 
|---|
| 42 | // Pour enregistrer les objets de donnees et leurs adaptateurs
 | 
|---|
| 43 |   void                  RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa);
 | 
|---|
| 44 | // Pour recuperer l'adaptateur pour un objet o 
 | 
|---|
| 45 |   NObjMgrAdapter*       GetAdapter(AnyDataObj* o);
 | 
|---|
| 46 | 
 | 
|---|
| 47 |   inline void   SetImgApp(PIStdImgApp* app) {mImgapp = app; }
 | 
|---|
| 48 | 
 | 
|---|
| 49 | // Trace de fonctions 1-D , 2-D
 | 
|---|
| 50 |   virtual void  PlotFunc(string const & expfunc, string & nom, double xmin, double xmax, 
 | 
|---|
| 51 |                          int np=100, string dopt="");
 | 
|---|
| 52 |   virtual void  PlotFunc2D(string const & expfunc, string & nom, double xmin, double xmax, 
 | 
|---|
| 53 |                            double ymin, double ymax, int npx=50, int npy=50, string dopt="");
 | 
|---|
| 54 |   virtual void  PlotFuncFrCFile(string const & fname, string const & func, string & nom, 
 | 
|---|
| 55 |                                 double xmin, double xmax, int np=100, string dopt="");
 | 
|---|
| 56 |   virtual void  PlotFunc2DFrCFile(string const & fname, string const & func, string & nom, 
 | 
|---|
| 57 |                                   double xmin, double xmax, double ymin, double ymax, 
 | 
|---|
| 58 |                                   int npx=50, int npy=50, string dopt="");
 | 
|---|
| 59 |   virtual void  PlotFunc(DlFunctionOfX f, string & nom, double xmin, double xmax, 
 | 
|---|
| 60 |                          int np=100, string dopt="");
 | 
|---|
| 61 |   virtual void  PlotFunc2D(DlFunctionOfXY f, string & nom, double xmin, double xmax, 
 | 
|---|
| 62 |                            double ymin, double ymax, int npx=50, int npy=50, string dopt="");
 | 
|---|
| 63 | 
 | 
|---|
| 64 | //  Trace d'expression de NTuple, et d'autres objets
 | 
|---|
| 65 |   virtual void          DisplayPoints2D(string & nom, string& expx, string& expy,
 | 
|---|
| 66 |                                         string& experrx, string& experry, 
 | 
|---|
| 67 |                                         string& expcut, string dopt="", string loop="");
 | 
|---|
| 68 |   virtual void          DisplayPoints3D(string & nom, string& expx, string& expy, string& expz, 
 | 
|---|
| 69 |                                         string& expcut, string dopt="", string loop="");
 | 
|---|
| 70 |   virtual void          DisplayPoints2DW(string & nom, string& expx, string& expy, 
 | 
|---|
| 71 |                                          string& expwt, string& expcut, string dopt="", string loop="");
 | 
|---|
| 72 | //  Projection d'expressions dans histogramme, vecteur/matrices (et trace) 
 | 
|---|
| 73 |   virtual void          ProjectH1(string & nom, string& expx, string& expwt, string& expcut, 
 | 
|---|
| 74 |                                   string& nomh1, string dopt="", string loop="");
 | 
|---|
| 75 |   virtual void          ProjectH2(string & nom, string& expx, string& expy, string& expwt, 
 | 
|---|
| 76 |                                   string& expcut, string& nomh2, string dopt="", string loop="");
 | 
|---|
| 77 |   virtual void          ProjectHProf(string & nom, string& expx, string& expy, string& expwt, 
 | 
|---|
| 78 |                                   string& expcut, string& nomprof, string dopt="", string loop="");
 | 
|---|
| 79 | 
 | 
|---|
| 80 | //  Remplissage de vecteurs, ntuples, GFD 
 | 
|---|
| 81 |   virtual void          FillVect(string & nom, string& expx, string& expv, string& expcut, 
 | 
|---|
| 82 |                                   string& nomvec, string dopt="", string loop="");
 | 
|---|
| 83 |   virtual void          FillMatx(string & nom, string& expx, string& expy, string& expv, 
 | 
|---|
| 84 |                                   string& expcut, string& nommtx, string dopt="", string loop="");
 | 
|---|
| 85 | 
 | 
|---|
| 86 |   virtual void          ExpressionToVector(string & nom, string& expx, string& expcut, 
 | 
|---|
| 87 |                                            string& nomvec, string dopt="", string loop="");
 | 
|---|
| 88 |   virtual void          NtFromASCIIFile(string& nom,string& filename,double def_val=0.);
 | 
|---|
| 89 |   virtual void          FillNT(string & nom, string& expx, string& expy, string& expz,
 | 
|---|
| 90 |                                string& expt, string& expcut, string& nomnt, string loop=""); 
 | 
|---|
| 91 |   virtual void          FillGFD(string & nom, string& expx, string& expy, string& expz,
 | 
|---|
| 92 |                                string& experr, string& expcut, string& nomgfd, string loop="");
 | 
|---|
| 93 |   virtual void          FillNTFrCFile(string & nom, string const & fname, 
 | 
|---|
| 94 |                                       string const & funcname, string & nomnt, string loop="");
 | 
|---|
| 95 |   virtual void          PrepareNTExpressionCFile(string & nomobj, string const & fname, 
 | 
|---|
| 96 |                                                  string const & funcname);
 | 
|---|
| 97 | 
 | 
|---|
| 98 | // Calcul d'expressions d'interface NTuple pour les objets
 | 
|---|
| 99 |   void          ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, 
 | 
|---|
| 100 |                                    string& expz, string& expt, string& expcut, string& loop,
 | 
|---|
| 101 |                                    NTuple* nt=NULL, Histo* h1=NULL,
 | 
|---|
| 102 |                                    Histo2D* h2=NULL, HProf* hp=NULL);
 | 
|---|
| 103 |   PlotExprFunc  LinkExprFunc(string& vardec, string& expx, string& expy, 
 | 
|---|
| 104 |                              string& expz, string& expt, string& cut);
 | 
|---|
| 105 |   DlFunction    LinkFunctionFromFile(string const & fname, string const & funcname);
 | 
|---|
| 106 |   void          CloseDLL();  
 | 
|---|
| 107 | 
 | 
|---|
| 108 | // Utilitaires divers 
 | 
|---|
| 109 |   static void   DecodeLoopParameters(string& loop, int& i1, int& i2, int& di);
 | 
|---|
| 110 |   int           DecodeDispOption(string& dopt, bool& fgsrgr);
 | 
|---|
| 111 |   static bool   GetStatsOption(string& dopt);
 | 
|---|
| 112 |   static void   SetDefaultStatsOption(bool opt);
 | 
|---|
| 113 |   string        FileName2Name(string const & fn);
 | 
|---|
| 114 |   char*         PClassIdToClassName(int cid);
 | 
|---|
| 115 | 
 | 
|---|
| 116 | protected:
 | 
|---|
| 117 |   void          InitGrAttNames();
 | 
|---|
| 118 | 
 | 
|---|
| 119 | // Pour enregister les objets et leurs adaptateurs pour NamedObjMgr
 | 
|---|
| 120 |   struct dataobj_adapter {
 | 
|---|
| 121 |     AnyDataObj* obj;  NObjMgrAdapter* obja;
 | 
|---|
| 122 |   };
 | 
|---|
| 123 |   typedef list<dataobj_adapter> ObjAdaptList;
 | 
|---|
| 124 |   ObjAdaptList objadaplist;
 | 
|---|
| 125 | 
 | 
|---|
| 126 | //   Variables membre , en public pour le moment
 | 
|---|
| 127 |   struct gratt_item {
 | 
|---|
| 128 |     int a1, a2;
 | 
|---|
| 129 |   };
 | 
|---|
| 130 |   typedef map<string, gratt_item, less<string> > GrAttNames;
 | 
|---|
| 131 |   
 | 
|---|
| 132 | //  Pour les changements d'attributs graphiques / de visualisation
 | 
|---|
| 133 |   GrAttNames GrAcolors;
 | 
|---|
| 134 |   GrAttNames GrAlines;
 | 
|---|
| 135 |   GrAttNames GrAmarkers;
 | 
|---|
| 136 |   GrAttNames GrAfonts;
 | 
|---|
| 137 |   GrAttNames GrAcmap;  
 | 
|---|
| 138 |   GrAttNames GrAzoom;  
 | 
|---|
| 139 |   GrAttNames GrAaxes;  
 | 
|---|
| 140 | 
 | 
|---|
| 141 |   PDynLinkMgr * dynlink;  // shared-lib lib.so
 | 
|---|
| 142 |   string TmpDir;          // Pour fichiers temporaires
 | 
|---|
| 143 | 
 | 
|---|
| 144 |   PIStdImgApp* mImgapp;
 | 
|---|
| 145 |   NamedObjMgr* mOmg;
 | 
|---|
| 146 |   
 | 
|---|
| 147 | };
 | 
|---|
| 148 | 
 | 
|---|
| 149 | 
 | 
|---|
| 150 | #endif
 | 
|---|