Rev | Line | |
---|
[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
|
---|
[1766] | 7 | // $Id: toimanager.h,v 1.11 2001-11-14 14:49:05 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 |
|
---|
[1410] | 17 | using namespace std;
|
---|
| 18 |
|
---|
[1365] | 19 | class TOIManager {
|
---|
| 20 | public:
|
---|
| 21 | static TOIManager* getManager();
|
---|
[1702] | 22 | void setRequestedSample(int begin, int end);
|
---|
| 23 | int getRequestedBegin();
|
---|
| 24 | int getRequestedEnd();
|
---|
[1365] | 25 | void addThread(pthread_t*);
|
---|
| 26 | void joinAll();
|
---|
| 27 |
|
---|
| 28 | protected:
|
---|
| 29 | TOIManager();
|
---|
| 30 | static TOIManager* instance;
|
---|
| 31 | long reqBegin;
|
---|
| 32 | long reqEnd;
|
---|
| 33 |
|
---|
| 34 | vector<pthread_t*> threads;
|
---|
| 35 | };
|
---|
| 36 |
|
---|
[1687] | 37 | // -----------------------------------------------------------------
|
---|
| 38 | // Classe pour affichage de l'avancement des TOIProcessors
|
---|
| 39 | // Reza 08/2001
|
---|
| 40 | // -----------------------------------------------------------------
|
---|
| 41 |
|
---|
| 42 | class RzProcSampleCounter {
|
---|
| 43 | public:
|
---|
[1702] | 44 | RzProcSampleCounter();
|
---|
[1687] | 45 | virtual ~RzProcSampleCounter();
|
---|
[1702] | 46 | virtual long ProcessedSampleCount() = 0;
|
---|
[1687] | 47 | virtual long PrintStats();
|
---|
| 48 | inline int & PrintRate(int pr) { return _rate; }
|
---|
| 49 | inline string& InfoMessage() { return _msg; }
|
---|
| 50 | protected:
|
---|
| 51 | int _rate;
|
---|
| 52 | string _msg;
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | template <class T>
|
---|
| 56 | class ProcSampleCounter : public RzProcSampleCounter {
|
---|
| 57 | public:
|
---|
[1702] | 58 | ProcSampleCounter(const T & t) { _t = &t; }
|
---|
| 59 | virtual long ProcessedSampleCount()
|
---|
| 60 | { return _t->ProcessedSampleCount(); }
|
---|
[1687] | 61 | protected:
|
---|
| 62 | const T * _t;
|
---|
| 63 | };
|
---|
| 64 |
|
---|
[1365] | 65 | #endif
|
---|
[1702] | 66 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.