Definition at line 148 of file qfutureinterface.h.
#include <qfutureinterface.h>

Public Member Functions |
|
| QFutureInterface (State initialState=NoState) | |
| QFutureInterface (const QFutureInterface &other) | |
| ~QFutureInterface () | |
| QFutureInterface & | operator= (const QFutureInterface &other) |
| QFuture< T > | future () |
| void | reportResult (const T *result, int index=-1) |
| void | reportResult (const T &result, int index=-1) |
| void | reportResults (const QVector< T > &results, int beginIndex=-1, int count=-1) |
| void | reportFinished (const T *result=0) |
| const T & | resultReference (int index) const |
| const T * | resultPointer (int index) const |
| QList< T > | results () |
Static Public Member Functions |
|
| static QFutureInterface | canceledResult () |
| QFutureInterface | ( | State | initialState =
NoState |
) | [inline] |
Definition at line 151 of file qfutureinterface.h.
: QFutureInterfaceBase(initialState)
{ }
| QFutureInterface | ( | const QFutureInterface< T > & | other | ) | [inline] |
Definition at line 154 of file qfutureinterface.h.
: QFutureInterfaceBase(other)
{ }
| ~QFutureInterface | ( | ) | [inline] |
Definition at line 157 of file qfutureinterface.h.
{
if (referenceCountIsOne())
resultStore().clear();
}
| static QFutureInterface canceledResult | ( | ) | [inline, static] |
Definition at line 163 of file qfutureinterface.h.
{ return QFutureInterface(State(Started | Finished | Canceled)); }
| QFutureInterface& operator= | ( | const QFutureInterface< T > & | other | ) | [inline] |
Definition at line 166 of file qfutureinterface.h.
{
if (referenceCountIsOne())
resultStore().clear();
QFutureInterfaceBase::operator=(other);
return *this;
}
| QFuture< T > future | ( | ) | [inline] |
| void reportResult | ( | const T * | result, |
| int | index = -1 |
||
| ) | [inline] |
Definition at line 192 of file qfutureinterface.h.
{
QMutexLocker locker(mutex());
if (this->queryState(Canceled) || this->queryState(Finished)) {
return;
}
QtConcurrent::ResultStore<T> &store = resultStore();
if (store.filterMode()) {
const int resultCountBefore = store.count();
store.addResult(index, result);
this->reportResultsReady(resultCountBefore, resultCountBefore + store.count());
} else {
const int insertIndex = store.addResult(index, result);
this->reportResultsReady(insertIndex, insertIndex + 1);
}
}
| void reportResult | ( | const T & | result, |
| int | index = -1 |
||
| ) | [inline] |
Definition at line 213 of file qfutureinterface.h.
{
reportResult(&result, index);
}
| void reportResults | ( | const QVector< T > & | results, |
| int | beginIndex = -1, |
||
| int | count = -1 |
||
| ) | [inline] |
Definition at line 219 of file qfutureinterface.h.
{
QMutexLocker locker(mutex());
if (this->queryState(Canceled) || this->queryState(Finished)) {
return;
}
QtConcurrent::ResultStore<T> &store = resultStore();
if (store.filterMode()) {
const int resultCountBefore = store.count();
store.addResults(beginIndex, &_results, count);
this->reportResultsReady(resultCountBefore, store.count());
} else {
const int insertIndex = store.addResults(beginIndex, &_results, count);
this->reportResultsReady(insertIndex, insertIndex + _results.count());
}
}
| void reportFinished | ( | const T * | result = 0 |
) | [inline] |
Definition at line 239 of file qfutureinterface.h.
{
if (result)
reportResult(result);
QFutureInterfaceBase::reportFinished();
}
| const T & resultReference | ( | int | index | ) | const [inline] |
Definition at line 247 of file qfutureinterface.h.
{
QMutexLocker lock(mutex());
return resultStore().resultAt(index).value();
}
| const T * resultPointer | ( | int | index | ) | const [inline] |
Definition at line 254 of file qfutureinterface.h.
{
QMutexLocker lock(mutex());
return resultStore().resultAt(index).pointer();
}
| QList< T > results | ( | ) | [inline] |
Definition at line 261 of file qfutureinterface.h.
{
if (this->isCanceled()) {
exceptionStore().throwPossibleException();
return QList<T>();
}
QFutureInterfaceBase::waitForResult(-1);
QList<T> res;
QMutexLocker lock(mutex());
QtConcurrent::ResultIterator<T> it = resultStore().begin();
while (it != resultStore().end()) {
res.append(it.value());
++it;
}
return res;
}