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

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

vf_231002

File size: 2.9 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.16 2002-10-23 21:05:18 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 void setRequestedSample(int begin, int end);
46 int getRequestedBegin();
47 int getRequestedEnd();
48
49 // ajout vf 25/07/2002
50 void startAll();
51 bool checkSamplesLimits(int pass);
52
53 void waitForAll();
54
55 void joinAll(); // deprecated. Use waitForAll();
56
57
58 // ajout cgt vf 19/08/2002
59
60 void selectTOISegmented(int bufsz=1024, int maxseg=20);
61 void selectTOISeqBuffered(int wsz=8192);
62
63 virtual TOI& connect(TOIProcessor& prout, string out,
64 TOIProcessor& prin, string in, string nom="",
65 int wbsz=0, bool withFlag=false);
66 virtual TOI& connect(TOIProcessor& prout, const char* out,
67 TOIProcessor& prin, const char* in, string nom="",
68 int wbsz=0, bool withFlag=false);
69
70 // fin ajout cgt
71
72
73
74
75protected:
76 TOIManager();
77 static TOIManager* instance;
78 long reqBegin;
79 long reqEnd;
80
81 vector<pthread_t*> threads;
82 void addThread(pthread_t*);
83
84 // ajout vf 25/07/2002
85
86 vector<TOIProcessor*> processors;
87 void registerProcessor(TOIProcessor* proc);
88
89 friend class TOIProcessor;
90
91 // ajout cgt vf 19/08/2002
92
93 bool fgSegmented; // type de toi
94 int segBuffsz, segMaxseg;
95
96 // fin ajout cgt
97
98};
99
100// -----------------------------------------------------------------
101// Classe pour affichage de l'avancement des TOIProcessors
102// Reza 08/2001
103// -----------------------------------------------------------------
104
105class RzProcSampleCounter {
106public:
107 RzProcSampleCounter();
108 virtual ~RzProcSampleCounter();
109 virtual long ProcessedSampleCount() = 0;
110 virtual long SampleBegin() = 0;
111 virtual long SampleEnd() = 0;
112 virtual long PrintStats();
113 inline int & PrintRate(int pr) { return _rate; }
114 inline string& InfoMessage() { return _msg; }
115protected:
116 int _rate;
117 string _msg;
118};
119
120template <class T>
121class ProcSampleCounter : public RzProcSampleCounter {
122public:
123 ProcSampleCounter(T & t) { _t = &t; }
124 virtual long ProcessedSampleCount()
125 { return _t->ProcessedSampleCount(); }
126 virtual long SampleBegin() { return _t->getMinIn(); }
127 virtual long SampleEnd() { return _t->getMaxIn(); }
128protected:
129 T * _t;
130};
131
132
133
134
135#endif
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Note: See TracBrowser for help on using the repository browser.