ThreadWeaver
WeaverInterface.h
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 00003 This file declares the WeaverInterface class. 00004 00005 $ Author: Mirko Boehm $ 00006 $ Copyright: (C) 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: WeaverImpl.h 29 2005-08-14 19:04:30Z mirko $ 00027 */ 00028 00029 #ifndef WeaverInterface_H 00030 #define WeaverInterface_H 00031 00032 #include <QtCore/QObject> 00033 00034 #include <threadweaver/threadweaver_export.h> 00035 00036 namespace ThreadWeaver { 00037 00038 class Job; 00039 class State; 00040 class WeaverObserver; 00041 00061 class THREADWEAVER_EXPORT WeaverInterface : public QObject { 00062 Q_OBJECT 00063 00064 public: 00068 explicit WeaverInterface ( QObject* parent = 0 ); 00069 virtual ~WeaverInterface() {} 00071 virtual const State& state() const = 0; 00072 00074 virtual void setMaximumNumberOfThreads( int cap ) = 0; 00075 00077 virtual int maximumNumberOfThreads() const = 0; 00078 00080 virtual int currentNumberOfThreads () const = 0; 00081 00092 virtual void registerObserver ( WeaverObserver* ) = 0; 00101 virtual void enqueue ( Job* ) = 0; 00111 virtual bool dequeue ( Job* ) = 0; 00115 virtual void dequeue () = 0; 00126 virtual void finish () = 0; 00136 virtual void suspend () = 0; 00140 virtual void resume () = 0; 00143 virtual bool isEmpty () const = 0; 00147 virtual bool isIdle () const = 0; 00153 virtual int queueLength () const = 0; 00154 00160 virtual void requestAbort() = 0; 00161 00162 Q_SIGNALS: 00169 void finished (); 00170 00175 void suspended (); 00176 00182 void jobDone ( ThreadWeaver::Job* ); 00183 // FIXME (0.7) test if signal is emitted properly 00184 // FIXME (0.7) provide jobStarted and jobFailed signals 00185 // FIXME (0.7) or remove all these, and add them to WeaverObserver 00186 00188 void stateChanged ( ThreadWeaver::State* ); 00189 }; 00190 00191 } 00192 00193 #endif
KDE 4.6 API Reference