[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 |
|
---|
| 19 | class NTuple;
|
---|
| 20 | class Histo;
|
---|
| 21 | class Histo2D;
|
---|
| 22 | class HProf;
|
---|
[333] | 23 | class NamedObjMgr;
|
---|
[165] | 24 | class PIStdImgApp;
|
---|
[330] | 25 | class NObjMgrAdapter;
|
---|
[165] | 26 |
|
---|
| 27 | class Services2NObjMgr {
|
---|
| 28 | public:
|
---|
[333] | 29 | Services2NObjMgr(NamedObjMgr* omg, string& tmpdir);
|
---|
[327] | 30 | virtual ~Services2NObjMgr();
|
---|
[165] | 31 |
|
---|
[295] | 32 | // Pour enregistrer les objets de donnees et leurs adaptateurs
|
---|
| 33 | void RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa);
|
---|
| 34 | // Pour recuperer l'adaptateur pour un objet o
|
---|
| 35 | NObjMgrAdapter* GetAdapter(AnyDataObj* o);
|
---|
| 36 |
|
---|
[165] | 37 | inline void SetImgApp(PIStdImgApp* app) {mImgapp = app; }
|
---|
| 38 |
|
---|
[333] | 39 | // Trace de fonctions 1-D , 2-D
|
---|
| 40 | virtual void PlotFunc(string const & expfunc, string & nom, double xmin, double xmax,
|
---|
| 41 | int np=100, string dopt="");
|
---|
| 42 | virtual void PlotFunc2D(string const & expfunc, string & nom, double xmin, double xmax,
|
---|
| 43 | double ymin, double ymax, int npx=50, int npy=50, string dopt="");
|
---|
| 44 | virtual void PlotFuncFrCFile(string const & fname, string const & func, string & nom,
|
---|
| 45 | double xmin, double xmax, int np=100, string dopt="");
|
---|
| 46 | virtual void PlotFunc2DFrCFile(string const & fname, string const & func, string & nom,
|
---|
| 47 | double xmin, double xmax, double ymin, double ymax,
|
---|
| 48 | int npx=50, int npy=50, string dopt="");
|
---|
| 49 | virtual void PlotFunc(DlFunctionOfX f, string & nom, double xmin, double xmax,
|
---|
| 50 | int np=100, string dopt="");
|
---|
| 51 | virtual void PlotFunc2D(DlFunctionOfXY f, string & nom, double xmin, double xmax,
|
---|
| 52 | double ymin, double ymax, int npx=50, int npy=50, string dopt="");
|
---|
| 53 |
|
---|
| 54 | // Trace d'expression de NTuple, et d'autres objets
|
---|
| 55 | virtual void DisplayPoints2D(string & nom, string& expx, string& expy,
|
---|
| 56 | string& experrx, string& experry,
|
---|
[357] | 57 | string& expcut, string dopt="", string loop="");
|
---|
[333] | 58 | virtual void DisplayPoints3D(string & nom, string& expx, string& expy, string& expz,
|
---|
[357] | 59 | string& expcut, string dopt="", string loop="");
|
---|
[333] | 60 | virtual void DisplayPoints2DW(string & nom, string& expx, string& expy,
|
---|
[357] | 61 | string& expwt, string& expcut, string dopt="", string loop="");
|
---|
| 62 | // Projection d'expressions dans histogramme, vecteur/matrices (et trace)
|
---|
[333] | 63 | virtual void ProjectH1(string & nom, string& expx, string& expwt, string& expcut,
|
---|
[357] | 64 | string& nomh1, string dopt="", string loop="");
|
---|
[333] | 65 | virtual void ProjectH2(string & nom, string& expx, string& expy, string& expwt,
|
---|
[357] | 66 | string& expcut, string& nomh2, string dopt="", string loop="");
|
---|
[333] | 67 | virtual void ProjectHProf(string & nom, string& expx, string& expy, string& expwt,
|
---|
[357] | 68 | string& expcut, string& nomprof, string dopt="", string loop="");
|
---|
| 69 |
|
---|
| 70 | // Remplissage de vecteurs, ntuples, GFD
|
---|
| 71 | virtual void FillVect(string & nom, string& expx, string& expv, string& expcut,
|
---|
| 72 | string& nomvec, string dopt="", string loop="");
|
---|
| 73 | virtual void FillMatx(string & nom, string& expx, string& expy, string& expv,
|
---|
| 74 | string& expcut, string& nommtx, string dopt="", string loop="");
|
---|
| 75 |
|
---|
| 76 | virtual void ExpressionToVector(string & nom, string& expx, string& expcut,
|
---|
| 77 | string& nomvec, string dopt="", string loop="");
|
---|
[447] | 78 | virtual void NtFromASCIIFile(string& nom,string& filename,double def_val=0.);
|
---|
[333] | 79 | virtual void FillNT(string & nom, string& expx, string& expy, string& expz,
|
---|
[357] | 80 | string& expt, string& expcut, string& nomnt, string loop="");
|
---|
[333] | 81 | virtual void FillGFD(string & nom, string& expx, string& expy, string& expz,
|
---|
[357] | 82 | string& experr, string& expcut, string& nomgfd, string loop="");
|
---|
[333] | 83 | virtual void FillNTFrCFile(string & nom, string const & fname,
|
---|
[357] | 84 | string const & funcname, string & nomnt, string loop="");
|
---|
[333] | 85 | virtual void PrepareNTExpressionCFile(string & nomobj, string const & fname,
|
---|
| 86 | string const & funcname);
|
---|
| 87 |
|
---|
[455] | 88 | // Copies d'Objects
|
---|
| 89 | virtual void CopyObjects(string& namefrom, string& nameto);
|
---|
| 90 |
|
---|
[333] | 91 | // Calcul d'expressions d'interface NTuple pour les objets
|
---|
| 92 | void ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy,
|
---|
[357] | 93 | string& expz, string& expt, string& expcut, string& loop,
|
---|
[333] | 94 | NTuple* nt=NULL, Histo* h1=NULL,
|
---|
| 95 | Histo2D* h2=NULL, HProf* hp=NULL);
|
---|
| 96 | PlotExprFunc LinkExprFunc(string& vardec, string& expx, string& expy,
|
---|
| 97 | string& expz, string& expt, string& cut);
|
---|
[326] | 98 | DlFunction LinkFunctionFromFile(string const & fname, string const & funcname);
|
---|
[165] | 99 | void CloseDLL();
|
---|
| 100 |
|
---|
[326] | 101 | // Utilitaires divers
|
---|
[357] | 102 | static void DecodeLoopParameters(string& loop, int& i1, int& i2, int& di);
|
---|
| 103 | int DecodeDispOption(string& dopt, bool& fgsrgr);
|
---|
[165] | 104 | string FileName2Name(string const & fn);
|
---|
[333] | 105 | char* PClassIdToClassName(int cid);
|
---|
[165] | 106 |
|
---|
[295] | 107 | protected:
|
---|
[165] | 108 | void InitGrAttNames();
|
---|
| 109 |
|
---|
[295] | 110 | // Pour enregister les objets et leurs adaptateurs pour NamedObjMgr
|
---|
| 111 | struct dataobj_adapter {
|
---|
| 112 | AnyDataObj* obj; NObjMgrAdapter* obja;
|
---|
| 113 | };
|
---|
| 114 | typedef list<dataobj_adapter> ObjAdaptList;
|
---|
| 115 | ObjAdaptList objadaplist;
|
---|
| 116 |
|
---|
[165] | 117 | // Variables membre , en public pour le moment
|
---|
| 118 | struct gratt_item {
|
---|
| 119 | int a1, a2;
|
---|
| 120 | };
|
---|
| 121 | typedef map<string, gratt_item, less<string> > GrAttNames;
|
---|
[295] | 122 |
|
---|
[165] | 123 | // Pour les changements d'attributs graphiques / de visualisation
|
---|
| 124 | GrAttNames GrAcolors;
|
---|
| 125 | GrAttNames GrAlines;
|
---|
| 126 | GrAttNames GrAmarkers;
|
---|
| 127 | GrAttNames GrAfonts;
|
---|
| 128 | GrAttNames GrAcmap;
|
---|
| 129 | GrAttNames GrAzoom;
|
---|
[203] | 130 | GrAttNames GrAaxes;
|
---|
[165] | 131 |
|
---|
[171] | 132 | PDynLinkMgr * dynlink; // shared-lib lib.so
|
---|
| 133 | string TmpDir; // Pour fichiers temporaires
|
---|
[165] | 134 |
|
---|
| 135 | PIStdImgApp* mImgapp;
|
---|
[333] | 136 | NamedObjMgr* mOmg;
|
---|
[165] | 137 |
|
---|
| 138 | };
|
---|
| 139 |
|
---|
| 140 |
|
---|
| 141 | #endif
|
---|