|
Last change
on this file since 1674 was 1653, checked in by cmv, 24 years ago |
|
ajout include unistd.h pour sleep() sous Linux dans toimanager.cc
ajout include string sous Linux dans toimanager.h
cmv 21/9/01
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | // This may look like C code, but it is really -*- C++ -*-
|
|---|
| 2 |
|
|---|
| 3 | #ifndef TOIMANAGER_H
|
|---|
| 4 | #define TOIMANAGER_H
|
|---|
| 5 |
|
|---|
| 6 | #include <string>
|
|---|
| 7 | #include <vector>
|
|---|
| 8 |
|
|---|
| 9 | using namespace std;
|
|---|
| 10 |
|
|---|
| 11 | class TOIManager {
|
|---|
| 12 | public:
|
|---|
| 13 | static TOIManager* getManager();
|
|---|
| 14 | void setRequestedSample(long begin, long end);
|
|---|
| 15 | long getRequestedBegin();
|
|---|
| 16 | long getRequestedEnd();
|
|---|
| 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 |
|
|---|
| 29 |
|
|---|
| 30 | // -----------------------------------------------------------------
|
|---|
| 31 | // Classe pour affichage de l'avancement des TOIProcessors
|
|---|
| 32 | // Reza 08/2001
|
|---|
| 33 | // -----------------------------------------------------------------
|
|---|
| 34 |
|
|---|
| 35 | class RzProcSampleCounter {
|
|---|
| 36 | public:
|
|---|
| 37 | RzProcSampleCounter();
|
|---|
| 38 | virtual ~RzProcSampleCounter();
|
|---|
| 39 | virtual long ProcessedSampleCount() = 0;
|
|---|
| 40 | virtual long PrintStats();
|
|---|
| 41 | inline int & PrintRate(int pr) { return _rate; }
|
|---|
| 42 | inline string& InfoMessage() { return _msg; }
|
|---|
| 43 | protected:
|
|---|
| 44 | int _rate;
|
|---|
| 45 | string _msg;
|
|---|
| 46 | };
|
|---|
| 47 |
|
|---|
| 48 | template <class T>
|
|---|
| 49 | class ProcSampleCounter : public RzProcSampleCounter {
|
|---|
| 50 | public:
|
|---|
| 51 | ProcSampleCounter(const T & t) { _t = &t; }
|
|---|
| 52 | virtual long ProcessedSampleCount()
|
|---|
| 53 | { return _t->ProcessedSampleCount(); }
|
|---|
| 54 | protected:
|
|---|
| 55 | const T * _t;
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.