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

Last change on this file since 2461 was 2448, checked in by aubourg, 22 years ago

pb long/int

File size: 3.2 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
[2448]7// $Id: toimanager.h,v 1.19 2003-10-13 20:48:37 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"
[2386]18#include "ringprocessor.h"
[2133]19
[2187]20
21#include "toi.h"
[2386]22#include "ringpipe.h"
[2187]23
24#include <typeinfo>
25#include "toiseqbuff.h"
26#include "toisegment.h"
[2448]27//#include "fitstoiwtr.h"
[2187]28
29#ifdef WITH_SOPHYA
30#include "pexceptions.h"
31#else
32#include "apexceptions.h"
33#endif
34
35#include <pthread.h>
36
37
38
[2386]39
[1410]40using namespace std;
41
[1365]42class TOIManager {
43public:
44 static TOIManager* getManager();
[2225]45 virtual ~TOIManager() {}
[2448]46 void setRequestedSample(long begin, long end);
[1702]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);
[2386]53 void checkRingLimits();
[2187]54
[2133]55 void waitForAll();
56
57 void joinAll(); // deprecated. Use waitForAll();
58
[2187]59
60 // ajout cgt vf 19/08/2002
61
62 void selectTOISegmented(int bufsz=1024, int maxseg=20);
63 void selectTOISeqBuffered(int wsz=8192);
64
[2220]65 virtual TOI& connect(TOIProcessor& prout, string out,
66 TOIProcessor& prin, string in, string nom="",
[2187]67 int wbsz=0, bool withFlag=false);
68 virtual TOI& connect(TOIProcessor& prout, const char* out,
69 TOIProcessor& prin, const char* in, string nom="",
70 int wbsz=0, bool withFlag=false);
71
72 // fin ajout cgt
73
[2386]74 virtual RingPipe& connect(RingProcessor& pout, string out,
75 RingProcessor& pint, string in);
[2187]76
77
[1365]78protected:
79 TOIManager();
80 static TOIManager* instance;
81 long reqBegin;
82 long reqEnd;
83
84 vector<pthread_t*> threads;
[2133]85 void addThread(pthread_t*);
86
[2187]87 // ajout vf 25/07/2002
88
[2133]89 vector<TOIProcessor*> processors;
90 void registerProcessor(TOIProcessor* proc);
[2386]91 vector<RingProcessor*> ringProcessors;
92 void registerProcessor(RingProcessor* proc);
[2133]93
[2187]94 friend class TOIProcessor;
[2386]95 friend class RingProcessor;
[2133]96
[2187]97 // ajout cgt vf 19/08/2002
98
99 bool fgSegmented; // type de toi
100 int segBuffsz, segMaxseg;
101
102 // fin ajout cgt
103
[1365]104};
105
[1687]106// -----------------------------------------------------------------
107// Classe pour affichage de l'avancement des TOIProcessors
108// Reza 08/2001
109// -----------------------------------------------------------------
110
111class RzProcSampleCounter {
112public:
[1702]113 RzProcSampleCounter();
[1687]114 virtual ~RzProcSampleCounter();
[1702]115 virtual long ProcessedSampleCount() = 0;
[1999]116 virtual long SampleBegin() = 0;
117 virtual long SampleEnd() = 0;
[1687]118 virtual long PrintStats();
119 inline int & PrintRate(int pr) { return _rate; }
120 inline string& InfoMessage() { return _msg; }
121protected:
122 int _rate;
123 string _msg;
124};
125
126template <class T>
127class ProcSampleCounter : public RzProcSampleCounter {
128public:
[2000]129 ProcSampleCounter(T & t) { _t = &t; }
[1702]130 virtual long ProcessedSampleCount()
131 { return _t->ProcessedSampleCount(); }
[1999]132 virtual long SampleBegin() { return _t->getMinIn(); }
133 virtual long SampleEnd() { return _t->getMaxIn(); }
[1687]134protected:
[2000]135 T * _t;
[1687]136};
137
[2187]138
139
140
[1365]141#endif
[1702]142
[2133]143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Note: See TracBrowser for help on using the repository browser.