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

Last change on this file since 2764 was 2755, checked in by ansari, 20 years ago

1/ Correction bug trace des lignes ds PINTuple
2/ Ajout methode IsThreadable() (declaration conformite thread separe pour certaines commandes) ds baseexecut.h .cc (plot2d plot3d ...) , ds pawexecut.cc (n/plot ...) et ds cxxexecutor.h .cc (c++exec c++execfrf ...)
3/ Ajout de ZMutex (et ZSync) pour la gestion des commandes threadable - ds les
executeurs et ds servnobjm.h .cc
4/ bug d'execution en thread identifie et corrige ds nobjmgr.h .cc (ajout des
methodes GetObj_P() GetObjAdapter_P() et ReadObj_P()
5/ Ajout de l'appel a ZSync::NOp() pour eviter les warnings 'unused variable zs ...'

Reza 23 Mai 2005

File size: 6.4 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
22#ifdef SANS_EVOLPLANCK
23class NTuple;
24class Histo;
25class Histo2D;
26class HProf;
27#else
28namespace SOPHYA {
29class NTuple;
30class Histo;
31class Histo2D;
32class HProf;
33}
34#endif
35
36class PIStdImgApp;
37class NObjMgrAdapter;
38
39class Services2NObjMgr {
40public:
41 Services2NObjMgr(string& tmpdir);
42 virtual ~Services2NObjMgr();
43
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
49 inline void SetImgApp(PIStdImgApp* app) {mImgapp = app; }
50 void SetTmpDir(string const & tmpdir);
51 inline NamedObjMgr* MyObjMgr()
52 {
53 if (mOmg == NULL) mOmg = new NamedObjMgr;
54 return mOmg;
55 }
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
71// Calcul d'expression arithmetique
72 virtual void ExpVal(string expval,string resultvarname="");
73
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,
77 string& expcut, string dopt="", string loop="");
78 virtual void DisplayPoints3D(string & nom, string& expx, string& expy, string& expz,
79 string& expcut, string dopt="", string loop="");
80 virtual void DisplayPoints2DW(string & nom, string& expx, string& expy,
81 string& expwt, string& expcut, string dopt="", string loop="");
82// Projection d'expressions dans histogramme, vecteur/matrices (et trace)
83 virtual void ProjectH1(string & nom, string& expx, string& expwt, string& expcut,
84 string& nomh1, string dopt="", string loop="");
85 virtual void ProjectH2(string & nom, string& expx, string& expy, string& expwt,
86 string& expcut, string& nomh2, string dopt="", string loop="");
87 virtual void ProjectHProf(string & nom, string& expx, string& expy, string& expwt,
88 string& expcut, string& nomprof, string dopt="", string loop="");
89
90// Remplissage de vecteurs, ntuples, GFD
91 virtual void FillVect(string & nom, string& expx, string& expv, string& expcut,
92 string& nomvec, string dopt="", string loop="");
93 virtual void FillMatx(string & nom, string& expx, string& expy, string& expv,
94 string& expcut, string& nommtx, string dopt="", string loop="");
95
96 virtual void ExpressionToVector(string & nom, string& expx, string& expcut,
97 string& nomvec, string dopt="", string loop="");
98 virtual void NtFromASCIIFile(string& nom,string& filename,double def_val=0.);
99 virtual void FillNT(string & nom, string& expx, string& expy, string& expz,
100 string& expt, string& expcut, string& nomnt, string loop="");
101 virtual void FillGFD(string & nom, string& expx, string& expy, string& expz,
102 string& experr, string& expcut, string& nomgfd, string loop="");
103 virtual void FillGFDfrVec(string nomgfd,string namx,string namy,string namz,string name);
104 virtual void FillNTFrCFile(string & nom, string const & fname,
105 string const & funcname, string & nomnt, string loop="");
106 virtual void PrepareNTExpressionCFile(string & nomobj, string const & fname,
107 string const & funcname);
108
109// Calcul d'expressions d'interface NTuple pour les objets
110 void ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy,
111 string& expz, string& expt, string& expcut, string& loop,
112 NTuple* nt=NULL, Histo* h1=NULL,
113 Histo2D* h2=NULL, HProf* hp=NULL);
114 PlotExprFunc LinkExprFunc(string& vardec, string& expx, string& expy,
115 string& expz, string& expt, string& cut);
116 DlFunction LinkFunctionFromFile(string const & fname, string const & funcname);
117 void CloseDLL();
118
119// Execution de chaine de commande par l'interpreteur
120 int ExecuteCommand(string line);
121
122// Utilitaires divers
123 static void DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di);
124 string FileName2Name(string const & fn);
125 char* PClassIdToClassName(int cid);
126
127protected:
128
129// Pour enregister les objets et leurs adaptateurs pour NamedObjMgr
130 struct dataobj_adapter {
131 AnyDataObj* obj; NObjMgrAdapter* obja;
132 };
133 typedef list<dataobj_adapter> ObjAdaptList;
134 ObjAdaptList objadaplist;
135
136
137 PDynLinkMgr * dynlink; // shared-lib lib.so
138 string TmpDir; // Pour fichiers temporaires
139 // Mutex de controle de thread pour dynamic-link
140 ZMutex mutx_dynlink;
141
142 PIStdImgApp* mImgapp;
143 NamedObjMgr* mOmg;
144
145
146};
147
148
149#endif
Note: See TracBrowser for help on using the repository browser.