-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstoragethread.h
57 lines (49 loc) · 1.53 KB
/
storagethread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef STORAGETHREAD_H
#define STORAGETHREAD_H
#include <QThread>
#include <QVector>
#include <QTimer>
#include "preprocessorthread.h"
#include "processorthread.h"
#define BLOCK_SIZE 512
#define PROCESSOR_READY 0
#define PROCESSOR_BUSY 1
class StorageThread : public QThread
{
Q_OBJECT
public:
explicit StorageThread(int preprocessor_bs, int processor_bs, int device_bs, int ti, int t1, int t2, QObject *parent = 0);
~StorageThread();
const ProcessorThread* getProcessor() { return processor; }
signals:
void preprocessorBlockReady(short *ptr);
void processorBlockReady(double *ptr);
void changeUsedMemory(int preprocessor_blocks_count, int processor_blocks_count, int temp_buffer_postion);
public slots:
void cacheRawData();
void cachePreprocessedData(double avg);
void notifyAboutReadyProcessor();
private:
QVector<short*> preprocessor_blocks;
QVector<double*> processor_blocks;
int preprocessor_state;
int processor_state;
int preprocessor_block_size;
int processor_block_size;
int device_buffer_size;
short *temp_preprocessor_buffer;
int temp_preprocessor_buffer_position;
double *temp_processor_buffer;
int temp_processor_buffer_position;
QTimer timer;
PreprocessorThread *preprocessor;
ProcessorThread *processor;
int timer_interval;
void callPreprocessorIfRequired();
void callProcessorIfRequired();
void emitUsedMemoryChanged();
void copyDataToTempBuffer(short *data, int size);
protected:
void run();
};
#endif // STORAGETHREAD_H