c_serial_jobmanager.h 555 B

123456789101112131415161718192021222324
  1. #ifndef __C_SERIAL_JOBMANAGER_H__
  2. #define __C_SERIAL_JOBMANAGER_H__
  3. #include "c_jobmanager.h"
  4. template<class T> class C_SERIAL_JOBMANAGER : public C_JOBMANAGER<T> {
  5. private:
  6. int currentJob;
  7. public:
  8. C_SERIAL_JOBMANAGER() {
  9. currentJob = 0;
  10. }
  11. ~C_SERIAL_JOBMANAGER() { }
  12. int GetCurrentJob() { return currentJob; }
  13. virtual void Run(int passes = 1) {
  14. int numPasses = passes;
  15. while(numPasses-- > 0) {
  16. C_JOBMANAGER<T>::Run(currentJob++);
  17. if(currentJob > GetNumJobs()) currentJob = 0;
  18. }
  19. }
  20. };
  21. #endif // !__C_SERIAL_JOBMANAGER_H__