Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
OpenFlipperThread.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50
51 #ifndef OPENFLIPPERTHREAD_HH
52 #define OPENFLIPPERTHREAD_HH
53
54 #include <QThread>
55 #include <QSemaphore>
56
57 #include <OpenFlipper/common/GlobalDefines.hh>
58
59
60 class OpenFlipperJob;
61
83 class DLLEXPORT OpenFlipperThread : public QThread
84 {
85 Q_OBJECT
86
87 public:
88 OpenFlipperThread( QString _jobId );
89 ~OpenFlipperThread();
90
91 //===========================================================================
94 //===========================================================================
95 public:
96
103 void run();
104
112 virtual void cancel();
113
117 QString jobId();
118
119 public slots:
126 void slotCancel( QString _jobId);
127
128 signals:
137 void state( QString _jobId, int _state );
138
142 //===========================================================================
145 //===========================================================================
146
147 signals:
166 void function(const QString _jobId = "");
167
173 void finished( QString _jobId );
174
175
176
177 public slots:
182 void startProcessing();
183
187 private slots:
192 void slotJobFinished();
193
194 signals:
200 void startProcessingInternal();
201
202 private:
211 OpenFlipperJob* job_;
212
218 QString jobId_;
219
228 QSemaphore startup_;
229
230 };
231
232
233 // ================================================================================
234 // Job wrapper
235 // ================================================================================
236
249 class DLLEXPORT OpenFlipperJob : public QObject
250 {
251 Q_OBJECT
252
253 public:
254 OpenFlipperJob(const QString _jobId) : jobId_(_jobId) {}
255 ~OpenFlipperJob();
256
257 signals:
265 void process(const QString _jobId = "");
266
271 void finished();
272
273 public slots:
279 void startJobProcessing();
280
281 public:
283 void jobId(const QString& _jobId) { jobId_ = _jobId; }
284
286 QString jobId() const { return jobId_; }
287
288 private:
290 QString jobId_;
291 };
292
293
294
295 #endif //OPENFLIPPERTHREAD_HH
OpenFlipperJob::jobId
void jobId(const QString &_jobId)
Set job's id.
Definition: OpenFlipperThread.hh:283
OpenFlipperJob::jobId
QString jobId() const
Get job's id.
Definition: OpenFlipperThread.hh:286
GlobalDefines.hh
OpenFlipperJob
Internal Job execution object.
Definition: OpenFlipperThread.hh:249
OpenFlipperThread
Thread handling class for OpenFlipper.
Definition: OpenFlipperThread.hh:83
OpenFlipperThread::startup_
QSemaphore startup_
Semaphore to control order of thread startup calls.
Definition: OpenFlipperThread.hh:228
DLLEXPORT
#define DLLEXPORT
Definition: GlobalDefines.hh:107
OpenFlipperJob::jobId_
QString jobId_
The job's id.
Definition: OpenFlipperThread.hh:290
OpenFlipperThread::jobId_
QString jobId_
Id of the current job.
Definition: OpenFlipperThread.hh:218
OpenFlipperThread::job_
OpenFlipperJob * job_
Internal job wrapper.
Definition: OpenFlipperThread.hh:211