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

Last change on this file since 2606 was 2491, checked in by ansari, 22 years ago

Suite des modifs pour piapp multi-threads
1) Ajout Mutex de synchronisation ds ls classe NamedObjMgr
2) Suite controle de gestion d'appel aux methodes de PIStdImgApp depuis
la classe elle-meme, a travers le NamedObjMgr
3) Modification de la boucle d'evenements, avec un thread de reveil
periodique

Reza, 4 Janvier 2004

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