Torc  0.1
torcreferencecounted.h
Go to the documentation of this file.
1 #ifndef TORCREFERENCECOUNTED_H_
2 #define TORCREFERENCECOUNTED_H_
3 
4 // Qt
5 #include <QAtomicInt>
6 
8 {
9  public:
10  static void EventLoopEnding(bool Ending);
11 
13  virtual ~TorcReferenceCounter(void) = default;
14 
15  void UpRef(void);
16  virtual bool DownRef(void);
17  bool IsShared(void);
18 
19  protected:
20  QAtomicInt m_refCount;
21  static bool m_eventLoopEnding;
22 
23  private:
24  Q_DISABLE_COPY(TorcReferenceCounter)
25 };
26 
28 {
29  public:
30  explicit TorcReferenceLocker(TorcReferenceCounter *Counter);
32 
33  private:
34  Q_DISABLE_COPY(TorcReferenceLocker)
35  TorcReferenceCounter *m_refCountedObject;
36 };
37 
38 #endif
static void EventLoopEnding(bool Ending)
A reference counting implementation.
virtual bool DownRef(void)
virtual ~TorcReferenceCounter(void)=default
A convenience class to maintain a reference to an object within a given scope.