00001 /*************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) * 00003 *************************************************************************** 00004 * Projekt : Zeus Base Library 00005 * Module : QTMainThread 00006 * Package : System 00007 * Author : Benjamin Hadorn 00008 * Datum : $Date: 24.02.11 16:56 $ 00009 * Ablage : $File$ 00010 * System : Cell Computing Model 00011 *************************************************************************** 00012 * Licence: * 00013 * This library is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU Lesser General Public License as * 00015 * published by the Free Software Foundation; either version * 00016 * 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00026 ***************************************************************************/ 00027 00028 /*************************************************************************** 00029 Changes : 00030 $Log: /Development_F/StuderWIN/dev/CNCControl/SiemensNCUDriver/SiemensNCUDriver/zeusbase/System/Platforms/QTMainThread.h $ 00031 ** 00032 ** 1 24.02.11 16:56 Bha 00033 ** 00034 ** 1 23.02.11 7:34 Bha 00035 ***************************************************************************/ 00036 //--------------------------------------------------------------------------- 00037 00038 #ifndef QTMainThreadH 00039 #define QTMainThreadH 00040 00041 #include <zeusbase/System/AbstractMainThread.h> 00042 #include <zeusbase/System/Platforms/QTMainThreadMessageQueue.h> 00043 00044 USING_NAMESPACE_Zeus 00045 00046 #define QTMainThread TQTMainThread::getInstance() 00047 00048 /****************************************************************************/ 00051 /****************************************************************************/ 00052 class TQTMainThread : public QObject, public TAbstractMainThread 00053 { 00054 Q_OBJECT 00055 00056 public: 00057 /*************************************************************************/ 00060 /*************************************************************************/ 00061 inline static TQTMainThread& getInstance() 00062 { 00063 return m_Instance; 00064 } 00065 00066 /*************************************************************************/ 00070 /*************************************************************************/ 00071 inline void setMaxProcessingCount(Int iValue) 00072 { 00073 m_iMaxProcessingCount = iValue; 00074 } 00075 00076 virtual void registerThread(TThreadManager& rManager, bool bUseInternalDispatcher); 00077 virtual void unregisterThread(TThreadManager& rManager); 00078 00079 public slots: 00080 void onItemPosted(); 00081 00082 protected: 00083 TQTMainThread(); 00084 00085 /*************************************************************************/ 00088 /*************************************************************************/ 00089 inline virtual ~TQTMainThread() 00090 {} 00091 00092 private: 00093 static TQTMainThread m_Instance; 00095 Int m_iMaxProcessingCount; 00096 }; 00097 00098 //This line must be included inside a cpp module 00099 //TQTMainThread TQTMainThread::m_Instance; 00100 00101 00102 #endif