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

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

v_oct02_mieux

File size: 3.0 KB
RevLine 
[1365]1// This may look like C code, but it is really -*- C++ -*-
2
[1738]3// ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
4// Eric Aubourg
5// Christophe Magneville
6// Reza Ansari
[2225]7// $Id: toimanager.h,v 1.17 2002-10-23 21:57:40 aubourg Exp $
[1738]8
9
[1365]10#ifndef TOIMANAGER_H
11#define TOIMANAGER_H
12
[1766]13#include "config.h"
[1687]14#include <string>
[1766]15#include <vector>
[1365]16
[2133]17#include "toiprocessor.h"
18
[2187]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
[1410]40using namespace std;
41
[1365]42class TOIManager {
43public:
44 static TOIManager* getManager();
[2225]45 virtual ~TOIManager() {}
[1702]46 void setRequestedSample(int begin, int end);
47 int getRequestedBegin();
48 int getRequestedEnd();
[1365]49
[2187]50 // ajout vf 25/07/2002
[2133]51 void startAll();
[2187]52 bool checkSamplesLimits(int pass);
53
[2133]54 void waitForAll();
55
56 void joinAll(); // deprecated. Use waitForAll();
57
[2187]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
[2220]64 virtual TOI& connect(TOIProcessor& prout, string out,
65 TOIProcessor& prin, string in, string nom="",
[2187]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
[1365]76protected:
77 TOIManager();
78 static TOIManager* instance;
79 long reqBegin;
80 long reqEnd;
81
82 vector<pthread_t*> threads;
[2133]83 void addThread(pthread_t*);
84
[2187]85 // ajout vf 25/07/2002
86
[2133]87 vector<TOIProcessor*> processors;
88 void registerProcessor(TOIProcessor* proc);
89
[2187]90 friend class TOIProcessor;
[2133]91
[2187]92 // ajout cgt vf 19/08/2002
93
94 bool fgSegmented; // type de toi
95 int segBuffsz, segMaxseg;
96
97 // fin ajout cgt
98
[1365]99};
100
[1687]101// -----------------------------------------------------------------
102// Classe pour affichage de l'avancement des TOIProcessors
103// Reza 08/2001
104// -----------------------------------------------------------------
105
106class RzProcSampleCounter {
107public:
[1702]108 RzProcSampleCounter();
[1687]109 virtual ~RzProcSampleCounter();
[1702]110 virtual long ProcessedSampleCount() = 0;
[1999]111 virtual long SampleBegin() = 0;
112 virtual long SampleEnd() = 0;
[1687]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:
[2000]124 ProcSampleCounter(T & t) { _t = &t; }
[1702]125 virtual long ProcessedSampleCount()
126 { return _t->ProcessedSampleCount(); }
[1999]127 virtual long SampleBegin() { return _t->getMinIn(); }
128 virtual long SampleEnd() { return _t->getMaxIn(); }
[1687]129protected:
[2000]130 T * _t;
[1687]131};
132
[2187]133
134
135
[1365]136#endif
[1702]137
[2133]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.