00001 /* #start# *********************************************************** 00002 00003 Scheduling Simulator 00004 Lehrstuhl f"ur Effiziente Algorithmen 00005 Technische Universit"at M"unchen 00006 00007 File : $Id: SSchedAlgorithm.h,v 1.6 2003/03/13 19:23:44 taeubig Exp $ 00008 00009 Purpose : the base class for all scheduling algorithms. implements 00010 the part of the interface which is visible to the task 00011 system. 00012 00013 RCS-Log: 00014 $Log: SSchedAlgorithm.h,v $ 00015 Revision 1.6 2003/03/13 19:23:44 taeubig 00016 prob.dists in new dir, other changes, removed log messages 00017 00018 Revision 1.5 2003/01/08 18:57:11 meierb 00019 added randomized release times 00020 00021 Revision 1.1.1.1 2002/12/02 22:26:19 meierb 00022 my_schedule 00023 00024 Revision 1.3 2002/11/13 18:18:29 taeubig 00025 Workarounds for using LEDA 4.4 and also the former releases 00026 00027 Revision 1.2 2002/11/10 13:32:52 taeubig 00028 namespace and header include changes 00029 00030 Revision 1.1 2002/08/29 12:59:58 taeubig 00031 Added the sources 00032 00033 Revision 1.22 2001/07/16 12:44:29 taeubig 00034 Added getNameFromClass() 00035 00036 Revision 1.21 2001/05/16 13:19:38 taeubig 00037 QT headers are included last because of "slots" conflict 00038 00039 Revision 1.20 2000/08/22 01:06:44 taeubig 00040 Added self description level 00041 00042 Revision 1.19 2000/07/05 21:51:47 mayerh 00043 added method getLeaBibEntry and made some changes 00044 00045 Revision 1.18 2000/06/14 18:58:37 taeubig 00046 Added support for algorithm runtime comments 00047 00048 Revision 1.17 2000/05/24 12:21:12 taeubig 00049 New compiler (gcc-2.95) and new Qt (2.1) 00050 Replaced "list" by "leda_list" etc. 00051 00052 Revision 1.16 2000/04/19 20:00:02 mayerh 00053 deleted _matching attribute and corresponding functions 00054 00055 Revision 1.15 2000/04/12 20:44:31 mayerh 00056 added attribute _matching to indicate whether a certain algorithm fits the requirements of a given problem 00057 00058 Revision 1.14 2000/04/05 21:04:02 mayerh 00059 declared getName() and getClassification() as virtual (required by some compiler-versions) 00060 00061 Revision 1.13 2000/03/28 13:03:05 hall 00062 updated Interface of SClassif and SSchedAlg. 00063 00064 Revision 1.12 2000/01/12 11:31:34 zoidl 00065 added javadoc comments and cosmetic changes in getDescription 00066 00067 Revision 1.11 2000/01/10 02:21:45 taeubig 00068 Declared clone() 00069 00070 Revision 1.10 1999/12/21 15:35:38 zoidl 00071 changed getDescription(), now returning string instead string& 00072 00073 Revision 1.9 1999/12/21 09:02:32 zoidl 00074 added getDescription() (info about problem, complexity, ... ) 00075 00076 Revision 1.8 1999/08/05 08:47:46 schickin 00077 purpose of important classes noted in the header-files 00078 00079 Revision 1.7 1999/04/27 13:38:42 schickin 00080 well folks, that's the first demo version that really runs 8-) 00081 00082 Revision 1.6 1999/02/10 15:05:39 schickin 00083 model-directory can be compiled now 00084 00085 Revision 1.5 1999/02/10 10:50:35 schickin 00086 main loop for simulation added 00087 00088 Revision 1.4 1999/02/09 17:17:15 schickin 00089 design changes: event system refined (+ interface of SSchedAlgorithm) 00090 00091 Revision 1.3 1999/01/29 10:03:27 schickin 00092 Project-Headers added. 00093 00094 00095 * #end# ************************************************************* */ 00096 00097 #ifndef SSCHEDALGORITHM_H 00098 #define SSCHEDALGORITHM_H 00099 00100 // system header files 00101 #include <LEDA/list.h> 00102 00103 #ifndef leda_list_item 00104 #define leda_list_item list_item 00105 #endif 00106 00107 // project header files 00108 #include "../general/SEvent.h" 00109 #include "../general/SObservable.h" 00110 #include "../model/STaskSystem.h" 00111 #include "../model/STSysSchedEvent.h" 00112 #include "SClassification.h" 00113 #include "SLeaBibEntry.h" 00114 00115 class STaskSystem; 00116 00117 class SAlgEvent: public SEvent { 00118 public: 00119 SAlgEvent(short int level) { _level = level; } 00120 00121 virtual Type getType() const 00122 { return ALGEVENT; }; 00123 short int getLevel() const 00124 { return _level; } 00125 00126 private: 00127 short int _level; 00128 00129 }; 00130 00134 class SSchedAlgorithm: public SObservable { 00135 00136 public: 00137 virtual ~SSchedAlgorithm() {}; 00140 virtual void startup() {}; 00141 00153 virtual double innerLoop(const leda_list<STSysSchedEvent>& rEvents) =0; 00154 00161 virtual bool isFinished() const; 00162 00168 virtual const leda_string &getName() const = 0; 00169 static const leda_string &getNameFromClass(); 00170 00177 virtual const SClassification &getClassification() const = 0; 00178 00184 virtual SLeaBibEntry &getLeaBibEntry() const = 0; 00185 00192 virtual const leda_string getDescription() const = 0; 00193 00198 STaskSystem& getTaskSystem() 00199 { return *_pTaskSys; }; 00200 00205 const STaskSystem& getTaskSystem() const 00206 { return *_pTaskSys; }; 00207 00213 virtual void setTaskSystem(STaskSystem& rTS) 00214 { _pTaskSys = &rTS; }; 00215 00220 //virtual SSchedAlgorithm* clone() 00221 // { assert(false); }; 00222 00223 virtual leda_string getCurrentActionDescription(const int level) const 00224 { return actionDescription[level]; }; 00225 00226 protected: 00227 virtual void setCurrentActionDescription(const int level, 00228 leda_string descr); 00229 00230 private: 00232 STaskSystem * _pTaskSys; 00233 leda_string actionDescription[3]; 00234 }; 00235 00236 #endif //SSCHEDALGORITHM_H 00237 00238