XDispatch 0.7.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
qdispatchgroup.h
Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2011-2012 MLBA-Team. All rights reserved.
00003 *
00004 * @MLBA_OPEN_LICENSE_HEADER_START@
00005 *
00006 * Licensed under the Apache License, Version 2.0 (the "License");
00007 * you may not use this file except in compliance with the License.
00008 * You may obtain a copy of the License at
00009 * 
00010 *     http://www.apache.org/licenses/LICENSE-2.0
00011 * 
00012 * Unless required by applicable law or agreed to in writing, software
00013 * distributed under the License is distributed on an "AS IS" BASIS,
00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 * See the License for the specific language governing permissions and
00016 * limitations under the License.
00017 *
00018 * @MLBA_OPEN_LICENSE_HEADER_END@
00019 */
00020 
00021 
00022 
00023 #ifndef QDISPATCH_GROUP_H_
00024 #define QDISPATCH_GROUP_H_
00025 
00026 #include <QtCore/qobject.h>
00027 #include <QtCore/qscopedpointer.h>
00028 
00029 #include "qdispatchglobal.h"
00030 #include "qblockrunnable.h"
00031 
00037 QT_BEGIN_HEADER
00038 QT_BEGIN_NAMESPACE
00039 
00040 class QRunnable;
00041 class QDispatchQueue;
00042 class QTime;
00043 
00044 QT_MODULE(Dispatch)
00045 
00046 
00056 class Q_DISPATCH_EXPORT QDispatchGroup : public QObject, public xdispatch::group {
00057 
00058         Q_OBJECT
00059 
00060     public:
00064         QDispatchGroup();
00065         QDispatchGroup(dispatch_group_t);
00066         QDispatchGroup(const QDispatchGroup&);
00067         QDispatchGroup(const xdispatch::group&);
00068         ~QDispatchGroup();
00069 
00075         void async(QRunnable* r, const xdispatch::queue& q = xdispatch::global_queue());
00076         using xdispatch::group::async;
00083         bool wait(const QTime& t);
00084         using xdispatch::group::wait;
00097         void notify(QRunnable* r, const xdispatch::queue& = xdispatch::global_queue());
00101         void notify(xdispatch::operation*, const xdispatch::queue& = xdispatch::global_queue());
00102   #if XDISPATCH_HAS_BLOCKS
00103 
00106         inline void notify(dispatch_block_t b, const xdispatch::queue& q = xdispatch::global_queue()) {
00107             notify( new QBlockRunnable(b), q );
00108         }
00109   #endif
00110   #if XDISPATCH_HAS_FUNCTION
00111 
00114         inline void notify(const xdispatch::lambda_function& b, const xdispatch::queue& q = xdispatch::global_queue()) {
00115             notify( new QLambdaRunnable(b), q );
00116         }
00117   #endif
00118 
00132         void enableAllFinishedSignal();
00133 
00134     public slots:
00135         void resume();
00136         void suspend();
00137 
00138     signals:
00148         void allFinished();
00149 
00150     private:
00151 
00152         class Emitter;
00153         friend class Emitter;
00154         friend Q_DECL_EXPORT QDebug operator<<(QDebug, const QDispatchGroup&);
00155 
00156         class Private;
00157         QScopedPointer<Private> d;
00158 };
00159 
00160 Q_DECL_EXPORT QDebug operator<<(QDebug, const QDispatchGroup&);
00161 
00162 QT_END_NAMESPACE
00163 QT_END_HEADER
00164 
00167 #endif /* QDISPATCH_GROUP_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Oct 28 2012 22:12:47 for XDispatch by Doxygen 1.7.6.1
© 2010-2012 MLBA (about | privacy) All Rights reserved.