ThreadWeaver
JobCollection.h
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 00003 This file declares the JobCollection class. 00004 00005 $ Author: Mirko Boehm $ 00006 $ Copyright: (C) 2004, 2005, 2006 Mirko Boehm $ 00007 $ Contact: mirko@kde.org 00008 http://www.kde.org 00009 http://www.hackerbuero.org $ 00010 00011 This library is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU Library General Public 00013 License as published by the Free Software Foundation; either 00014 version 2 of the License, or (at your option) any later version. 00015 00016 This library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Library General Public License for more details. 00020 00021 You should have received a copy of the GNU Library General Public License 00022 along with this library; see the file COPYING.LIB. If not, write to 00023 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00024 Boston, MA 02110-1301, USA. 00025 00026 $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $ 00027 */ 00028 00029 #ifndef JOBCOLLECTION_H 00030 #define JOBCOLLECTION_H 00031 00032 #include "Job.h" 00033 00034 namespace ThreadWeaver { 00035 00036 class Thread; 00037 class JobCollectionJobRunner; 00038 00049 class THREADWEAVER_EXPORT JobCollection : public Job 00050 { 00051 friend class JobCollectionJobRunner; 00052 Q_OBJECT 00053 00054 public: 00055 explicit JobCollection ( QObject *parent = 0 ); 00056 ~JobCollection (); 00063 virtual void addJob ( Job* ); 00064 00066 bool canBeExecuted(); 00067 00068 public Q_SLOTS: 00072 void stop ( ThreadWeaver::Job *job ); 00073 00074 protected: 00076 void aboutToBeQueued ( WeaverInterface *weaver ); 00077 00079 void aboutToBeDequeued ( WeaverInterface *weaver ); 00080 00082 Job* jobAt( int i ); 00083 00084 #ifdef __GNUC__ 00085 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 1) 00086 #pragma GCC diagnostic ignored "-Wignored-qualifiers" 00087 #endif 00088 #endif 00089 00090 const int jobListLength(); // const qualifier is possibly BiC? 00091 00094 virtual void internalJobDone( Job* ); 00095 00101 void finalCleanup(); 00102 00103 private Q_SLOTS: 00104 // called when an internal job runner emits its done(Job*) signal. 00105 // JobCollection emits done(Job*) after the last JobCollectionJobRunner finishes 00106 void jobRunnerDone(); 00107 00108 private: 00110 void execute ( Thread * ); 00111 00114 void run() {} 00115 00119 void dequeueElements(); 00120 00121 class Private; 00122 Private * const d; 00123 00124 }; 00125 00126 } 00127 00128 #endif
KDE 4.6 API Reference