Move QtConcurrent::ResultStore as QtPrivate::ResultStore to QtCore

No compatibility header needed. While this wasn't marked as private API,
it wasn't documented, either.

This is a prerequisite for moving QFuture to QtCore.

Change-Id: I8e986e6e2a22fbe5cf08d0600ec39ae9ae993e20
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2012-08-27 17:23:33 +02:00 committed by The Qt Project
parent 3a29976eac
commit a65a98399b
12 changed files with 62 additions and 64 deletions

View File

@ -18,7 +18,6 @@ SOURCES += \
qfuturewatcher.cpp \
qtconcurrentfilter.cpp \
qtconcurrentmap.cpp \
qtconcurrentresultstore.cpp \
qtconcurrentthreadengine.cpp \
qtconcurrentiteratekernel.cpp \
@ -38,7 +37,6 @@ HEADERS += \
qtconcurrentmapkernel.h \
qtconcurrentmedian.h \
qtconcurrentreducekernel.h \
qtconcurrentresultstore.h \
qtconcurrentrun.h \
qtconcurrentrunbase.h \
qtconcurrentstoredfunctioncall.h \

View File

@ -395,12 +395,12 @@ QtPrivate::ExceptionStore &QFutureInterfaceBase::exceptionStore()
return d->m_exceptionStore;
}
QtConcurrent::ResultStoreBase &QFutureInterfaceBase::resultStoreBase()
QtPrivate::ResultStoreBase &QFutureInterfaceBase::resultStoreBase()
{
return d->m_results;
}
const QtConcurrent::ResultStoreBase &QFutureInterfaceBase::resultStoreBase() const
const QtPrivate::ResultStoreBase &QFutureInterfaceBase::resultStoreBase() const
{
return d->m_results;
}
@ -522,7 +522,7 @@ void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface
m_progressText));
}
QtConcurrent::ResultIteratorBase it = m_results.begin();
QtPrivate::ResultIteratorBase it = m_results.begin();
while (it != m_results.end()) {
const int begin = it.resultIndex();
const int end = begin + it.batchSize();

View File

@ -50,7 +50,7 @@
#include <QtCore/qmutex.h>
#include <QtCore/qexception.h>
#include <QtConcurrent/qtconcurrentresultstore.h>
#include <QtCore/qresultstore.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@ -123,8 +123,8 @@ public:
QMutex *mutex() const;
QtPrivate::ExceptionStore &exceptionStore();
QtConcurrent::ResultStoreBase &resultStoreBase();
const QtConcurrent::ResultStoreBase &resultStoreBase() const;
QtPrivate::ResultStoreBase &resultStoreBase();
const QtPrivate::ResultStoreBase &resultStoreBase() const;
inline bool operator==(const QFutureInterfaceBase &other) const { return d == other.d; }
inline bool operator!=(const QFutureInterfaceBase &other) const { return d != other.d; }
@ -182,10 +182,10 @@ public:
inline const T *resultPointer(int index) const;
inline QList<T> results();
private:
QtConcurrent::ResultStore<T> &resultStore()
{ return static_cast<QtConcurrent::ResultStore<T> &>(resultStoreBase()); }
const QtConcurrent::ResultStore<T> &resultStore() const
{ return static_cast<const QtConcurrent::ResultStore<T> &>(resultStoreBase()); }
QtPrivate::ResultStore<T> &resultStore()
{ return static_cast<QtPrivate::ResultStore<T> &>(resultStoreBase()); }
const QtPrivate::ResultStore<T> &resultStore() const
{ return static_cast<const QtPrivate::ResultStore<T> &>(resultStoreBase()); }
};
template <typename T>
@ -196,7 +196,7 @@ inline void QFutureInterface<T>::reportResult(const T *result, int index)
return;
}
QtConcurrent::ResultStore<T> &store = resultStore();
QtPrivate::ResultStore<T> &store = resultStore();
if (store.filterMode()) {
@ -223,7 +223,7 @@ inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int b
return;
}
QtConcurrent::ResultStore<T> &store = resultStore();
QtPrivate::ResultStore<T> &store = resultStore();
if (store.filterMode()) {
const int resultCountBefore = store.count();
@ -269,7 +269,7 @@ inline QList<T> QFutureInterface<T>::results()
QList<T> res;
QMutexLocker lock(mutex());
QtConcurrent::ResultIterator<T> it = resultStore().begin();
QtPrivate::ResultIterator<T> it = resultStore().begin();
while (it != resultStore().end()) {
res.append(it.value());
++it;

View File

@ -142,7 +142,7 @@ public:
QElapsedTimer progressTime;
QWaitCondition pausedWaitCondition;
int pendingResults;
QtConcurrent::ResultStoreBase m_results;
QtPrivate::ResultStoreBase m_results;
bool manualProgress;
int m_expectedResultCount;
QtPrivate::ExceptionStore m_exceptionStore;

View File

@ -39,13 +39,13 @@
**
****************************************************************************/
#include "qtconcurrentresultstore.h"
#include "qresultstore.h"
#ifndef QT_NO_QFUTURE
QT_BEGIN_NAMESPACE
namespace QtConcurrent {
namespace QtPrivate {
ResultIteratorBase::ResultIteratorBase()
: mapIterator(QMap<int, ResultItem>::const_iterator()), m_vectorIndex(0) { }
@ -249,8 +249,8 @@ int ResultStoreBase::updateInsertIndex(int index, int _count)
return index;
}
} // namespace QtConcurrent
} // namespace QtPrivate
QT_END_NAMESPACE
#endif // QT_NO_CONCURRENT
#endif // QT_NO_QFUTURE

View File

@ -39,10 +39,10 @@
**
****************************************************************************/
#ifndef QTCONCURRENT_RESULTSTORE_H
#define QTCONCURRENT_RESULTSTORE_H
#ifndef QTCORE_RESULTSTORE_H
#define QTCORE_RESULTSTORE_H
#include <QtConcurrent/qtconcurrent_global.h>
#include <QtCore/qglobal.h>
#ifndef QT_NO_QFUTURE
@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
#ifndef qdoc
namespace QtConcurrent {
namespace QtPrivate {
class ResultItem
{
@ -78,7 +78,7 @@ public:
const void *result; // if count is 0 it's a result, otherwise it's a vector.
};
class Q_CONCURRENT_EXPORT ResultIteratorBase
class Q_CORE_EXPORT ResultIteratorBase
{
public:
ResultIteratorBase();
@ -119,7 +119,7 @@ public:
}
};
class Q_CONCURRENT_EXPORT ResultStoreBase
class Q_CORE_EXPORT ResultStoreBase
{
public:
ResultStoreBase();
@ -226,13 +226,13 @@ public:
};
} // namespace QtConcurrent
} // namespace QtPrivate
#endif //qdoc
QT_END_NAMESPACE
QT_END_HEADER
#endif // QT_NO_CONCURRENT
#endif // QT_NO_QFUTURE
#endif

View File

@ -11,6 +11,7 @@ HEADERS += thread/qmutex.h \
thread/qwaitcondition.h \
thread/qatomic.h \
thread/qexception.h \
thread/qresultstore.h \
thread/qbasicatomic.h \
thread/qgenericatomic.h \
thread/qoldbasicatomic.h
@ -25,6 +26,7 @@ HEADERS += thread/qmutex_p.h \
SOURCES += thread/qatomic.cpp \
thread/qexception.cpp \
thread/qresultstore.cpp \
thread/qmutex.cpp \
thread/qreadwritelock.cpp \
thread/qrunnable.cpp \

View File

@ -6,7 +6,6 @@ SUBDIRS=\
qtconcurrentfilter \
qtconcurrentiteratekernel \
qtconcurrentmap \
qtconcurrentresultstore \
qtconcurrentrun \
qtconcurrentthreadengine

View File

@ -46,12 +46,10 @@
#include <QtTest/QtTest>
#include <qfuture.h>
#include <qfuturewatcher.h>
#include <qtconcurrentresultstore.h>
#include <qtconcurrentexception.h>
#include <qresultstore.h>
#include <qexception.h>
#include <private/qfutureinterface_p.h>
using namespace QtConcurrent;
// COM interface macro.
#if defined(Q_OS_WIN) && defined(interface)
# undef interface
@ -91,7 +89,7 @@ void tst_QFuture::resultStore()
int int2 = 2;
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
QVERIFY(store.begin() == store.end());
QVERIFY(store.resultAt(0) == store.end());
QVERIFY(store.resultAt(1) == store.end());
@ -99,10 +97,10 @@ void tst_QFuture::resultStore()
{
ResultStoreBase store;
QtPrivate::ResultStoreBase store;
store.addResult(-1, &int0); // note to self: adding a pointer to the stack here is ok since
store.addResult(1, &int1); // ResultStoreBase does not take ownership, only ResultStore<> does.
ResultIteratorBase it = store.begin();
QtPrivate::ResultIteratorBase it = store.begin();
QCOMPARE(it.resultIndex(), 0);
QVERIFY(it == store.begin());
QVERIFY(it != store.end());
@ -121,10 +119,10 @@ void tst_QFuture::resultStore()
QVector<int> vec1 = QVector<int>() << 4 << 5;
{
ResultStoreBase store;
QtPrivate::ResultStoreBase store;
store.addResults(-1, &vec0, 2, 2);
store.addResults(-1, &vec1, 2, 2);
ResultIteratorBase it = store.begin();
QtPrivate::ResultIteratorBase it = store.begin();
QCOMPARE(it.resultIndex(), 0);
QVERIFY(it == store.begin());
QVERIFY(it != store.end());
@ -144,12 +142,12 @@ void tst_QFuture::resultStore()
QVERIFY(it == store.end());
}
{
ResultStoreBase store;
QtPrivate::ResultStoreBase store;
store.addResult(-1, &int0);
store.addResults(-1, &vec1, 2, 2);
store.addResult(-1, &int1);
ResultIteratorBase it = store.begin();
QtPrivate::ResultIteratorBase it = store.begin();
QCOMPARE(it.resultIndex(), 0);
QVERIFY(it == store.begin());
QVERIFY(it != store.end());
@ -175,12 +173,12 @@ void tst_QFuture::resultStore()
QCOMPARE(store.resultAt(4), store.end());
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResult(-1, &int0);
store.addResults(-1, &vec0);
store.addResult(-1, &int1);
ResultIteratorBase it = store.begin();
QtPrivate::ResultIteratorBase it = store.begin();
QCOMPARE(it.resultIndex(), 0);
QVERIFY(it == store.begin());
QVERIFY(it != store.end());
@ -205,7 +203,7 @@ void tst_QFuture::resultStore()
QCOMPARE(store.resultAt(3).value(), int1);
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResult(-1, &int0);
store.addResults(-1, &vec0);
store.addResult(200, &int1);
@ -217,7 +215,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResult(1, &int1);
store.addResult(0, &int0);
store.addResult(-1, &int2);
@ -228,7 +226,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
QCOMPARE(store.contains(0), false);
QCOMPARE(store.contains(1), false);
QCOMPARE(store.contains(INT_MAX), false);
@ -236,7 +234,7 @@ void tst_QFuture::resultStore()
{
// Test filter mode, where "gaps" in the result array aren't allowed.
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addResult(0, &int0);
@ -270,7 +268,7 @@ void tst_QFuture::resultStore()
{
// test canceled results
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addResult(0, &int0);
@ -307,7 +305,7 @@ void tst_QFuture::resultStore()
{
// test addResult return value
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addResult(0, &int0);
@ -353,7 +351,7 @@ void tst_QFuture::resultStore()
{
// test resultCount in non-filtered mode. It should always be possible
// to iterate through the results 0 to resultCount.
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResult(0, &int0);
QCOMPARE(store.count(), 1);
@ -367,7 +365,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResult(2, &int0);
QCOMPARE(store.count(), 0);
@ -379,7 +377,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResults(2, &vec1);
QCOMPARE(store.count(), 0);
@ -391,7 +389,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResults(2, &vec1);
QCOMPARE(store.count(), 0);
@ -399,7 +397,7 @@ void tst_QFuture::resultStore()
QCOMPARE(store.count(), 4);
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResults(3, &vec1);
QCOMPARE(store.count(), 0);
@ -411,7 +409,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addResults(3, &vec1);
QCOMPARE(store.count(), 0);
@ -424,7 +422,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addResults(3, &vec1);
QCOMPARE(store.count(), 0);
@ -434,7 +432,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addResults(3, &vec1);
QCOMPARE(store.count(), 0);
@ -447,7 +445,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.addResult(1, &int0);
store.addResult(3, &int0);
store.addResults(6, &vec0);
@ -462,7 +460,7 @@ void tst_QFuture::resultStore()
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addResult(1, &int0);
store.addResult(3, &int0);
@ -490,7 +488,7 @@ void tst_QFuture::resultStore()
QCOMPARE(store.contains(7), false);
}
{
ResultStore<int> store;
QtPrivate::ResultStore<int> store;
store.setFilterMode(true);
store.addCanceledResult(0);
QCOMPARE(store.contains(0), false);

View File

@ -1,6 +1,6 @@
CONFIG += testcase parallel_test
TARGET = tst_qtconcurrentresultstore
TARGET = tst_qresultstore
QT = core-private testlib concurrent
SOURCES = tst_qtconcurrentresultstore.cpp
SOURCES = tst_qresultstore.cpp
DEFINES += QT_STRICT_ITERATORS
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -41,9 +41,9 @@
#include <QtTest/QtTest>
#include <qtconcurrentresultstore.h>
#include <qresultstore.h>
using namespace QtConcurrent;
using namespace QtPrivate;
class tst_QtConcurrentResultStore : public QObject
{
@ -487,4 +487,4 @@ void tst_QtConcurrentResultStore::count()
}
QTEST_MAIN(tst_QtConcurrentResultStore)
#include "tst_qtconcurrentresultstore.moc"
#include "tst_qresultstore.moc"

View File

@ -2,6 +2,7 @@ TEMPLATE=subdirs
SUBDIRS=\
qatomicint \
qatomicpointer \
qresultstore \
qmutex \
qmutexlocker \
qreadlocker \