00001 00002 // 00003 // YASA project, scheduler support 00004 // 00005 // Project: Yasa 2 00006 // Author : Jan Blumenthal 00007 // Start : 2002/02/28 00008 // $Header: /sources/yasa/yasagui/scheduler.h,v 1.4 2003/01/24 15:47:42 bj Exp $ 00009 // 00011 // 00012 // This program is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU General Public License as published by 00014 // the Free Software Foundation; either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU General Public License 00023 // along with this program (See the included file COPYING); 00024 // if not, write to the Free Software Foundation, Inc., 00025 // 675 Mass Ave, Cambridge, MA 02139, USA. 00026 // 00028 #ifndef YASAGUI_SCHEDULER_INCLUDE 00029 #define YASAGUI_SCHEDULER_INCLUDE 00030 00031 00033 #include <yasagui/yasagui.h> 00034 #include <qobject.h> 00035 #include "list.h" 00036 #include "actionhandler.h" 00037 00038 00040 class YSchedulerPlugIn; 00041 class YProject; 00042 class YEnvironment; 00043 00047 class YScheduler : public YObject 00048 { Q_OBJECT 00049 YSchedulerPlugIn *scheduler; 00050 YASA_CALCPREEMPTIONTIME calcpreemptiontime; 00051 YASA_TIMERTICK support_timertick; 00052 YASA_TICK timertick; 00053 public: YScheduler(const YObjectArgs &args); 00054 virtual int SetConfig(YInputParser &parser); 00055 virtual int GetConfig(YOutputParser &parser); 00056 const YASA_TIMERTICK & GetSupportTimerTick() const { return support_timertick; } 00057 const YASA_CALCPREEMPTIONTIME& 00058 GetCalcPreemptionTime() const { return calcpreemptiontime; } 00061 bool GetSupportCalcPreemptionTime() const{ return ! calcpreemptiontime.AreChildsDisabled(); } 00062 void SetCalcPreemptionTime(bool b) { calcpreemptiontime=b; } 00063 void DeriveCalcPreemptionTime() { calcpreemptiontime.Invalid(); } 00064 const YASA_TICK& GetTimerTick() const { return timertick; } 00065 void SetTimerTick(YASA_TIME t) { timertick=t; } 00066 void DeriveTimerTick() { timertick.Invalid(); } 00067 YSchedulerPlugIn* GetScheduler() const { return scheduler; } 00068 void SetScheduler(YSchedulerPlugIn *); 00069 YSchedulerPlugIn* SetScheduler(const QString &); 00070 YEnvironment* GetEnvironment() const; 00071 }; 00072 00073 00075 class YSchedulerSet : public YSet 00076 { Q_OBJECT 00077 public: YSchedulerSet(); 00078 int EnsureItemCount(unsigned int i); 00079 int InitInstance(); 00080 protected: 00081 virtual YObject* AllocNewItem(const YObjectArgs &args) { return new YScheduler(args); } 00082 virtual YActions* GetItemActions() const 00083 { return YActionHandler::GetActions(YActionHandler::SCHEDULER_ACTIONS); } 00084 public slots: 00085 void MaxCPUChanged(); 00086 }; 00087 00088 00090 #endif // ifndef YASAGUI_SCHEDULER_INCLUDE