ThreadWeaver
JobSequence.cpp
Go to the documentation of this file.00001 /* -*- C++ -*- 00002 00003 This file implements the JobSequence 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 #include "JobSequence.h" 00030 #include "WeaverInterface.h" 00031 #include "DebuggingAids.h" 00032 #include "DependencyPolicy.h" 00033 00034 using namespace ThreadWeaver; 00035 00036 JobSequence::JobSequence ( QObject *parent ) 00037 : JobCollection ( parent ), d ( 0 ) 00038 { 00039 } 00040 00041 void JobSequence::aboutToBeQueued ( WeaverInterface *weaver ) 00042 { 00043 REQUIRE (weaver != 0); 00044 00045 if ( jobListLength() > 1 ) 00046 { 00047 // set up the dependencies: 00048 for ( int i = 1; i < jobListLength(); ++i ) 00049 { 00050 Job* jobA = jobAt(i); 00051 Job* jobB = jobAt(i-1); 00052 P_ASSERT ( jobA != 0 ); 00053 P_ASSERT ( jobB != 0 ); 00054 DependencyPolicy::instance().addDependency ( jobA, jobB ); 00055 } 00056 } 00057 00058 JobCollection::aboutToBeQueued( weaver ); 00059 } 00060 00061 void JobSequence::internalJobDone( Job* job) 00062 { 00063 REQUIRE ( job != 0 ); 00064 00065 if ( !job->success() ) 00066 { 00067 stop( job ); 00068 } 00069 00070 JobCollection::internalJobDone(job); 00071 } 00072 00073 #include "JobSequence.moc"