Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

robmanage.h

Go to the documentation of this file.
00001 /*
00002  * robmanage.h
00003  * 
00004  * Copyright (c) 2000-2004 by Florian Fischer (florianfischer@gmx.de)
00005  * and Martin Trautmann (martintrautmann@gmx.de) 
00006  * 
00007  * This file may be distributed and/or modified under the terms of the 
00008  * GNU General Public License version 2 as published by the Free Software 
00009  * Foundation. 
00010  * 
00011  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013  * 
00014  */
00015 
00020 #ifndef __RT_MANAGE__
00021 #define __RT_MANAGE__
00022 
00023 #include <rtcollect.h>
00024 #include <rtstring.h>
00025 
00026 //using namespace lrt;
00027 
00028 #include "robbase.h"
00029 #include "robglob.h"
00030 
00031 namespace rt {
00032 
00036 class TourInitInfo {
00037 public:
00038         TourInitInfo() : numParticipants(0), numSimulations(0) {}
00039         TourInitInfo(int numParticipants, int numSimulations);
00040         int numParticipants;
00041         int numSimulations;
00042 };
00043 
00046 class TourResult {
00047 public:
00048         static int compareByPoints(const TourResult& t1, const TourResult& t2);
00050         TourResult();
00052         TourResult(const lrt::StringMap<Program::HeaderField>& headers, const lrt::String& fileName);
00053         ~TourResult() {}
00054         lrt::StringMap<Program::HeaderField> headers; 
00055         lrt::String fileName; 
00056         int wins, looses, ties;
00057         int rank;
00058         float points;
00059 };
00060 
00061 enum TourStatusType {
00062         tourAbort = -1,
00063         tourComplete = 0,
00064         tourContinue = tourComplete
00065 };
00066 
00068 class TourDisplayer {
00069 
00070 public:
00071         virtual void init(const TourInitInfo& info) = 0;
00072         virtual TourStatusType update(const lrt::Array<TourResult>& status) = 0;
00073         virtual void exit(TourStatusType exitType, const lrt::Array<TourResult>& result) = 0;
00074 
00075         virtual ~TourDisplayer() {}
00076 protected:
00077         TourDisplayer() {}
00078 };
00079 
00083 class SimOptions {
00084 public:
00085         int numRepeats;
00086         lrt::Vector<lrt::String> files;
00087         lrt::Vector<SimSupervisor*> supervisors; // these are the output supervisors created by rt, 
00088         // the StdVictorySupervisor must be created by the Manager
00089         lrt::Vector<ExecSupervisor*> execSupervisors; 
00090         lrt::Vector<TourDisplayer*> tourDisps; // displays results
00091         const ErrorHandler* errHandler;
00092         Globals glob;
00093 
00094         SimOptions(const ErrorHandler* frontend);
00095         ~SimOptions();
00096 
00097 };
00098 
00100 
00101 class SimManager {
00102 
00103 public:
00105         virtual void setup(SimOptions* const options);
00106         virtual void run() = 0;
00108         virtual ~SimManager();
00109 
00110 protected:
00111         SimOptions* options;
00112         Simulation* curSim;
00113         lrt::Vector<SimSupervisor*> managerSupervisors;
00114         lrt::Vector<Program*> programs;
00115         lrt::Vector<TourResult> results;
00118         virtual void createSupervisors();
00120         void createPrograms();
00122         TourStatusType doStdSim(const lrt::Array<int>& programNums);
00124         TourStatusType doAllStdSims(const lrt::Array<int>& programNums);
00125 
00126         virtual TourInitInfo getTourInitInfo() = 0;
00127 
00128         SimManager();
00129 };
00130 
00132 
00133 class ChartsManager : public SimManager{
00134 
00135 public:
00136         ChartsManager(bool playAll);
00137         virtual ~ChartsManager();
00138 
00139         virtual void run();
00140 
00141 protected:
00142         virtual TourInitInfo getTourInitInfo();
00143         bool playAll;
00144 };
00145 
00146 
00148 class AllInOneManager : public SimManager{
00149 
00150 public:
00151         AllInOneManager();
00152         virtual ~AllInOneManager();
00153 
00154         virtual void run();
00155 
00156 protected:
00157         virtual TourInitInfo getTourInitInfo();
00158 };
00159 
00160 
00161 
00162 } // namespace
00163 
00164 #endif
00165 

This is the RoboTour API documentation version 0.1 • Copyright (C) by Florian Fischer