Rev | Line | |
---|
[1365] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 |
|
---|
| 3 | #ifndef TOIMANAGER_H
|
---|
| 4 | #define TOIMANAGER_H
|
---|
| 5 |
|
---|
[1687] | 6 | #include <string>
|
---|
[1365] | 7 | #include <vector>
|
---|
| 8 |
|
---|
[1410] | 9 | using namespace std;
|
---|
| 10 |
|
---|
[1365] | 11 | class TOIManager {
|
---|
| 12 | public:
|
---|
| 13 | static TOIManager* getManager();
|
---|
[1702] | 14 | void setRequestedSample(int begin, int end);
|
---|
| 15 | int getRequestedBegin();
|
---|
| 16 | int getRequestedEnd();
|
---|
[1365] | 17 | void addThread(pthread_t*);
|
---|
| 18 | void joinAll();
|
---|
| 19 |
|
---|
| 20 | protected:
|
---|
| 21 | TOIManager();
|
---|
| 22 | static TOIManager* instance;
|
---|
| 23 | long reqBegin;
|
---|
| 24 | long reqEnd;
|
---|
| 25 |
|
---|
| 26 | vector<pthread_t*> threads;
|
---|
| 27 | };
|
---|
| 28 |
|
---|
[1687] | 29 | // -----------------------------------------------------------------
|
---|
| 30 | // Classe pour affichage de l'avancement des TOIProcessors
|
---|
| 31 | // Reza 08/2001
|
---|
| 32 | // -----------------------------------------------------------------
|
---|
| 33 |
|
---|
| 34 | class RzProcSampleCounter {
|
---|
| 35 | public:
|
---|
[1702] | 36 | RzProcSampleCounter();
|
---|
[1687] | 37 | virtual ~RzProcSampleCounter();
|
---|
[1702] | 38 | virtual long ProcessedSampleCount() = 0;
|
---|
[1687] | 39 | virtual long PrintStats();
|
---|
| 40 | inline int & PrintRate(int pr) { return _rate; }
|
---|
| 41 | inline string& InfoMessage() { return _msg; }
|
---|
| 42 | protected:
|
---|
| 43 | int _rate;
|
---|
| 44 | string _msg;
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 | template <class T>
|
---|
| 48 | class ProcSampleCounter : public RzProcSampleCounter {
|
---|
| 49 | public:
|
---|
[1702] | 50 | ProcSampleCounter(const T & t) { _t = &t; }
|
---|
| 51 | virtual long ProcessedSampleCount()
|
---|
| 52 | { return _t->ProcessedSampleCount(); }
|
---|
[1687] | 53 | protected:
|
---|
| 54 | const T * _t;
|
---|
| 55 | };
|
---|
| 56 |
|
---|
[1365] | 57 | #endif
|
---|
[1702] | 58 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.