+// This thread creates a SupervisorTask event handler object
+// The thread is detached and terminates when SupervisorTask terminates
+class SupervisorTaskThread : public wxThread {
+private:
+
+public:
+ SupervisorTaskThread();
+
+ virtual wxThread::ExitCode Entry() = 0;
+
+ // called when the thread exits - whether it terminates normally or is stopped with Delete()
+ virtual void OnExit();
+};
+
+
+class ReconstructorSupervisorThread : public SupervisorTaskThread {
+private:
+public:
+};
+
+
+// Pure virtual class for BackgroundSupervisor that can communication
+// with BackgroundManager via messages
+
+class BackgroundSupervisor : public wxEvtHandler {
+private:
+ bool m_bDone;
+
+public:
+
+ enum {
+ MSG_BACKGROUND_SUPERVISOR_ADD = 7500, // sends to BackgroundManager and Document
+ MSG_BACKGROUND_SUPERVISOR_REMOVE = 7501, // sends to BackgroundManager and Document
+ MSG_BACKGROUND_SUPERVISOR_UNIT_TICK = 7502, // sends to BackgroundManager for progress bars
+ MSG_BACKGROUND_SUPERVISOR_CANCEL = 7503, // *sent* to Supervisor to cancel process
+
+ MSG_WORKER_THREAD_UNIT_TICK = 7504,
+ MSG_WORKER_THREAD_DONE = 7505,
+ MSG_WORKER_THREAD_FAIL = 7506, // sent by workers when they fail
+ };
+
+ BackgroundSupervisor()
+ : m_bDone(false), wxEvtHandler()
+ {}
+
+ virtual ~BackgroundSupervisor()
+ {}
+
+ virtual bool start() = 0;
+ virtual bool testDone() = 0;
+ virtual void OnWorkerFail(wxCommandEvent& event) = 0;
+ virtual void OnWorkerUnitTick(wxCommandEvent& event) = 0;
+ virtual void OnWorkerDone(wxCommandEvent& event) = 0;
+ virtual void OnCancel(wxCommandEvent& event) = 0;
+
+ bool isDone() const {return m_bDone;}
+ void setDone() { m_bDone = true; }
+
+ static void cancelSupervisor (BackgroundSupervisor* pSupervisor);
+};