source: Sophya/trunk/SophyaPI/PIext/servnobjm.h@ 3994

Last change on this file since 3994 was 3572, checked in by cmv, 17 years ago

char* -> const char* pour regler les problemes de deprecated string const... + comparaison unsigned signed + suppression EVOL_PLANCK rz+cmv 07/02/2009

File size: 6.5 KB
Line 
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 "nobjmgr.h"
16#include "pdlmgr.h"
17#include "dlftypes.h"
18#include "anydataobj.h"
19
20#include "zthread.h"
21
22namespace SOPHYA {
23class NTuple;
24class Histo;
25class Histo2D;
26class HProf;
27}
28
29class PIStdImgApp;
30class NObjMgrAdapter;
31
32class Services2NObjMgr {
33public:
34 Services2NObjMgr(string& tmpdir);
35 virtual ~Services2NObjMgr();
36
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
42 inline void SetImgApp(PIStdImgApp* app) {mImgapp = app; }
43 void SetTmpDir(string const & tmpdir);
44 inline NamedObjMgr* MyObjMgr()
45 {
46 if (mOmg == NULL) mOmg = new NamedObjMgr;
47 return mOmg;
48 }
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
64// Calcul d'expression arithmetique
65 virtual void ExpVal(string expval,string resultvarname="");
66
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,
70 string& expcut, string dopt="", string loop="");
71 virtual void DisplayPoints3D(string & nom, string& expx, string& expy, string& expz,
72 string& expcut, string dopt="", string loop="");
73 virtual void DisplayPoints2DW(string & nom, string& expx, string& expy,
74 string& expwt, string& expcut,
75 bool fgcolidx=false, string dopt="", string loop="");
76 virtual void DisplayPoints3DW(string & nom, string& expx, string& expy, string& expz,
77 string& expwt, string& expcut, string dopt="", string loop="");
78
79// Projection d'expressions dans histogramme, vecteur/matrices (et trace)
80 virtual void ProjectH1(string & nom, string& expx, string& expwt, string& expcut,
81 string& nomh1, string dopt="", string loop="");
82 virtual void ProjectH2(string & nom, string& expx, string& expy, string& expwt,
83 string& expcut, string& nomh2, string dopt="", string loop="");
84 virtual void ProjectHProf(string & nom, string& expx, string& expy, string& expwt,
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="");
95 virtual void NtFromASCIIFile(string& nom,string& filename,double def_val=0.);
96 virtual void FillNT(string & nom, string& expx, string& expy, string& expz,
97 string& expt, string& expcut, string& nomnt, string loop="");
98 virtual void FillGFD(string & nom, string& expx, string& expy, string& expz,
99 string& experr, string& expcut, string& nomgfd, string loop="");
100 virtual void FillGFDfrVec(string nomgfd,string namx,string namy,string namz,string name);
101 virtual void FillNTFrCFile(string & nom, string const & fname,
102 string const & funcname, string & nomnt, string loop="");
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,
108 string& expz, string& expt, string& expcut, string& loop,
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);
113 DlFunction LinkFunctionFromFile(string const & fname, string const & funcname);
114 void CloseDLL();
115
116// Execution de chaine de commande par l'interpreteur
117 int ExecuteCommand(string line);
118
119// Utilitaires divers
120 static void DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di);
121 string FileName2Name(string const & fn);
122 const char* PClassIdToClassName(int cid);
123
124protected:
125
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
133
134 PDynLinkMgr * dynlink; // shared-lib lib.so
135 string TmpDir; // Pour fichiers temporaires
136 // Mutex de controle de thread pour dynamic-link
137 ZMutex mutx_dynlink;
138
139 PIStdImgApp* mImgapp;
140 NamedObjMgr* mOmg;
141
142
143};
144
145
146#endif
Note: See TracBrowser for help on using the repository browser.