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