00001 /* AbiSource Program Utilities 00002 * Copyright (C) 2001 Dom Lachowicz <dominicl@seas.upenn.edu> 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00017 * 02111-1307, USA. 00018 */ 00019 00020 #ifndef UT_WORKER_H 00021 #define UT_WORKER_H 00022 00023 /* pre-emptive dismissal; ut_types.h is needed by just about everything, 00024 * so even if it's commented out in-file that's still a lot of work for 00025 * the preprocessor to do... 00026 */ 00027 #ifndef UT_TYPES_H 00028 #include "ut_types.h" 00029 #endif 00030 00031 class UT_Worker; 00032 00033 class GR_Graphics; 00034 00035 typedef void (*UT_WorkerCallback)(UT_Worker* pWorker); 00036 00042 class ABI_EXPORT UT_WorkerFactory 00043 { 00044 public: 00045 typedef enum { NONE = 0x00, 00046 IDLE = 0x01, 00047 TIMER = 0x02 } ConstructMode; 00048 00049 //CAN_USE_THREAD = 0x04 00050 00051 static UT_Worker * static_constructor ( UT_WorkerCallback cb, void * data, 00052 int wantMode, 00053 UT_WorkerFactory::ConstructMode & outMode ); 00054 00055 private: 00056 UT_WorkerFactory (); 00057 ~UT_WorkerFactory (); 00058 }; 00059 00064 class ABI_EXPORT UT_Worker 00065 { 00066 00067 public: 00068 virtual ~UT_Worker (); 00069 00070 virtual void stop(void) = 0; 00071 virtual void start(void) = 0; 00072 00073 virtual void fire(void); 00074 00075 UT_WorkerCallback getCallback() const; 00076 void* getInstanceData() const; 00077 00078 protected: 00079 00080 UT_Worker (); 00081 UT_Worker (UT_WorkerCallback cb, void * data); 00082 00083 void _setCallback(UT_WorkerCallback cb); 00084 void _setInstanceData(void * data); 00085 00086 private: 00087 UT_Worker (UT_Worker &); // no impl 00088 00089 void * m_pInstanceData; 00090 UT_WorkerCallback m_pCallback; 00091 00092 }; 00093 00094 #endif /* UT_WORKER_H */
1.7.1