00001 00002 // 00003 // YASA project manager 00004 // 00005 // Project: Yasa 2 00006 // Author : Jan Blumenthal 00007 // Start : 2002/02/28 00008 // $Header: /sources/yasa/yasagui/environment.h,v 1.4 2003/01/24 15:47:41 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_ENVIRONMENT_INCLUDE 00029 #define YASAGUI_ENVIRONMENT_INCLUDE 00030 00031 #include <yasagui/yasagui.h> 00032 #include <qobject.h> 00033 #include "scheduler.h" 00034 #include "actionhandler.h" 00035 #include "logfile.h" 00036 #include "sources.h" 00037 #include "results.h" 00038 00040 class YScheduler; 00041 class YExecutivePlugIn; 00042 class YOutput; 00043 00045 class YEnvironment : public YObject 00046 { Q_OBJECT 00048 YOutput *output; 00050 YSchedulerSet schedulerset; 00052 YExecutivePlugIn* executive; 00054 YEnvironmentLogFileSet logfile; 00056 YResults results; 00058 YASA_CALCPREEMPTIONTIME calcpreemptiontime; 00060 YASA_TIMERTICK support_timertick; 00062 YASA_TICK timertick; 00064 YASA_MAXCPU maxcpu; 00066 YASA_SCHEDULINGTIME schedulingtime; 00068 YASA_SYNCHRONIZATIONOFFSET 00069 synchronizationoffset; 00071 YString gcccompileroptions; 00072 YFilePath logfilepath; // YFilePath is needed to view log files !!! 00073 YString logfilename; 00074 public: YEnvironment(const YObjectArgs &i); 00075 YResults & GetResults() { return results; } 00076 YExecutivePlugIn* GetExecutive() const { return executive; } 00077 YExecutivePlugIn* SetExecutive(const QString &name); 00078 void SetExecutive(YExecutivePlugIn *e); 00079 00080 const YASA_CPU & GetMaxCPU() { return maxcpu; } 00081 YSchedulerSet& GetSchedulerSet() { return schedulerset; } 00082 virtual int SetConfig(YInputParser &parser); 00083 virtual int GetConfig(YOutputParser &parser); 00084 int InsertSchedulerProperty(QString &key); 00085 00086 const YASA_TIMERTICK & GetSupportTimerTick() const { return support_timertick; } 00087 const YASA_CALCPREEMPTIONTIME & 00088 GetCalcPreemptionTime() const { return calcpreemptiontime; } 00089 const YASA_TICK & GetTimerTick() const { return timertick; } 00090 const YASA_SCHEDULINGTIME & 00091 GetSchedulingTime() const { return schedulingtime; } 00092 void SetSchedulingTime(const YASA_TIME &t) 00093 { schedulingtime=t; } 00094 const YASA_SYNCHRONIZATIONOFFSET & 00095 GetSynchronizationOffset() const{ return synchronizationoffset; } 00096 void SetSynchronizationOffset(const YASA_TIME &t) 00097 { synchronizationoffset=t; } 00098 YProject* GetProject() const { if ( GetSet() && GetSet()->GetParent() ) 00099 return ((YProject*) GetSet()->GetParent()); 00100 return 0; } 00101 const YString & GetGCCCompilerOptions() const { return gcccompileroptions; } 00102 void SetGCCCompilerOptions(const QString &s) 00103 { gcccompileroptions=s; } 00104 QString GetEnvironmentDirectory(bool abspath=false) const; 00105 YEnvironmentLogFileSet& GetEnvironmentLogFileSet() { return logfile; } 00106 const QString & GetLogFileName() const { return logfilename.GetContent(); } 00107 YFilePath & GetLogFilePath() { CorrectLogfilePath(); 00108 return logfilepath; } 00109 int ExecuteEnvironment(); 00110 void CleanupEnvironment(QString absexecutivedir=QString::null); 00111 void CorrectLogfilePath(); 00113 int EvaluateLogFile() { CorrectLogfilePath(); 00114 return logfile.ParseLogFile( logfilepath.GetAbsPath() ); } 00116 void CleanupLogFile() { logfile.CleanupLogFile(); } 00117 signals: 00119 void EnvironmentExecuted(); 00120 void EnvironmentCleanedUp(); 00121 }; 00122 00123 00124 00126 class YEnvironmentSet : public YSet 00127 { 00128 public: YEnvironmentSet(); 00129 protected: 00130 virtual YObject* AllocNewItem(const YObjectArgs &args) { return new YEnvironment(args); } 00131 virtual YActions* GetItemActions() const 00132 { return YActionHandler::GetActions(YActionHandler::ENVIRONMENT_ACTIONS); } 00133 }; 00134 00135 00136 00138 #endif // ifndef YASAGUI_ENVIRONMENT_INCLUDE