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

Last change on this file since 2136 was 2133, checked in by vfebvre, 23 years ago

startAll sur TOIManager

File size: 2.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.14 2002-07-26 08:52:43 vfebvre 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
19using namespace std;
20
21class TOIManager {
22public:
23 static TOIManager* getManager();
24 void setRequestedSample(int begin, int end);
25 int getRequestedBegin();
26 int getRequestedEnd();
27
28 void startAll();
29 void waitForAll();
30
31 void joinAll(); // deprecated. Use waitForAll();
32
33protected:
34 TOIManager();
35 static TOIManager* instance;
36 long reqBegin;
37 long reqEnd;
38
39 vector<pthread_t*> threads;
40 void addThread(pthread_t*);
41
42 vector<TOIProcessor*> processors;
43 void registerProcessor(TOIProcessor* proc);
44
45
46 friend class TOIProcessor;
47};
48
49// -----------------------------------------------------------------
50// Classe pour affichage de l'avancement des TOIProcessors
51// Reza 08/2001
52// -----------------------------------------------------------------
53
54class RzProcSampleCounter {
55public:
56 RzProcSampleCounter();
57 virtual ~RzProcSampleCounter();
58 virtual long ProcessedSampleCount() = 0;
59 virtual long SampleBegin() = 0;
60 virtual long SampleEnd() = 0;
61 virtual long PrintStats();
62 inline int & PrintRate(int pr) { return _rate; }
63 inline string& InfoMessage() { return _msg; }
64protected:
65 int _rate;
66 string _msg;
67};
68
69template <class T>
70class ProcSampleCounter : public RzProcSampleCounter {
71public:
72 ProcSampleCounter(T & t) { _t = &t; }
73 virtual long ProcessedSampleCount()
74 { return _t->ProcessedSampleCount(); }
75 virtual long SampleBegin() { return _t->getMinIn(); }
76 virtual long SampleEnd() { return _t->getMaxIn(); }
77protected:
78 T * _t;
79};
80
81#endif
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Note: See TracBrowser for help on using the repository browser.