source: Sophya/trunk/ArchTOIPipe/Kernel/toimanager.h@ 2330

Last change on this file since 2330 was 2225, checked in by aubourg, 23 years ago

v_oct02_mieux

File size: 3.0 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2
3// ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
4// Eric Aubourg
5// Christophe Magneville
6// Reza Ansari
7// $Id: toimanager.h,v 1.17 2002-10-23 21:57:40 aubourg Exp $
8
9
10#ifndef TOIMANAGER_H
11#define TOIMANAGER_H
12
13#include "config.h"
14#include <string>
15#include <vector>
16
17#include "toiprocessor.h"
18
19
20// -----------ajout cgt vf 19/08/2002
21
22#include "toi.h"
23
24#include <typeinfo>
25#include "toiseqbuff.h"
26#include "toisegment.h"
27#include "fitstoiwtr.h"
28
29#ifdef WITH_SOPHYA
30#include "pexceptions.h"
31#else
32#include "apexceptions.h"
33#endif
34
35#include <pthread.h>
36// ----------fin ajout cgt
37
38
39
40using namespace std;
41
42class TOIManager {
43public:
44 static TOIManager* getManager();
45 virtual ~TOIManager() {}
46 void setRequestedSample(int begin, int end);
47 int getRequestedBegin();
48 int getRequestedEnd();
49
50 // ajout vf 25/07/2002
51 void startAll();
52 bool checkSamplesLimits(int pass);
53
54 void waitForAll();
55
56 void joinAll(); // deprecated. Use waitForAll();
57
58
59 // ajout cgt vf 19/08/2002
60
61 void selectTOISegmented(int bufsz=1024, int maxseg=20);
62 void selectTOISeqBuffered(int wsz=8192);
63
64 virtual TOI& connect(TOIProcessor& prout, string out,
65 TOIProcessor& prin, string in, string nom="",
66 int wbsz=0, bool withFlag=false);
67 virtual TOI& connect(TOIProcessor& prout, const char* out,
68 TOIProcessor& prin, const char* in, string nom="",
69 int wbsz=0, bool withFlag=false);
70
71 // fin ajout cgt
72
73
74
75
76protected:
77 TOIManager();
78 static TOIManager* instance;
79 long reqBegin;
80 long reqEnd;
81
82 vector<pthread_t*> threads;
83 void addThread(pthread_t*);
84
85 // ajout vf 25/07/2002
86
87 vector<TOIProcessor*> processors;
88 void registerProcessor(TOIProcessor* proc);
89
90 friend class TOIProcessor;
91
92 // ajout cgt vf 19/08/2002
93
94 bool fgSegmented; // type de toi
95 int segBuffsz, segMaxseg;
96
97 // fin ajout cgt
98
99};
100
101// -----------------------------------------------------------------
102// Classe pour affichage de l'avancement des TOIProcessors
103// Reza 08/2001
104// -----------------------------------------------------------------
105
106class RzProcSampleCounter {
107public:
108 RzProcSampleCounter();
109 virtual ~RzProcSampleCounter();
110 virtual long ProcessedSampleCount() = 0;
111 virtual long SampleBegin() = 0;
112 virtual long SampleEnd() = 0;
113 virtual long PrintStats();
114 inline int & PrintRate(int pr) { return _rate; }
115 inline string& InfoMessage() { return _msg; }
116protected:
117 int _rate;
118 string _msg;
119};
120
121template <class T>
122class ProcSampleCounter : public RzProcSampleCounter {
123public:
124 ProcSampleCounter(T & t) { _t = &t; }
125 virtual long ProcessedSampleCount()
126 { return _t->ProcessedSampleCount(); }
127 virtual long SampleBegin() { return _t->getMinIn(); }
128 virtual long SampleEnd() { return _t->getMaxIn(); }
129protected:
130 T * _t;
131};
132
133
134
135
136#endif
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
Note: See TracBrowser for help on using the repository browser.