dispmap/svprocessor.h

62 lines
1.1 KiB
C
Raw Normal View History

2014-07-11 20:35:48 +04:00
#ifndef SVPROCESSOR_H
#define SVPROCESSOR_H
2014-07-22 20:37:29 +04:00
#include <time.h>
2014-07-23 20:50:12 +04:00
#include <QObject>
#include <QThread>
#include <QDebug>
#include <QQueue>
#include <QMutex>
2014-07-25 11:32:00 +04:00
#include <QException>
2014-07-11 20:35:48 +04:00
#include "svimage.h"
#include "svworker.h"
2014-07-25 11:32:00 +04:00
#include "svkernel.h"
2014-07-23 20:50:12 +04:00
#include "svpointcloud.h"
2014-07-25 11:32:00 +04:00
class SvWorker;
2014-07-23 20:50:12 +04:00
2014-07-25 11:32:00 +04:00
class SvNoMoreTasks: public QException
{
};
2014-07-11 20:35:48 +04:00
class SvProcessor: public QObject
{
Q_OBJECT
protected:
2014-07-25 11:32:00 +04:00
QThread* m_threads;
SvWorker* m_workers;
SvKernel* m_kernel;
uint m_numberOfWorkers;
uint m_workersFinished;
uint m_startTime;
QQueue<SvProcessorTask*> m_taskQueue;
QMutex m_nextTaskMutex;
2014-07-11 20:35:48 +04:00
public:
explicit SvProcessor(QObject *parent = 0);
2014-07-25 11:32:00 +04:00
SvProcessor(int numberOfWorkers = 1);
2014-07-11 20:35:48 +04:00
~SvProcessor();
void execute();
2014-07-25 11:32:00 +04:00
void enqueueImage(SvPointCloud *pointCloud, SvImage *image);
2014-07-23 20:50:12 +04:00
SvProcessorTask nextTask();
2014-07-11 20:35:48 +04:00
protected slots:
void workerFinished(int workerId);
public slots:
void start();
void stop();
signals:
void started();
void finished(int elapsedTime);
void stopped(int elapsedTime);
};
#endif // SVPROCESSOR_H