-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrixstorage.h
49 lines (46 loc) · 998 Bytes
/
matrixstorage.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
#ifndef MATRIXSTORAGE_H
#define MATRIXSTORAGE_H
#include <QQueue>
#include <QHash>
#include <QPixmap>
#include <QMutex>
namespace DG{
class Resolution;
class ScreenPacket;
class Rect;
class MatrixStorageItem;
class UpdateThread;
}
namespace DG{
/**
* Should be Sigleton
*/
class MatrixStorage: public QObject{
Q_OBJECT
private:
QMutex mutex;
QMutex nMutex;
private:
QQueue<ScreenPacket*> queue;
private:
quint16 _rows;
quint16 _cols;
QHash<quint32, MatrixStorageItem*> items;
public:
MatrixStorage(const DG::Resolution* resolution, quint16 rows, quint16 cols);
virtual ~MatrixStorage();
public:
const ScreenPacket* packet(quint16 row, quint16 col, int state) const;
MatrixStorageItem* item(quint16 row, quint16 col) const;
private:
quint32 index(quint16 row, quint16 col) const;
public:
void setUpdated(MatrixStorageItem* item);
public:
int queueSize() const;
ScreenPacket* next(int state);
signals:
void enqueued();
};
}
#endif // MATRIXSTORAGE_H