Drake Designer
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
ddLCMThread.h
Go to the documentation of this file.
1 #ifndef __ddLCMThread_h
2 #define __ddLCMThread_h
3 
4 #include <QThread>
5 #include <QMutex>
6 #include "ddAppConfigure.h"
7 
8 
9 class ddLCMSubscriber;
10 
11 namespace lcm
12 {
13  class LCM;
14 }
15 
16 class DD_APP_EXPORT ddLCMThread : public QThread
17  {
18  Q_OBJECT
19 
20 public:
21 
22  ddLCMThread(QObject* parent=NULL);
23  virtual ~ddLCMThread();
24 
25  void stop();
26 
27  void addSubscriber(ddLCMSubscriber* subscriber);
28  void removeSubscriber(ddLCMSubscriber* subscriber);
29 
30  lcm::LCM* lcmHandle()
31  {
32  this->initLCM();
33  return mLCM;
34  }
35 
36  protected:
37 
38  void run();
39  void threadLoopWithSelect();
40  bool waitForLCM(double timeout);
41  void initLCM();
42 
45  QList<ddLCMSubscriber*> mSubscribers;
46  lcm::LCM* mLCM;
47 
48  QMutex mMutex;
49 };
50 
51 #endif
lcm::LCM * lcmHandle()
Definition: ddLCMThread.h:30
bool mShouldStop
Definition: ddLCMThread.h:43
QMutex mMutex
Definition: ddLCMThread.h:48
double mSelectTimeout
Definition: ddLCMThread.h:44
QList< ddLCMSubscriber * > mSubscribers
Definition: ddLCMThread.h:45
#define DD_APP_EXPORT
lcm::LCM * mLCM
Definition: ddLCMThread.h:46