ThreadWeaver
DependencyPolicy.h
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 00003 This file implements the DependencyPolicy 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.cpp 20 2005-08-08 21:02:51Z mirko $ 00027 */ 00028 00029 #ifndef DEPENDENCYPOLICY_H 00030 #define DEPENDENCYPOLICY_H 00031 00032 template <typename T> class QList; 00033 00034 #include "QueuePolicy.h" 00035 00036 namespace ThreadWeaver { 00037 00049 class THREADWEAVER_EXPORT DependencyPolicy : public QueuePolicy 00050 { 00051 public: 00053 ~DependencyPolicy(); 00054 00060 void addDependency( Job* jobA, Job* jobB ); 00061 00076 bool removeDependency( Job* jobA, Job* jobB ); 00077 00085 void resolveDependencies ( Job* ); 00086 00088 QList<Job*> getDependencies( Job* ) const; 00089 00090 // FIXME add factory method for singleton creation 00091 static DependencyPolicy& instance(); 00092 00093 bool canRun( Job* ); 00094 00095 void free( Job* ); 00096 00097 void release( Job* ); 00098 00099 void destructed( Job* ); 00100 00101 protected: 00105 bool hasUnresolvedDependencies( Job* ) const; 00106 00107 DependencyPolicy(); 00108 00109 private: 00110 class Private; 00111 Private * const d; 00112 00113 public: 00115 void dumpJobDependencies(); 00116 }; 00117 00118 } 00119 00120 #endif
KDE 4.6 API Reference