XDispatch 0.7.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
qdispatchqueue.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_QUEUE
00024 #define QDISPATCH_QUEUE
00025 
00026 #include <QtCore/qobject.h>
00027 
00028 #include "qdispatchglobal.h"
00029 #include "qblockrunnable.h"
00030 
00036 QT_BEGIN_HEADER
00037 QT_BEGIN_NAMESPACE
00038 
00039 class QTime;
00040 class QRunnable;
00041 class QIterationRunnable;
00042 
00043 QT_MODULE(Dispatch)
00044 
00045 
00056 class Q_DISPATCH_EXPORT QDispatchQueue : public QObject, public xdispatch::queue {
00057 
00058         Q_OBJECT
00059 
00060     public:
00061         QDispatchQueue(const QString& label);
00062         QDispatchQueue(const char*);
00063         QDispatchQueue(dispatch_queue_t);
00064         QDispatchQueue(const xdispatch::queue&);
00065         QDispatchQueue(const QDispatchQueue&);
00066         ~QDispatchQueue();
00067 
00072         void async(QRunnable*);
00073         using xdispatch::queue::async;
00084         void apply(QIterationRunnable*, int times);
00085         using xdispatch::queue::apply;
00092         void after(QRunnable*, const QTime& time);
00093         void after(QRunnable*, dispatch_time_t time);
00094         using xdispatch::queue::after;
00095   #if XDISPATCH_HAS_BLOCKS
00096 
00101         inline void after(dispatch_block_t b, const QTime& time) {
00102             after( new QBlockRunnable(b), time );
00103         }
00104   #endif
00105   #if XDISPATCH_HAS_FUNCTION
00106 
00111         inline void after(const xdispatch::lambda_function& b, const QTime& time) {
00112             after( new QLambdaRunnable(b), time );
00113         }
00114   #endif
00115 
00120         void sync(QRunnable*);
00121         using xdispatch::queue::sync;
00132         void setFinalizer(QRunnable*, const xdispatch::queue& = xdispatch::global_queue());
00133         void setFinalizer(xdispatch::operation*, const xdispatch::queue& = xdispatch::global_queue());
00134   #if XDISPATCH_HAS_BLOCKS
00135         inline void setFinalizer(dispatch_block_t b, const xdispatch::queue& q = xdispatch::global_queue()) {
00136             setFinalizer( new QBlockRunnable(b), q );
00137         }
00138   #endif
00139   #if XDISPATCH_HAS_FUNCTION
00140       inline void setFinalizer(const xdispatch::lambda_function& b, const xdispatch::queue& q = xdispatch::global_queue()) {
00141           setFinalizer( new QLambdaRunnable(b), q );
00142       }
00143   #endif
00144 
00150         void setTarget(const xdispatch::queue&);
00151 
00152         QDispatchQueue& operator=(const QDispatchQueue&);
00153 
00154     public slots:
00155         void suspend();
00156         void resume();
00157 
00158 };
00159 
00160 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue* q);
00161 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue& q);
00162 
00163 QT_END_NAMESPACE
00164 QT_END_HEADER
00165 
00168 #endif /* QDISPATCH_QUEUE */
 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.