Public Member Functions

QueryQueue Class Reference

QueryQueue is used by QueryWorker to extract the QueryThreadCommand and query with it the database. More...

#include <querythread.h>

Collaboration diagram for QueryQueue:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void enqueue (const QueryThreadCommand &cmd)
QueryThreadCommand dequeue ()
bool contains (const QueryThreadCommand &cmd) const

Detailed Description

QueryQueue is used by QueryWorker to extract the QueryThreadCommand and query with it the database.

There are two prereqisites for the Queue: there should be only one command from a particular sender, and it should follow FIFO principle. Two Qt classes come into mind: QQueue and QSet: for QQueue, a filter should be implemented, for QSet, it doesn't support FIFO so it can hardly be used.

For impl: see http://doc.trolltech.com/qq/qq22-monitors2.html


Member Function Documentation

bool QueryQueue::contains ( const QueryThreadCommand cmd  )  const

Referenced by Database::execPending().

{
    return queue.contains(cmd);
}

QueryThreadCommand QueryQueue::dequeue (  ) 

Referenced by QueryWorker::slotExecute().

{
    QMutexLocker lock(&mutex);
    if (queue.isEmpty()) return QueryThreadCommand();
    return queue.dequeue();
}

void QueryQueue::enqueue ( const QueryThreadCommand cmd  ) 

Referenced by Database::execThreaded().

{
    QMutexLocker lock(&mutex);
    filter(cmd);
    queue.enqueue(cmd);
}


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