X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fthreadrecon.h;h=0daa6219587c2571de2cd729d15b134ff4d732c1;hb=b0df0a0f3008d0fee67f388cfa1c37af6383b38f;hp=0cb8c9a3c584c7070f82d64d84d84049912d71db;hpb=e081109a4a541c8780aaa253b874acada5957200;p=ctsim.git diff --git a/src/threadrecon.h b/src/threadrecon.h index 0cb8c9a..0daa621 100644 --- a/src/threadrecon.h +++ b/src/threadrecon.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: threadrecon.h,v 1.2 2001/02/22 15:00:20 kevin Exp $ +** $Id: threadrecon.h,v 1.5 2001/02/23 03:28:26 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -33,11 +33,31 @@ #include #include "timer.h" +// This thread creates a BackgroundTask event handler object +// The thread is detached and terminates when BackgroundTask terminates +class BackgroundTaskThread : public wxThread { +private: + +public: + BackgroundTaskThread(); + + virtual wxThread::ExitCode Entry(); + + // called when the thread exits - whether it terminates normally or is stopped with Delete() + virtual void OnExit(); +}; + + +// Pure virtual class for BackgroundTasks that can communication +// with BackgroundManager class BackgroundTask : public wxEvtHandler { +private: + bool m_bDone; + public: BackgroundTask() - : wxEvtHandler() + : m_bDone(false), wxEvtHandler() {} virtual ~BackgroundTask() @@ -45,6 +65,10 @@ public: virtual void cancel() = 0; virtual bool start() = 0; + virtual bool testDone() = 0; + + bool isDone() const {return m_bDone;} + void setDone() { m_bDone = true; } }; class Reconstructor; @@ -53,11 +77,11 @@ class ProjectionFileDocument; class ReconstructionThread; class ProjectionFileView; + class ThreadedReconstructor : public BackgroundTask { private: DECLARE_DYNAMIC_CLASS(ThreadedReconstructor) - std::vector m_vecpReconstructor; std::vector m_vecpChildImageFile; std::vector m_vecpThread; ProjectionFileView* m_pProjView; @@ -71,12 +95,11 @@ private: volatile int m_iRunning; volatile unsigned int m_iViewsDone; volatile unsigned int m_iTotalViews; - wxCriticalSection m_criticalSection; + //wxCriticalSection m_criticalSection; wxString m_strLabel; Timer* m_pTimer; bool m_bCancelled; bool m_bCancelling; - bool m_bDone; public: ThreadedReconstructor (ProjectionFileView* pProjView, @@ -91,15 +114,15 @@ public: ~ThreadedReconstructor (); void OnThreadEvent (wxCommandEvent& event); - bool testDone(); void cancel(); void onDone(); bool start(); bool fail() const {return m_bFail;} - bool getDone() const {return m_bDone;} + bool testDone(); + void cleanUp(); - ImageFile* getImageFile() const; + ImageFile* getImageFile(); DECLARE_EVENT_TABLE() }; @@ -115,15 +138,19 @@ private: int m_iThread; public: - ReconstructionThread (ThreadedReconstructor* pSupervisor, Reconstructor* pReconstructor, - int iThread, int iStartView, int iNumViews); + ReconstructionThread (ThreadedReconstructor* pSupervisor, + ProjectionFileView* pProjFile, ImageFile* pImageFile, + int iThread, int iStartView, int iNumViews, + const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, + int iZeropad, const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam, + const char* pszBackprojectName); virtual wxThread::ExitCode Entry(); // thread execution starts here - // called when the thread exits - whether it terminates normally or is - // stopped with Delete() (but not when it is Kill()ed!) - virtual void OnExit(); + // called when the thread exits - whether it terminates normally or is stopped with Delete() + virtual void OnExit(); }; #endif + \ No newline at end of file