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

#include <qxrdscriptenginethread.h>

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

Public Member Functions

 QxrdScriptEngineThread (QxrdApplicationWPtr app, QxrdExperimentWPtr exp)
 
 ~QxrdScriptEngineThread ()
 
void shutdown ()
 
QxrdScriptEnginePtr scriptEngine () 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

QxrdScriptEnginePtr m_ScriptEngine
 
QxrdApplicationWPtr m_Application
 
QxrdExperimentWPtr m_Experiment
 

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 qxrdscriptenginethread.h.

Constructor & Destructor Documentation

QxrdScriptEngineThread::QxrdScriptEngineThread ( QxrdApplicationWPtr  app,
QxrdExperimentWPtr  exp 
)

Definition at line 10 of file qxrdscriptenginethread.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

11  : QxrdThread(NULL),
12  m_ScriptEngine(NULL),
13  m_Application(app),
14  m_Experiment(exp)
15 {
17  printf("QxrdScriptEngineThread::QxrdScriptEngineThread(%p)\n", this);
18  }
19 
20  setObjectName("script");
21 }
QxrdApplicationWPtr m_Application
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdScriptEnginePtr m_ScriptEngine
QxrdThread(QObject *parent=0)
Definition: qxrdthread.cpp:3
QxrdExperimentWPtr m_Experiment

Here is the call graph for this function:

QxrdScriptEngineThread::~QxrdScriptEngineThread ( )

Definition at line 23 of file qxrdscriptenginethread.cpp.

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

24 {
25  shutdown();
26 
28  printf("QxrdScriptEngineThread::~QxrdScriptEngineThread(%p)\n", this);
29  }
30 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

void QxrdScriptEngineThread::run ( )
protected

Definition at line 54 of file qxrdscriptenginethread.cpp.

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

55 {
56  if (qcepDebug(DEBUG_THREADS)) {
57  printf("Script Engine Thread Started\n");
58  }
59 
61 
62  int rc = -1;
63 
64  if (p) {
65  p -> initialize();
66 
67  m_Mutex.lock();
68  m_ScriptEngine = p;
69  m_Mutex.unlock();
70 
71  rc = exec();
72  }
73 
74  {
75  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
76 
78  }
79 
80  if (qcepDebug(DEBUG_THREADS)) {
81  printf("Script Engine Thread Terminated with rc %d\n", rc);
82  }
83 }
QxrdApplicationWPtr m_Application
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QSharedPointer< QxrdScriptEngine > QxrdScriptEnginePtr
QxrdScriptEnginePtr m_ScriptEngine
QMutex m_Mutex
Definition: qcepthread.h:17
QxrdExperimentWPtr m_Experiment

Here is the call graph for this function:

QxrdScriptEnginePtr QxrdScriptEngineThread::scriptEngine ( ) const

Definition at line 39 of file qxrdscriptenginethread.cpp.

References QcepThread::m_Mutex, and m_ScriptEngine.

40 {
41  while (isRunning()) {
42  {
43  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
44 
45  if (m_ScriptEngine) return m_ScriptEngine;
46  }
47 
48  QThread::msleep(50);
49  }
50 
51  return QxrdScriptEnginePtr();
52 }
QSharedPointer< QxrdScriptEngine > QxrdScriptEnginePtr
QxrdScriptEnginePtr m_ScriptEngine
QMutex m_Mutex
Definition: qcepthread.h:17
void QxrdScriptEngineThread::shutdown ( )
virtual

Implements QxrdThread.

Definition at line 32 of file qxrdscriptenginethread.cpp.

Referenced by ~QxrdScriptEngineThread().

33 {
34  exit();
35 
36  wait(1000);
37 }

Here is the caller graph for this function:

Member Data Documentation

QxrdApplicationWPtr QxrdScriptEngineThread::m_Application
private

Definition at line 26 of file qxrdscriptenginethread.h.

Referenced by run().

QxrdExperimentWPtr QxrdScriptEngineThread::m_Experiment
private

Definition at line 27 of file qxrdscriptenginethread.h.

Referenced by run().

QxrdScriptEnginePtr QxrdScriptEngineThread::m_ScriptEngine
private

Definition at line 25 of file qxrdscriptenginethread.h.

Referenced by run(), and scriptEngine().


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