| [165] | 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 |  | 
|---|
| [293] | 9 | #include "machdefs.h" | 
|---|
| [165] | 10 | #include <string> | 
|---|
| [295] | 11 | #include <list> | 
|---|
|  | 12 | #include <map> | 
|---|
| [351] | 13 | #include <functional> | 
|---|
| [165] | 14 |  | 
|---|
| [171] | 15 | #include "pdlmgr.h" | 
|---|
| [165] | 16 | #include "dlftypes.h" | 
|---|
| [330] | 17 | #include "anydataobj.h" | 
|---|
| [165] | 18 |  | 
|---|
| [495] | 19 | #ifdef SANS_EVOLPLANCK | 
|---|
| [165] | 20 | class NTuple; | 
|---|
|  | 21 | class Histo; | 
|---|
|  | 22 | class Histo2D; | 
|---|
|  | 23 | class HProf; | 
|---|
| [495] | 24 | #else | 
|---|
| [551] | 25 | namespace SOPHYA { | 
|---|
| [495] | 26 | class NTuple; | 
|---|
|  | 27 | class Histo; | 
|---|
|  | 28 | class Histo2D; | 
|---|
|  | 29 | class HProf; | 
|---|
|  | 30 | } | 
|---|
|  | 31 | #endif | 
|---|
|  | 32 |  | 
|---|
| [333] | 33 | class NamedObjMgr; | 
|---|
| [165] | 34 | class PIStdImgApp; | 
|---|
| [330] | 35 | class NObjMgrAdapter; | 
|---|
| [165] | 36 |  | 
|---|
|  | 37 | class Services2NObjMgr { | 
|---|
|  | 38 | public: | 
|---|
| [333] | 39 | Services2NObjMgr(NamedObjMgr* omg, string& tmpdir); | 
|---|
| [327] | 40 | virtual       ~Services2NObjMgr(); | 
|---|
| [165] | 41 |  | 
|---|
| [295] | 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 |  | 
|---|
| [165] | 47 | inline void   SetImgApp(PIStdImgApp* app) {mImgapp = app; } | 
|---|
| [1276] | 48 | void          SetTmpDir(string const & tmpdir); | 
|---|
| [165] | 49 |  | 
|---|
| [333] | 50 | // Trace de fonctions 1-D , 2-D | 
|---|
|  | 51 | virtual void  PlotFunc(string const & expfunc, string & nom, double xmin, double xmax, | 
|---|
|  | 52 | int np=100, string dopt=""); | 
|---|
|  | 53 | virtual void  PlotFunc2D(string const & expfunc, string & nom, double xmin, double xmax, | 
|---|
|  | 54 | double ymin, double ymax, int npx=50, int npy=50, string dopt=""); | 
|---|
|  | 55 | virtual void  PlotFuncFrCFile(string const & fname, string const & func, string & nom, | 
|---|
|  | 56 | double xmin, double xmax, int np=100, string dopt=""); | 
|---|
|  | 57 | virtual void  PlotFunc2DFrCFile(string const & fname, string const & func, string & nom, | 
|---|
|  | 58 | double xmin, double xmax, double ymin, double ymax, | 
|---|
|  | 59 | int npx=50, int npy=50, string dopt=""); | 
|---|
|  | 60 | virtual void  PlotFunc(DlFunctionOfX f, string & nom, double xmin, double xmax, | 
|---|
|  | 61 | int np=100, string dopt=""); | 
|---|
|  | 62 | virtual void  PlotFunc2D(DlFunctionOfXY f, string & nom, double xmin, double xmax, | 
|---|
|  | 63 | double ymin, double ymax, int npx=50, int npy=50, string dopt=""); | 
|---|
|  | 64 |  | 
|---|
|  | 65 | //  Trace d'expression de NTuple, et d'autres objets | 
|---|
|  | 66 | virtual void          DisplayPoints2D(string & nom, string& expx, string& expy, | 
|---|
|  | 67 | string& experrx, string& experry, | 
|---|
| [357] | 68 | string& expcut, string dopt="", string loop=""); | 
|---|
| [333] | 69 | virtual void          DisplayPoints3D(string & nom, string& expx, string& expy, string& expz, | 
|---|
| [357] | 70 | string& expcut, string dopt="", string loop=""); | 
|---|
| [333] | 71 | virtual void          DisplayPoints2DW(string & nom, string& expx, string& expy, | 
|---|
| [357] | 72 | string& expwt, string& expcut, string dopt="", string loop=""); | 
|---|
|  | 73 | //  Projection d'expressions dans histogramme, vecteur/matrices (et trace) | 
|---|
| [333] | 74 | virtual void          ProjectH1(string & nom, string& expx, string& expwt, string& expcut, | 
|---|
| [357] | 75 | string& nomh1, string dopt="", string loop=""); | 
|---|
| [333] | 76 | virtual void          ProjectH2(string & nom, string& expx, string& expy, string& expwt, | 
|---|
| [357] | 77 | string& expcut, string& nomh2, string dopt="", string loop=""); | 
|---|
| [333] | 78 | virtual void          ProjectHProf(string & nom, string& expx, string& expy, string& expwt, | 
|---|
| [357] | 79 | string& expcut, string& nomprof, string dopt="", string loop=""); | 
|---|
|  | 80 |  | 
|---|
|  | 81 | //  Remplissage de vecteurs, ntuples, GFD | 
|---|
|  | 82 | virtual void          FillVect(string & nom, string& expx, string& expv, string& expcut, | 
|---|
|  | 83 | string& nomvec, string dopt="", string loop=""); | 
|---|
|  | 84 | virtual void          FillMatx(string & nom, string& expx, string& expy, string& expv, | 
|---|
|  | 85 | string& expcut, string& nommtx, string dopt="", string loop=""); | 
|---|
|  | 86 |  | 
|---|
|  | 87 | virtual void          ExpressionToVector(string & nom, string& expx, string& expcut, | 
|---|
|  | 88 | string& nomvec, string dopt="", string loop=""); | 
|---|
| [447] | 89 | virtual void          NtFromASCIIFile(string& nom,string& filename,double def_val=0.); | 
|---|
| [333] | 90 | virtual void          FillNT(string & nom, string& expx, string& expy, string& expz, | 
|---|
| [357] | 91 | string& expt, string& expcut, string& nomnt, string loop=""); | 
|---|
| [333] | 92 | virtual void          FillGFD(string & nom, string& expx, string& expy, string& expz, | 
|---|
| [357] | 93 | string& experr, string& expcut, string& nomgfd, string loop=""); | 
|---|
| [1067] | 94 | virtual void          FillGFDfrVec(string nomgfd,string namx,string namy,string namz,string name); | 
|---|
| [333] | 95 | virtual void          FillNTFrCFile(string & nom, string const & fname, | 
|---|
| [357] | 96 | string const & funcname, string & nomnt, string loop=""); | 
|---|
| [333] | 97 | virtual void          PrepareNTExpressionCFile(string & nomobj, string const & fname, | 
|---|
|  | 98 | string const & funcname); | 
|---|
|  | 99 |  | 
|---|
|  | 100 | // Calcul d'expressions d'interface NTuple pour les objets | 
|---|
|  | 101 | void          ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, | 
|---|
| [357] | 102 | string& expz, string& expt, string& expcut, string& loop, | 
|---|
| [333] | 103 | NTuple* nt=NULL, Histo* h1=NULL, | 
|---|
|  | 104 | Histo2D* h2=NULL, HProf* hp=NULL); | 
|---|
|  | 105 | PlotExprFunc  LinkExprFunc(string& vardec, string& expx, string& expy, | 
|---|
|  | 106 | string& expz, string& expt, string& cut); | 
|---|
| [326] | 107 | DlFunction    LinkFunctionFromFile(string const & fname, string const & funcname); | 
|---|
| [165] | 108 | void          CloseDLL(); | 
|---|
|  | 109 |  | 
|---|
| [1319] | 110 | // Execution de chaine de commande par l'interpreteur | 
|---|
|  | 111 | int           ExecuteCommand(string line); | 
|---|
|  | 112 |  | 
|---|
| [326] | 113 | // Utilitaires divers | 
|---|
| [357] | 114 | static void   DecodeLoopParameters(string& loop, int& i1, int& i2, int& di); | 
|---|
| [165] | 115 | string        FileName2Name(string const & fn); | 
|---|
| [333] | 116 | char*         PClassIdToClassName(int cid); | 
|---|
| [165] | 117 |  | 
|---|
| [295] | 118 | protected: | 
|---|
| [165] | 119 |  | 
|---|
| [295] | 120 | // Pour enregister les objets et leurs adaptateurs pour NamedObjMgr | 
|---|
|  | 121 | struct dataobj_adapter { | 
|---|
|  | 122 | AnyDataObj* obj;  NObjMgrAdapter* obja; | 
|---|
|  | 123 | }; | 
|---|
|  | 124 | typedef list<dataobj_adapter> ObjAdaptList; | 
|---|
|  | 125 | ObjAdaptList objadaplist; | 
|---|
|  | 126 |  | 
|---|
| [165] | 127 |  | 
|---|
| [171] | 128 | PDynLinkMgr * dynlink;  // shared-lib lib.so | 
|---|
|  | 129 | string TmpDir;          // Pour fichiers temporaires | 
|---|
| [165] | 130 |  | 
|---|
|  | 131 | PIStdImgApp* mImgapp; | 
|---|
| [333] | 132 | NamedObjMgr* mOmg; | 
|---|
| [165] | 133 |  | 
|---|
|  | 134 | }; | 
|---|
|  | 135 |  | 
|---|
|  | 136 |  | 
|---|
|  | 137 | #endif | 
|---|