QXRD  0.11.16
Public Member Functions | Properties | Private Attributes | List of all members
QcepImageQueue< T > Class Template Reference

#include <qcepimagequeue.h>

Inheritance diagram for QcepImageQueue< T >:
Inheritance graph
[legend]
Collaboration diagram for QcepImageQueue< T >:
Collaboration graph
[legend]

Public Member Functions

 QcepImageQueue (QString name)
 
 ~QcepImageQueue ()
 
QSharedPointer< T > dequeue ()
 
void enqueue (QSharedPointer< T > data)
 
int size () const
 
QSharedPointer< T > operator[] (int n)
 
void deallocate ()
 

Properties

int nRows
 
int nCols
 

Private Attributes

QMutex m_Lock
 
QQueue< QSharedPointer< T > > m_Queue
 
QString m_Name
 

Detailed Description

template<typename T>
class QcepImageQueue< T >

Definition at line 13 of file qcepimagequeue.h.

Constructor & Destructor Documentation

template<typename T >
QcepImageQueue< T >::QcepImageQueue ( QString  name)

Definition at line 7 of file qcepimagequeue.cpp.

References DEBUG_QUEUES, g_Application, HEXARG, QcepImageQueue< T >::m_Name, QcepImageQueue< T >::m_Queue, QcepApplication::printMessage(), and qcepDebug().

8  : m_NRows(QcepSettingsSaverPtr(), NULL, "nRows", 2048, "Number of Rows in Queued Images"),
9  m_NCols(QcepSettingsSaverPtr(), NULL, "nCols", 2048, "Number of Cols in Queued Images"),
10  m_Name(name)
11 {
13  g_Application->printMessage(tr("QcepImageQueue<T>::QcepImageQueue(%1) %2 begin [contains %3]")
14  .arg(m_Name).HEXARG(this).arg(m_Queue.size()));
15  }
16 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QQueue< QSharedPointer< T > > m_Queue
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
#define HEXARG(a)
Definition: qcepdebug.h:50
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application

Here is the call graph for this function:

template<typename T >
QcepImageQueue< T >::~QcepImageQueue ( )

Definition at line 19 of file qcepimagequeue.cpp.

References DEBUG_QUEUES, g_Application, HEXARG, QcepApplication::printMessage(), and qcepDebug().

20 {
22  g_Application->printMessage(tr("QcepImageQueue<T>::~QcepImageQueue(%1) %2 begin [contains %3]")
23  .arg(m_Name).HEXARG(this).arg(m_Queue.size()));
24  }
25 
26  deallocate();
27 
29  g_Application->printMessage(tr("QcepImageQueue<T>::~QcepImageQueue(%1) %2 end [contains %3]")
30  .arg(m_Name).HEXARG(this).arg(m_Queue.size()));
31  }
32 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QQueue< QSharedPointer< T > > m_Queue
#define HEXARG(a)
Definition: qcepdebug.h:50
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application

Here is the call graph for this function:

Member Function Documentation

template<typename T >
void QcepImageQueue< T >::deallocate ( )

Definition at line 35 of file qcepimagequeue.cpp.

References DEBUG_QUEUES, g_Application, HEXARG, QcepApplication::printMessage(), and qcepDebug().

36 {
37  QMutexLocker lock(&m_Lock);
38 
39  while (!m_Queue.isEmpty()) {
40  QSharedPointer<T> img = m_Queue.dequeue();
42  g_Application->printMessage(tr("Deallocate %1").HEXARG(img.data()));
43  }
44  }
45 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QQueue< QSharedPointer< T > > m_Queue
#define HEXARG(a)
Definition: qcepdebug.h:50
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application

Here is the call graph for this function:

template<typename T >
QSharedPointer< T > QcepImageQueue< T >::dequeue ( )

Definition at line 48 of file qcepimagequeue.cpp.

References DEBUG_QUEUES, g_Application, HEXARG, QcepApplication::printMessage(), and qcepDebug().

Referenced by QxrdDetector::acquireFrame().

49 {
50  QMutexLocker lock(&m_Lock);
51 
52  if (m_Queue.isEmpty()) {
54  g_Application->printMessage(tr("QcepImageQueue::dequeue() = NULL from %1").arg(m_Name));
55  }
56 
57  return QSharedPointer<T>(NULL);
58  } else {
59  QSharedPointer<T> res = m_Queue.dequeue();
60 
62  g_Application->printMessage(tr("QcepImageQueue::dequeue() = %1 from %2, leaving %3")
63  .HEXARG(res.data()).arg(m_Name).arg(m_Queue.size()));
64  }
65 
66  return res;
67  }
68 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QQueue< QSharedPointer< T > > m_Queue
#define HEXARG(a)
Definition: qcepdebug.h:50
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T>
void QcepImageQueue< T >::enqueue ( QSharedPointer< T >  data)

Definition at line 83 of file qcepimagequeue.cpp.

References DEBUG_QUEUES, g_Application, HEXARG, QcepApplication::printMessage(), and qcepDebug().

Referenced by QxrdDetector::enqueueAcquiredFrame().

84 {
85  QMutexLocker lock(&m_Lock);
86 
88  g_Application->printMessage(tr("QcepImageQueue::enqueue(%1) into %2, starting with %3")
89  .HEXARG(data.data()).arg(m_Name).arg(m_Queue.size()));
90  }
91 
92  if (data) {
93  m_Queue.enqueue(data);
94  }
95 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QQueue< QSharedPointer< T > > m_Queue
#define HEXARG(a)
Definition: qcepdebug.h:50
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
QSharedPointer< T > QcepImageQueue< T >::operator[] ( int  n)

Definition at line 71 of file qcepimagequeue.cpp.

72 {
73  QMutexLocker lock(&m_Lock);
74 
75  if (n < 0 || n >= m_Queue.size()) {
76  return QSharedPointer<T>(NULL);
77  } else {
78  return m_Queue[n];
79  }
80 }
QQueue< QSharedPointer< T > > m_Queue
template<typename T >
int QcepImageQueue< T >::size ( ) const

Definition at line 98 of file qcepimagequeue.cpp.

References DEBUG_QUEUES, g_Application, QcepApplication::printMessage(), and qcepDebug().

99 {
100  QMutexLocker lock(&m_Lock);
101 
103  g_Application->printMessage(tr("QcepImageQueue::size() = %1 for %2")
104  .arg(m_Queue.size()).arg(m_Name));
105  }
106 
107  return m_Queue.size();
108 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QQueue< QSharedPointer< T > > m_Queue
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
QcepApplication * g_Application

Here is the call graph for this function:

Member Data Documentation

template<typename T>
QMutex QcepImageQueue< T >::m_Lock
mutableprivate

Definition at line 34 of file qcepimagequeue.h.

template<typename T>
QString QcepImageQueue< T >::m_Name
private

Definition at line 36 of file qcepimagequeue.h.

Referenced by QcepImageQueue< T >::QcepImageQueue().

template<typename T>
QQueue< QSharedPointer<T> > QcepImageQueue< T >::m_Queue
private

Definition at line 35 of file qcepimagequeue.h.

Referenced by QcepImageQueue< T >::QcepImageQueue().

Property Documentation

template<typename T>
int QcepImageQueue< T >::nCols
readwrite

Definition at line 30 of file qcepimagequeue.h.

template<typename T>
int QcepImageQueue< T >::nRows
readwrite

Definition at line 27 of file qcepimagequeue.h.


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