XDispatch 0.7.0
 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 #ifdef 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 
00110         void sync(QRunnable*);
00111         using xdispatch::queue::sync;
00122         void setFinalizer(QRunnable*, const xdispatch::queue& = xdispatch::global_queue());
00123         void setFinalizer(xdispatch::operation*, const xdispatch::queue& = xdispatch::global_queue());
00124 #ifdef XDISPATCH_HAS_BLOCKS
00125         inline void setFinalizer(dispatch_block_t b, const xdispatch::queue& q = xdispatch::global_queue()) {
00126             setFinalizer( new QBlockRunnable(b), q );
00127         }
00128 #endif
00129 
00135         void setTarget(const xdispatch::queue&);
00136 
00137         QDispatchQueue& operator=(const QDispatchQueue&);
00138 
00139     public slots:
00140         void suspend();
00141         void resume();
00142 
00143 };
00144 
00145 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue* q);
00146 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue& q);
00147 
00148 QT_END_NAMESPACE
00149 QT_END_HEADER
00150 
00153 #endif /* QDISPATCH_QUEUE */

Generated on Tue Jun 12 2012 14:11:47 for XDispatch by Doxygen 1.8.0
© 2010-2012 MLBA (about | privacy) All Rights reserved.