NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkIGITimerBasedThread.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkIGITimerBasedThread_h
16 #define niftkIGITimerBasedThread_h
17 
18 #include "niftkIGIDataSourcesExports.h"
19 #include <QThread>
20 #include <QTimer>
21 
22 namespace niftk
23 {
24 
32 class NIFTKIGIDATASOURCES_EXPORT IGITimerBasedThread : public QThread
33 {
34  Q_OBJECT
35 
36 public:
37 
38  IGITimerBasedThread(QObject *parent);
40 
44  void SetInterval(unsigned int milliseconds);
45 
50  virtual void run() override;
51 
55  virtual void ForciblyStop();
56 
57 protected:
58 
62  virtual void OnTimeoutImpl() = 0;
63 
64 private slots:
65 
69  virtual void OnTimeout();
70 
71 private:
72 
73  unsigned int m_TimerInterval;
74  QTimer *m_Timer;
75 };
76 
77 } // end namespace
78 
79 #endif
Base class for threads that are simply triggered off of a QTimer.
Definition: niftkIGITimerBasedThread.h:32
Definition: niftkExceptionObject.h:21