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