//------------------------------------------------------------------------ // // VisDataRender.h // // The CVisDataRender wraps around a thread that will load data and // render it. Some type of Data Loader (CVisDataLoader) is passed in. // It is called to load the data into the passed buffers. Once that has // completed, the Render method on the passed Vis is called to render. // // By using this, instead of, say, WM_TIMER, you can get pretty good // performance. The next improvement will be to double-thread it. By // allowing the Data Loader to take any amount of time to load the data, // it can effectly kill the perfomance. By adding a Data load thread, // in addition to a render thread, complete control of how often the // Render gets called can be done. // // // ------------------------------------------------------------------- // * COPYRIGHT 2001, Greg Ratajik and Ratajik Software * // * All rights Reserved * // ------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // More information about this program can be found at: // http://www.ratajik.com/VisInterface // C H A N G E L O G // ===================================================================== // Change ID Date Programmer Description // ============ ========= =========== ================================ // 02-05-01 Ratajik Initial Development //------------------------------------------------------------------------ #pragma once #include "VisInterface.h" #include "VisDataLoader.h" #include UINT WorkerThread(LPVOID lpParam); // The thread that actually renders. //------------------------------------------------------------------------ // // Class: CVisRender // // Description: This little class just starts up and maintaines the worker // thread. // // Methods // of // Interest: CVisDataRender () // - Only ctor // // StartRendering() // - Start the thread, if it isn't started already. // // StopRendering() // - Stop the thread, if it is running (via a sem). This // call will not return until the thread has actually // stopped. // // C H A N G E L O G // =================================================================== // Change ID Date Programmer Description // ============ ========= =========== ================================ // 02-21-01 Ratajik Initial Development //_________________________________________________________________________ class CVisDataRender { public: friend UINT WorkerThread(LPVOID); CVisDataRender(CWnd *pParentWnd, CVisInterface *pInterface, CVisDataLoader *pLoader); bool StartRendering( void ); bool StopRendering ( void ); protected: private: CWinThread *m_pThread; // The Created Thread CWnd *m_pParentWnd; // Our Parent Wnd (not used) CVisInterface *m_pInterface; // The Vis to use (must already be selected()) CVisDataLoader *m_pLoader; // The Data loader to use CSemaphore m_semStop; // The control Semaphore CSingleLock m_SingleLock; // Locker for the Sem. };