Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

plugins.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA plugin's
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/plugins.h,v 1.4 2003/01/24 15:47:42 bj Exp $
00009 //
00011 // This program is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU General Public License as published by
00013 // the Free Software Foundation; either version 2 of the License, or
00014 // (at your option) any later version.
00015 //
00016 // This program is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU General Public License
00022 // along with this program (See the included file COPYING);
00023 // if not, write to the Free Software Foundation, Inc.,
00024 // 675 Mass Ave, Cambridge, MA 02139, USA.
00026 #ifndef YASAGUI_PLUGINS_INCLUDE
00027 #define YASAGUI_PLUGINS_INCLUDE
00028 
00029 #include <yasagui/yasagui.h>
00030 #include <qobject.h>
00031 #include <qlist.h>
00032 #include "workspace.h"
00033 
00034 
00036 // YObject::name is set to shortname too by default, but can be overidden during GetConfig
00037 class YPlugIn : public YObject
00038 {   Q_OBJECT
00039     QString                 path;                       // path to directory e.g. "/schedulers/llf"
00040     QString                 shortname;                  // e.g. EDF, "Earliest Deadline First"
00041     bool                    support_calcpreemptiontime;
00042     bool                    support_timertick;
00043     YASA_MAXCPU             maxcpu;
00044     YASA_TICK               min_timertick;
00045 public:                     YPlugIn(const YObjectArgs &args) :
00046                             YObject(args),
00047                             support_calcpreemptiontime(false),
00048                             support_timertick(false),
00049                             min_timertick((YASA_TIME)YG_MIN_TIMER_TICK)
00050                             {}
00051     virtual int             InitInstance(const QString &p, const QString &dt);
00052     virtual int             SetConfig(YInputParser &parser);
00053     virtual int             GetConfig(YOutputParser &parser);
00054     bool                    GetSupportCalcPreemptionTime() const            {   return support_calcpreemptiontime;  }
00055     bool                    GetSupportTimerTick() const                     {   return support_timertick;           }
00056     YASA_TIME               GetMinTimerTick() const                         {   return min_timertick.GetContent();  }
00057     const YASA_MAXCPU&      GetMaxCPU() const                               {   return maxcpu;                      }
00058     const QString &         GetPath() const                                 {   return path;                        }
00060     const QString &         GetShortName() const                            {   return shortname;                   }
00061     void                    SetShortName(const QString &sn)                 {   shortname=sn;                       }
00062     const QString &         GetFullName() const                             {   return GetName();                   }
00063     void                    SetFullName(const QString &fn)                  {   SetName(fn);                        }
00064 };
00065 
00067 class YSchedulerPlugIn : public YPlugIn
00068 {   YASA_SCHEDULERTYPE      type;
00069 public:                     YSchedulerPlugIn(const YObjectArgs &args) :
00070                             YPlugIn(args)
00071                             {}
00072     virtual int             SetConfig(YInputParser &parser);
00073     virtual int             GetConfig(YOutputParser &parser);
00074 };
00075 
00077 class YExecutivePlugIn : public YPlugIn
00078 {   
00079     bool                    sourcecodesupport;
00081     bool                    unlimitedcpusupport;
00083     bool                    changeablecpusupport;
00085     bool                    resumetimesupport;
00087     bool                    resourceactionsupport;
00089     bool                    emergencythreadsupport;
00091     bool                    cancelthreadsupport;
00093     bool                    schedulingtimesupport;
00095     bool                    synchronizationoffset;
00096     YString                 gcccompileroptions;
00097     YString                 idlename;
00098 public:                     YExecutivePlugIn(const YObjectArgs &args) :
00099                             YPlugIn(args),
00100                             sourcecodesupport(false),
00101                             unlimitedcpusupport(false),
00102                             changeablecpusupport(false),
00103                             resumetimesupport(false),
00104                             resourceactionsupport(false),
00105                             emergencythreadsupport(false),
00106                             cancelthreadsupport(false),
00107                             schedulingtimesupport(false),
00108                             synchronizationoffset(false),
00109                             idlename(MSGP_LF_TASK_IDLE)
00110                             {}
00111     bool                    GetUnlimitedCPUSupport() const                  {   return unlimitedcpusupport;         }
00112     bool                    GetChangeableCPUSupport() const                 {   return changeablecpusupport;        }
00113     bool                    GetSourceCodeSupport() const                    {   return sourcecodesupport;           }
00114     bool                    GetResumeTimeSupport() const                    {   return resumetimesupport;           }
00115     bool                    GetResourceActionsSupport() const               {   return resourceactionsupport;       }
00116     bool                    GetEmergencyThreadSupport() const               {   return emergencythreadsupport;      }
00117     bool                    GetCancelThreadSupport() const                  {   return cancelthreadsupport;         }
00118     bool                    GetSchedulingTimeSupport() const                {   return schedulingtimesupport;       }
00119     bool                    GetSynchronizationOffsetSupport() const         {   return synchronizationoffset;       }
00120     const YString &         GetGCCCompilerOptions() const                   {   return gcccompileroptions;          }
00121     const YString &         GetIdleName() const                             {   return idlename;                    }
00122     QStringList             GetFeatureList() const;
00123     virtual int             SetConfig(YInputParser &parser);
00124     virtual int             GetConfig(YOutputParser &parser);
00125 };
00126 
00127 
00129 class YPlugInList : public YSet
00130 {   QString                 subdirectory;               
00131     QString                 doctype;
00132 public:                     YPlugInList(const QString &name, const QString &subdir, const QString &key, const QString &dt ) :
00133                             YSet(key, 0, YObjectArgs(name) ),
00134                             subdirectory(subdir),
00135                             doctype(dt)
00136                             {}
00137     int                     InitInstance();
00140     const QString &         FindLongName(const QString &shortname)
00141     {
00142         for (unsigned int i=0; i<GetCount(); i++)
00143         {
00144             if ( ((YPlugIn*)At(i))->GetShortName()==shortname )
00145                 return ((YPlugIn*)At(i))->GetName();
00146         }
00147         return shortname;
00148     }
00149 };
00150 
00152 class YSchedulerPlugIns : public YPlugInList
00153 {
00154 public:                     YSchedulerPlugIns(const QString &subdir) :
00155                             YPlugInList(YPC_SCHEDULER, subdir, MSGP_PLUGIN_SCHEDULERS, YPC_YASA_SCHEDULER)
00156                             {
00157                             }
00158     static YSchedulerPlugIns& GetSchedulerPlugIns();
00159 protected:
00160     virtual YObject*        AllocNewItem(const YObjectArgs &args)       { return new YSchedulerPlugIn(args);    }
00161 };
00162 
00164 class YExecutivePlugIns : public YPlugInList
00165 {
00166 public:                     YExecutivePlugIns(const QString &subdir) :
00167                             YPlugInList(YPC_EXECUTIVENAME, subdir, MSGP_PLUGIN_EXECUTIVES, YPC_YASA_EXECUTIVE)
00168                             {
00169                             }
00170     static YExecutivePlugIns& GetExecutivePlugIns();
00171     const QString &         GetIdleName( const QString &executivename, const QString &idle)
00172     {
00173         for (unsigned int i=0; i<GetCount(); i++)
00174         {
00175             if (    ((YExecutivePlugIn*)At(i))->GetShortName()==executivename ||
00176                     ((YExecutivePlugIn*)At(i))->GetFullName() ==executivename   )
00177             {
00178                 return ((YExecutivePlugIn*)At(i))->GetIdleName().GetContent();
00179             }
00180         }
00181         return idle;
00182     }
00183 protected:
00184     virtual YObject*        AllocNewItem(const YObjectArgs &args)       { return new YExecutivePlugIn(args);    }
00185 };
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00206 class YPlugInManager
00207 {
00208     YSchedulerPlugIns       schedulerplugins;
00209     YExecutivePlugIns       executiveplugins;
00210 public:
00211                             YPlugInManager() :
00212                             schedulerplugins( QString(SCHEDULERS_DIR) ),
00213                             executiveplugins( QString(EXECUTIVES_DIR) )
00214                             {
00215                             }
00216     int                     InitInstance();
00217     YSchedulerPlugIns&      GetSchedulerPlugIns()                   { return schedulerplugins;  }
00218     YExecutivePlugIns&      GetExecutivePlugIns()                   { return executiveplugins;  }
00219 };
00220 
00222 #endif                                                          // ifndef YASAGUI_PLUGINS_INCLUDE

Generated on Thu Feb 13 23:43:55 2003 for Yasa by doxygen1.3-rc3