SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Signals | Public Member Functions | Private Attributes | List of all members
RemoteDataQueue Class Reference

#include <remotedataqueue.h>

Inherits QObject.

Signals

void dataBlockEnqueued ()
 

Public Member Functions

 RemoteDataQueue (QObject *parent=NULL)
 
 ~RemoteDataQueue ()
 
void push (RemoteDataBlock *dataBlock, bool emitSignal=true)
 Push daa block onto queue. More...
 
RemoteDataBlockpop ()
 Pop message from queue. More...
 
int size ()
 Returns queue size. More...
 
void clear ()
 Empty queue. More...
 

Private Attributes

QMutex m_lock
 
QQueue< RemoteDataBlock * > m_queue
 

Detailed Description

Definition at line 36 of file remotedataqueue.h.

Constructor & Destructor Documentation

◆ RemoteDataQueue()

RemoteDataQueue::RemoteDataQueue ( QObject *  parent = NULL)

Definition at line 30 of file remotedataqueue.cpp.

30  :
31  QObject(parent),
32  m_lock(QMutex::Recursive),
33  m_queue()
34 {
35 }
QQueue< RemoteDataBlock * > m_queue

◆ ~RemoteDataQueue()

RemoteDataQueue::~RemoteDataQueue ( )

Definition at line 37 of file remotedataqueue.cpp.

References pop().

38 {
39  RemoteDataBlock* data;
40 
41  while ((data = pop()) != 0)
42  {
43  qDebug() << "RemoteDataQueue::~RemoteDataQueue: data block was still in queue";
44  delete data;
45  }
46 }
RemoteDataBlock * pop()
Pop message from queue.
+ Here is the call graph for this function:

Member Function Documentation

◆ clear()

void RemoteDataQueue::clear ( )

Empty queue.

Definition at line 84 of file remotedataqueue.cpp.

References m_lock, and m_queue.

85 {
86  QMutexLocker locker(&m_lock);
87  m_queue.clear();
88 }
QQueue< RemoteDataBlock * > m_queue

◆ dataBlockEnqueued

void RemoteDataQueue::dataBlockEnqueued ( )
signal

Referenced by push().

+ Here is the caller graph for this function:

◆ pop()

RemoteDataBlock * RemoteDataQueue::pop ( )

Pop message from queue.

Definition at line 63 of file remotedataqueue.cpp.

References m_lock, and m_queue.

Referenced by RemoteSource::handleData(), and ~RemoteDataQueue().

64 {
65  QMutexLocker locker(&m_lock);
66 
67  if (m_queue.isEmpty())
68  {
69  return 0;
70  }
71  else
72  {
73  return m_queue.takeFirst();
74  }
75 }
QQueue< RemoteDataBlock * > m_queue
+ Here is the caller graph for this function:

◆ push()

void RemoteDataQueue::push ( RemoteDataBlock dataBlock,
bool  emitSignal = true 
)

Push daa block onto queue.

Definition at line 48 of file remotedataqueue.cpp.

References dataBlockEnqueued(), m_lock, and m_queue.

Referenced by RemoteSourceThread::readPendingDatagrams().

49 {
50  if (data)
51  {
52  m_lock.lock();
53  m_queue.append(data);
54  m_lock.unlock();
55  }
56 
57  if (emitSignal)
58  {
59  emit dataBlockEnqueued();
60  }
61 }
QQueue< RemoteDataBlock * > m_queue
void dataBlockEnqueued()
+ Here is the caller graph for this function:

◆ size()

int RemoteDataQueue::size ( )

Returns queue size.

Definition at line 77 of file remotedataqueue.cpp.

References m_lock, and m_queue.

78 {
79  QMutexLocker locker(&m_lock);
80 
81  return m_queue.size();
82 }
QQueue< RemoteDataBlock * > m_queue

Member Data Documentation

◆ m_lock

QMutex RemoteDataQueue::m_lock
private

Definition at line 53 of file remotedataqueue.h.

Referenced by clear(), pop(), push(), and size().

◆ m_queue

QQueue<RemoteDataBlock*> RemoteDataQueue::m_queue
private

Definition at line 54 of file remotedataqueue.h.

Referenced by clear(), pop(), push(), and size().


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