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

#include <qxrdexperimentthread.h>

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

Public Member Functions

 QxrdExperimentThread (QString path, QxrdApplicationWPtr app, QSettings *settings)
 
virtual ~QxrdExperimentThread ()
 
void init (QxrdExperimentThreadWPtr expThread)
 
QxrdExperimentPtr experiment ()
 
void shutdown ()
 
- Public Member Functions inherited from QxrdThread
 QxrdThread (QObject *parent=0)
 
- Public Member Functions inherited from QcepThread
 QcepThread (QObject *parent=0)
 

Static Public Member Functions

static QxrdExperimentThreadPtr newExperiment (QString path, QxrdApplicationWPtr app, QSettings *settings)
 
- Static Public Member Functions inherited from QcepThread
static void msleep (long unsigned int)
 

Protected Member Functions

void run ()
 

Private Attributes

QString m_ExperimentPath
 
QxrdApplicationWPtr m_Application
 
QSettings * m_Settings
 
QxrdExperimentThreadWPtr m_ExperimentThread
 
QxrdExperimentPtr m_Experiment
 

Additional Inherited Members

- Protected Attributes inherited from QcepThread
QMutex m_Mutex
 

Detailed Description

Definition at line 13 of file qxrdexperimentthread.h.

Constructor & Destructor Documentation

QxrdExperimentThread::QxrdExperimentThread ( QString  path,
QxrdApplicationWPtr  app,
QSettings *  settings 
)

Definition at line 14 of file qxrdexperimentthread.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

Referenced by newExperiment().

14  :
15  QxrdThread(),
16  m_ExperimentPath(path),
17  m_Application(app),
18  m_Settings(settings)
19 {
21  printf("QxrdExperimentThread::QxrdExperimentThread(%p)\n", this);
22  }
23 
24  setObjectName("experiment");
25 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdApplicationWPtr m_Application
QxrdThread(QObject *parent=0)
Definition: qxrdthread.cpp:3

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdExperimentThread::~QxrdExperimentThread ( )
virtual

Definition at line 27 of file qxrdexperimentthread.cpp.

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

28 {
29  if (qcepDebug(DEBUG_APP)) {
31 
32  if (app) {
33  app->printMessage("QxrdExperimentThread::~QxrdExperimentThread");
34  }
35  }
36 
38  printf("QxrdExperimentThread::~QxrdExperimentThread(%p)\n", this);
39  }
40 
41  ::fflush(stdout);
42 
43  shutdown();
44 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdApplicationWPtr m_Application
QSharedPointer< QxrdApplication > QxrdApplicationPtr

Here is the call graph for this function:

Member Function Documentation

QxrdExperimentPtr QxrdExperimentThread::experiment ( )

Definition at line 60 of file qxrdexperimentthread.cpp.

References m_Experiment, QcepThread::m_Mutex, and QcepThread::msleep().

61 {
62  while (isRunning()) {
63  {
64  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
65 
66  if (m_Experiment) return m_Experiment;
67  }
68 
69  msleep(100);
70  }
71 
72  return QxrdExperimentPtr();
73 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
static void msleep(long unsigned int)
Definition: qcepthread.cpp:10
QMutex m_Mutex
Definition: qcepthread.h:17
QxrdExperimentPtr m_Experiment

Here is the call graph for this function:

void QxrdExperimentThread::init ( QxrdExperimentThreadWPtr  expThread)

Definition at line 46 of file qxrdexperimentthread.cpp.

References m_ExperimentThread.

47 {
48  m_ExperimentThread = expThread;
49 }
QxrdExperimentThreadWPtr m_ExperimentThread
QxrdExperimentThreadPtr QxrdExperimentThread::newExperiment ( QString  path,
QxrdApplicationWPtr  app,
QSettings *  settings 
)
static

Definition at line 51 of file qxrdexperimentthread.cpp.

References QxrdExperimentThread().

Referenced by QxrdApplication::openExperiment().

52 {
54 
55  res->start();
56 
57  return res;
58 }
QxrdExperimentThread(QString path, QxrdApplicationWPtr app, QSettings *settings)
QSharedPointer< QxrdExperimentThread > QxrdExperimentThreadPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperimentThread::run ( )
protected

Definition at line 75 of file qxrdexperimentthread.cpp.

References DEBUG_THREADS, m_Application, m_Experiment, m_ExperimentPath, QcepThread::m_Mutex, m_Settings, and qcepDebug().

76 {
77  if (qcepDebug(DEBUG_THREADS)) {
78  printf("Experiment Thread Started\n");
79  }
80 
81  {
83 
84  doc = QxrdExperimentPtr(
85  new QxrdExperiment(sharedFromThis(), m_ExperimentPath, m_Application));
86 
87  if (doc) {
88  doc -> initialize(m_Settings);
89 
90  m_Mutex.lock();
91  m_Experiment = doc;
92  m_Mutex.unlock();
93  }
94  }
95 
96  int rc = -1;
97 
98  rc = exec();
99 
100  {
101  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
102 
104  }
105 
106  if (qcepDebug(DEBUG_THREADS)) {
107  printf("Experiment Thread Terminated with rc %d\n", rc);
108  }
109 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdApplicationWPtr m_Application
QMutex m_Mutex
Definition: qcepthread.h:17
QxrdExperimentPtr m_Experiment

Here is the call graph for this function:

void QxrdExperimentThread::shutdown ( )
virtual

Implements QxrdThread.

Definition at line 111 of file qxrdexperimentthread.cpp.

Referenced by ~QxrdExperimentThread().

112 {
113 // INVOKE_CHECK(QMetaObject::invokeMethod(m_Experiment, "shutdown", Qt::QueuedConnection));
114  exit();
115 
116  wait();
117 }

Here is the caller graph for this function:

Member Data Documentation

QxrdApplicationWPtr QxrdExperimentThread::m_Application
private

Definition at line 37 of file qxrdexperimentthread.h.

Referenced by run(), and ~QxrdExperimentThread().

QxrdExperimentPtr QxrdExperimentThread::m_Experiment
private

Definition at line 40 of file qxrdexperimentthread.h.

Referenced by experiment(), and run().

QString QxrdExperimentThread::m_ExperimentPath
private

Definition at line 36 of file qxrdexperimentthread.h.

Referenced by run().

QxrdExperimentThreadWPtr QxrdExperimentThread::m_ExperimentThread
private

Definition at line 39 of file qxrdexperimentthread.h.

Referenced by init().

QSettings* QxrdExperimentThread::m_Settings
private

Definition at line 38 of file qxrdexperimentthread.h.

Referenced by run().


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