| 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 | void SetTmpDir(string const & tmpdir);
|
|---|
| 49 |
|
|---|
| 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 | // Calcul d'expression arithmetique
|
|---|
| 66 | virtual void ExpVal(string expval,string resultvarname="");
|
|---|
| 67 |
|
|---|
| 68 | // Trace d'expression de NTuple, et d'autres objets
|
|---|
| 69 | virtual void DisplayPoints2D(string & nom, string& expx, string& expy,
|
|---|
| 70 | string& experrx, string& experry,
|
|---|
| 71 | string& expcut, string dopt="", string loop="");
|
|---|
| 72 | virtual void DisplayPoints3D(string & nom, string& expx, string& expy, string& expz,
|
|---|
| 73 | string& expcut, string dopt="", string loop="");
|
|---|
| 74 | virtual void DisplayPoints2DW(string & nom, string& expx, string& expy,
|
|---|
| 75 | string& expwt, string& expcut, string dopt="", string loop="");
|
|---|
| 76 | // Projection d'expressions dans histogramme, vecteur/matrices (et trace)
|
|---|
| 77 | virtual void ProjectH1(string & nom, string& expx, string& expwt, string& expcut,
|
|---|
| 78 | string& nomh1, string dopt="", string loop="");
|
|---|
| 79 | virtual void ProjectH2(string & nom, string& expx, string& expy, string& expwt,
|
|---|
| 80 | string& expcut, string& nomh2, string dopt="", string loop="");
|
|---|
| 81 | virtual void ProjectHProf(string & nom, string& expx, string& expy, string& expwt,
|
|---|
| 82 | string& expcut, string& nomprof, string dopt="", string loop="");
|
|---|
| 83 |
|
|---|
| 84 | // Remplissage de vecteurs, ntuples, GFD
|
|---|
| 85 | virtual void FillVect(string & nom, string& expx, string& expv, string& expcut,
|
|---|
| 86 | string& nomvec, string dopt="", string loop="");
|
|---|
| 87 | virtual void FillMatx(string & nom, string& expx, string& expy, string& expv,
|
|---|
| 88 | string& expcut, string& nommtx, string dopt="", string loop="");
|
|---|
| 89 |
|
|---|
| 90 | virtual void ExpressionToVector(string & nom, string& expx, string& expcut,
|
|---|
| 91 | string& nomvec, string dopt="", string loop="");
|
|---|
| 92 | virtual void NtFromASCIIFile(string& nom,string& filename,double def_val=0.);
|
|---|
| 93 | virtual void FillNT(string & nom, string& expx, string& expy, string& expz,
|
|---|
| 94 | string& expt, string& expcut, string& nomnt, string loop="");
|
|---|
| 95 | virtual void FillGFD(string & nom, string& expx, string& expy, string& expz,
|
|---|
| 96 | string& experr, string& expcut, string& nomgfd, string loop="");
|
|---|
| 97 | virtual void FillGFDfrVec(string nomgfd,string namx,string namy,string namz,string name);
|
|---|
| 98 | virtual void FillNTFrCFile(string & nom, string const & fname,
|
|---|
| 99 | string const & funcname, string & nomnt, string loop="");
|
|---|
| 100 | virtual void PrepareNTExpressionCFile(string & nomobj, string const & fname,
|
|---|
| 101 | string const & funcname);
|
|---|
| 102 |
|
|---|
| 103 | // Calcul d'expressions d'interface NTuple pour les objets
|
|---|
| 104 | void ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy,
|
|---|
| 105 | string& expz, string& expt, string& expcut, string& loop,
|
|---|
| 106 | NTuple* nt=NULL, Histo* h1=NULL,
|
|---|
| 107 | Histo2D* h2=NULL, HProf* hp=NULL);
|
|---|
| 108 | PlotExprFunc LinkExprFunc(string& vardec, string& expx, string& expy,
|
|---|
| 109 | string& expz, string& expt, string& cut);
|
|---|
| 110 | DlFunction LinkFunctionFromFile(string const & fname, string const & funcname);
|
|---|
| 111 | void CloseDLL();
|
|---|
| 112 |
|
|---|
| 113 | // Execution de chaine de commande par l'interpreteur
|
|---|
| 114 | int ExecuteCommand(string line);
|
|---|
| 115 |
|
|---|
| 116 | // Utilitaires divers
|
|---|
| 117 | static void DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di);
|
|---|
| 118 | string FileName2Name(string const & fn);
|
|---|
| 119 | char* PClassIdToClassName(int cid);
|
|---|
| 120 |
|
|---|
| 121 | protected:
|
|---|
| 122 |
|
|---|
| 123 | // Pour enregister les objets et leurs adaptateurs pour NamedObjMgr
|
|---|
| 124 | struct dataobj_adapter {
|
|---|
| 125 | AnyDataObj* obj; NObjMgrAdapter* obja;
|
|---|
| 126 | };
|
|---|
| 127 | typedef list<dataobj_adapter> ObjAdaptList;
|
|---|
| 128 | ObjAdaptList objadaplist;
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 | PDynLinkMgr * dynlink; // shared-lib lib.so
|
|---|
| 132 | string TmpDir; // Pour fichiers temporaires
|
|---|
| 133 |
|
|---|
| 134 | PIStdImgApp* mImgapp;
|
|---|
| 135 | NamedObjMgr* mOmg;
|
|---|
| 136 |
|
|---|
| 137 | };
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 | #endif
|
|---|