QXRD  0.11.16
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
QxrdFileSaverThread Class Reference

#include <qxrdfilesaverthread.h>

Inheritance diagram for QxrdFileSaverThread:
Inheritance graph
[legend]
Collaboration diagram for QxrdFileSaverThread:
Collaboration graph
[legend]

Public Member Functions

 QxrdFileSaverThread (QcepAllocatorWPtr acq)
 
 ~QxrdFileSaverThread ()
 
void shutdown ()
 
QxrdFileSaverPtr fileSaver () const
 
- Public Member Functions inherited from QxrdThread
 QxrdThread (QObject *parent=0)
 
- Public Member Functions inherited from QcepThread
 QcepThread (QObject *parent=0)
 

Protected Member Functions

void run ()
 

Private Attributes

QxrdFileSaverPtr m_FileSaver
 
QcepAllocatorWPtr m_Allocator
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepThread
static void msleep (long unsigned int)
 
- Protected Attributes inherited from QcepThread
QMutex m_Mutex
 

Detailed Description

Definition at line 10 of file qxrdfilesaverthread.h.

Constructor & Destructor Documentation

QxrdFileSaverThread::QxrdFileSaverThread ( QcepAllocatorWPtr  acq)

Definition at line 10 of file qxrdfilesaverthread.cpp.

References DEBUG_CONSTRUCTORS, m_Allocator, and qcepDebug().

11  : QxrdThread(),
12  m_FileSaver(),
13  m_Allocator()
14 {
16  printf("QxrdFileSaverThread::QxrdFileSaverThread(%p)\n", this);
17  }
18 
19  qRegisterMetaType<QcepDoubleImageDataPtr>("QcepDoubleImageDataPtr");
20  qRegisterMetaType<QcepInt32ImageDataPtr>("QcepInt32ImageDataPtr");
21  qRegisterMetaType<QcepInt16ImageDataPtr>("QcepInt16ImageDataPtr");
22  qRegisterMetaType<QcepMaskDataPtr>("QcepMaskDataPtr");
23  qRegisterMetaType<QcepIntegratedDataPtr>("QcepIntegratedDataPtr");
24  qRegisterMetaType<FILE*>("FILE*");
25  qRegisterMetaType< QVector<double> >("QVector<double>");
26 
27  m_Allocator = allocator;
28 
29  setObjectName("fileSaver");
30 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepAllocatorWPtr m_Allocator
QxrdThread(QObject *parent=0)
Definition: qxrdthread.cpp:3
QxrdFileSaverPtr m_FileSaver

Here is the call graph for this function:

QxrdFileSaverThread::~QxrdFileSaverThread ( )

Definition at line 32 of file qxrdfilesaverthread.cpp.

References DEBUG_CONSTRUCTORS, qcepDebug(), and shutdown().

33 {
34  shutdown();
35 
37  printf("QxrdFileSaverThread::~QxrdFileSaverThread(%p)\n", this);
38  }
39 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

QxrdFileSaverPtr QxrdFileSaverThread::fileSaver ( ) const

Definition at line 73 of file qxrdfilesaverthread.cpp.

References m_FileSaver, and QcepThread::m_Mutex.

74 {
75  while (isRunning()) {
76  {
77  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
78 
79  if (m_FileSaver) return m_FileSaver;
80  }
81 
82  QThread::msleep(50);
83  }
84 
85  return QxrdFileSaverPtr();
86 }
QMutex m_Mutex
Definition: qcepthread.h:17
QSharedPointer< QxrdFileSaver > QxrdFileSaverPtr
QxrdFileSaverPtr m_FileSaver
void QxrdFileSaverThread::run ( )
protected

Definition at line 41 of file qxrdfilesaverthread.cpp.

References DEBUG_THREADS, m_Allocator, m_FileSaver, QcepThread::m_Mutex, and qcepDebug().

42 {
43  if (qcepDebug(DEBUG_THREADS)) {
44  printf("File Saver Thread Started\n");
45  }
46 
48 
49  m_Mutex.lock();
50  m_FileSaver = res;
51  m_Mutex.unlock();
52 
53  int rc = exec();
54 
55  {
56  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
57 
59  }
60 
61  if (qcepDebug(DEBUG_THREADS)) {
62  printf("File Saver Thread Terminated with rc %d\n", rc);
63  }
64 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepAllocatorWPtr m_Allocator
QMutex m_Mutex
Definition: qcepthread.h:17
QSharedPointer< QxrdFileSaver > QxrdFileSaverPtr
QxrdFileSaverPtr m_FileSaver

Here is the call graph for this function:

void QxrdFileSaverThread::shutdown ( )
virtual

Implements QxrdThread.

Definition at line 66 of file qxrdfilesaverthread.cpp.

Referenced by ~QxrdFileSaverThread().

67 {
68  exit();
69 
70  wait();
71 }

Here is the caller graph for this function:

Member Data Documentation

QcepAllocatorWPtr QxrdFileSaverThread::m_Allocator
private

Definition at line 26 of file qxrdfilesaverthread.h.

Referenced by QxrdFileSaverThread(), and run().

QxrdFileSaverPtr QxrdFileSaverThread::m_FileSaver
private

Definition at line 25 of file qxrdfilesaverthread.h.

Referenced by fileSaver(), and run().


The documentation for this class was generated from the following files: