XDispatch 0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
qiterationblockrunnable.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 QITERATIONBLOCKRUNNABLE_H_
00024 #define QITERATIONBLOCKRUNNABLE_H_
00025 
00026 #include "qiterationrunnable.h"
00027 
00028 #include "qdispatchglobal.h"
00029 
00035 #ifdef XDISPATCH_HAS_BLOCKS
00036 
00037 QT_BEGIN_HEADER
00038 QT_BEGIN_NAMESPACE
00039 
00040 QT_MODULE(Dispatch)
00041 
00042 
00049 class Q_DISPATCH_EXPORT QIterationBlockRunnable : public QIterationRunnable {
00050 
00051     public:
00059         QIterationBlockRunnable(dispatch_iteration_block_t b)
00060             : QIterationRunnable(), block(XDISPATCH_BLOCK_PERSIST(b)) {}
00061         QIterationBlockRunnable(const QIterationBlockRunnable& other)
00062             : QIterationRunnable(other), block(XDISPATCH_BLOCK_COPY(other.block)) {}
00063         virtual ~QIterationBlockRunnable() { XDISPATCH_BLOCK_DELETE(block); }
00064 
00065         virtual inline void run(size_t index){
00066             XDISPATCH_BLOCK_EXEC(block)(index);
00067         };
00068 
00069     private:
00070         dispatch_iteration_block_store block;
00071 
00072 };
00073 
00074 QT_END_NAMESPACE
00075 QT_END_HEADER
00076 
00077 #endif
00078 
00081 #endif /* QITERATIONBLOCKRUNNABLE_H_ */

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