Torc  0.1
torcadminthread.h
Go to the documentation of this file.
1 #ifndef TORCADMINTHREAD_H
2 #define TORCADMINTHREAD_H
3 
4 // Qt
5 #include <QList>
6 
7 // Torc
8 #include "torcqthread.h"
9 
10 class QMutex;
11 
13 {
14  Q_OBJECT
15  public:
17  virtual ~TorcAdminThread() = default;
18 
19  void Start (void);
20  void Finish (void);
21 };
22 
23 #define TORC_ADMIN_CRIT_PRIORITY 200
24 #define TORC_ADMIN_HIGH_PRIORITY 100
25 #define TORC_ADMIN_MED_PRIORITY 50
26 #define TORC_ADMIN_LOW_PRIORITY 10
27 
29 {
30  public:
31  static void CreateObjects (void);
32  static void DestroyObjects (void);
33  static bool HigherPriority (const TorcAdminObject *Object1,
34  const TorcAdminObject *Object2);
35 
36  public:
37  explicit TorcAdminObject(int Priority = TORC_ADMIN_LOW_PRIORITY);
38  virtual ~TorcAdminObject() = default;
39 
40  int Priority (void) const;
41  TorcAdminObject* GetNextObject (void);
42  virtual void Create (void) = 0;
43  virtual void Destroy (void) = 0;
44 
45  private:
46  static QList<TorcAdminObject*> gTorcAdminObjects;
47  static TorcAdminObject *gTorcAdminObject;
48  static QMutex *gTorcAdminObjectsLock;
49  TorcAdminObject *m_nextTorcAdminObject;
50  int m_priority;
51 
52  private:
53  Q_DISABLE_COPY(TorcAdminObject)
54 };
55 
56 #endif // TORCADMINTHREAD_H
A simple thread to launch helper objects outside of the main loop.
virtual ~TorcAdminThread()=default
A factory class for automatically running objects outside of the main loop.
#define TORC_ADMIN_LOW_PRIORITY
A Torc specific wrapper around QThread.
Definition: torcqthread.h:7