Update copyright date; remove old CVS keyword
[ctsim.git] / src / threadraster.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          threadraster.h
5 **   Purpose:       Header file for threaded rasterizations
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  February 2001
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2009 Kevin Rosenberg
11 **
12 **  This program is free software; you can redistribute it and/or modify
13 **  it under the terms of the GNU General Public License (version 2) as
14 **  published by the Free Software Foundation.
15 **
16 **  This program is distributed in the hope that it will be useful,
17 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 **  GNU General Public License for more details.
20 **
21 **  You should have received a copy of the GNU General Public License
22 **  along with this program; if not, write to the Free Software
23 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 ******************************************************************************/
25
26 #ifndef _THREADRASTER_H
27 #define _THREADRASTER_H
28
29 #ifdef HAVE_WXTHREADS
30
31 #include <vector>
32 #include <wx/thread.h>
33 #include <wx/progdlg.h>
34 #include "timer.h"
35 #include "backgroundsupr.h"
36
37
38 class Reconstructor;
39 class ImageFile;
40 class PhantomFileDocument;
41 class RasterizerWorker;
42 class ImageFileView;
43
44 class RasterizerSupervisorThread : public SupervisorThread {
45 private:
46   PhantomFileView* m_pPhantomView;
47   const int m_iNX;
48   const int m_iNY;
49   const int m_iNSample;
50   const double m_dViewRatio;
51   const wxString m_strLabel;
52
53 public:
54   RasterizerSupervisorThread(PhantomFileView* pProjView, int iNX, int iNY, int iNSample, double dViewRatio, wxChar const* strLabel);
55
56   virtual wxThread::ExitCode Entry();
57   virtual void OnExit();
58 };
59
60
61
62 class RasterizerSupervisor : public BackgroundSupervisor {
63 private:
64
65   PhantomFileView* m_pPhantomView;
66   std::vector<ImageFile*> m_vecpChildImageFiles;
67   PhantomFileDocument* m_pPhantomDoc;
68
69   const int m_iNX;
70   const int m_iNY;
71   const int m_iNSample;
72   const double m_dViewRatio;
73   const wxString m_strLabel;
74
75
76 public:
77    RasterizerSupervisor (SupervisorThread* pThread, PhantomFileView* pProjView, int iNX, int iNY,
78    int iNSample, double dViewRatio, wxChar const* pszLabel);
79
80    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
81
82    virtual ~RasterizerSupervisor ();
83
84   void onDone();
85
86   ImageFile* getImageFile();
87
88 };
89
90
91
92
93 class RasterizerWorker : public BackgroundWorkerThread {
94 private:
95   PhantomFileView* m_pPhantomView;
96   ImageFile* m_pImageFile;
97   int m_iNX;
98   int m_iNY;
99   int m_iNSample;
100   double m_dViewRatio;
101
102
103 public:
104   RasterizerWorker (RasterizerSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews)
105     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
106   {}
107
108   void SetParameters (PhantomFileView* pPhantomFile, ImageFile* pImageFile, int iNX, int iY,
109    int iNSample, double dViewRatio);
110
111   virtual wxThread::ExitCode Entry();      // thread execution starts here
112
113   virtual void OnExit();
114 };
115
116 #endif // HAVE_WXTHREADS
117 #endif // _THREADRASTER_H_
118