// This may look like C code, but it is really -*- C++ -*- // ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL // Eric Aubourg // Christophe Magneville // Reza Ansari // $Id: toimanager.h,v 1.13 2002-05-14 13:06:57 ansari Exp $ #ifndef TOIMANAGER_H #define TOIMANAGER_H #include "config.h" #include #include using namespace std; class TOIManager { public: static TOIManager* getManager(); void setRequestedSample(int begin, int end); int getRequestedBegin(); int getRequestedEnd(); void addThread(pthread_t*); void joinAll(); protected: TOIManager(); static TOIManager* instance; long reqBegin; long reqEnd; vector threads; }; // ----------------------------------------------------------------- // Classe pour affichage de l'avancement des TOIProcessors // Reza 08/2001 // ----------------------------------------------------------------- class RzProcSampleCounter { public: RzProcSampleCounter(); virtual ~RzProcSampleCounter(); virtual long ProcessedSampleCount() = 0; virtual long SampleBegin() = 0; virtual long SampleEnd() = 0; virtual long PrintStats(); inline int & PrintRate(int pr) { return _rate; } inline string& InfoMessage() { return _msg; } protected: int _rate; string _msg; }; template class ProcSampleCounter : public RzProcSampleCounter { public: ProcSampleCounter(T & t) { _t = &t; } virtual long ProcessedSampleCount() { return _t->ProcessedSampleCount(); } virtual long SampleBegin() { return _t->getMinIn(); } virtual long SampleEnd() { return _t->getMaxIn(); } protected: T * _t; }; #endif