stec-platform
replyblock.h
1 /*
2 *
3 * $LastChangedDate: $
4 * $LastChangedBy: $
5 * $Revision: $
6 * $Author: $
7 * $URL: $
8 * $Id: $
9 * edc@vremsoft.com
10 *
11 *
12 * *** 2014<c> ***
13 *
14 *
15 */
16 
17 #pragma once
18 
19 
20 #include <QtCore>
21 #include <QVariantList>
22 #include <vremthread.h>
23 #include <platform_global.h>
24 
25 
26 
27 
28 
29 
39 class PLATFORMSHARED_EXPORT ReplyBlock : public VremThread
40 {
41 public :
42  struct TQUE {
43  int Command;
44  QVariantList UserData;
45  TQUE( int command) : Command(command) {}
46  };
47 
48 
49  typedef QList<TQUE> VQVVArrayVArray;
50 
51 private :
52  typedef QMap<int, TQUE> MapTMS;
53  typedef MapTMS::iterator MapTMSItr;
54 
56  QMutex memLock;
57 
59  QWaitCondition enqueue;
60 
62  VQVVArrayVArray queue;
63 
65  QMutex tmsLock;
66  MapTMS tmsQueue;
67 
68 protected :
69 
71  void timerEvent(QTimerEvent *event);
72 
73 public:
74 
76  ReplyBlock( QThread::Priority priority=QThread::LowPriority,
77  QObject *parent = 0);
78 
80  virtual ~ReplyBlock();
81 
83  void run();
84 
86  void ProcessThis(TQUE cmd, int mseconds = 0);
87 
89  void ProcessThis(int cmd, int mseconds = 0);
90 
92  virtual void UserProcess(TQUE &) { }
93 
95  virtual void WakeMeUp(void);
96 
97 };
98 
99 
100 
101 
102 
The ReplyBlock class ReplyBlock reply block thread so it can be used again and again....
Definition: replyblock.h:40
virtual void UserProcess(TQUE &)
User Process.
Definition: replyblock.h:92
The VremThread class Vremthead is a normal thread, but is constructed so that the loader or vrem prog...
Definition: vremthread.h:36
virtual void WakeMeUp(void)
user should use to trigger event if it gets hit, user should exit run
Definition: vremthread.h:47
Definition: replyblock.h:42