00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __RT_LRTVIS__
00019 #define __RT_LRTVIS__
00020
00021 #include "robwxfe.h"
00022 #include "robmanage.h"
00023 #include "robbase.h"
00024 #include "robwxstruct.h"
00025
00026 #include <rtsystem.h>
00027 #include <rtstreams.h>
00028
00029 using namespace lrt;
00030
00031 class wxEvent;
00032 class wxStopWatch;
00033
00034 namespace rt {
00035
00036
00037
00038
00039 bool HaveVisFrame();
00040
00041
00042
00043 void PostAndWait(wxEvent& evt, int maxWait = 1000);
00044
00045 enum {
00046 WaitInfinite = -1
00047 };
00048
00049
00050 class VisPlugin;
00051 class VisSupervisor;
00052 class VisTourDisplayer;
00053 class VisDebugSupervisor;
00054
00055
00056 class VisPlugin : public FrontendPlugin
00057 {
00058 public:
00059 virtual FpInterpretePos getInterpretePos();
00060 virtual String getName();
00061 virtual String getHelpText();
00062 virtual bool interpreteParams(const Array<String>& params, Array<bool>& used);
00063 virtual void fillOptions(SimOptions& options);
00064 VisPlugin(Frontend* parent);
00065 ~VisPlugin();
00066 private:
00067 };
00068
00069 class VisSupervisor : public SimSupervisor
00070 {
00071 public:
00072 VisSupervisor(VisDebugSupervisor* debugger = 0);
00073 ~VisSupervisor();
00074 virtual unsigned long getStepCycles();
00075 virtual void initSim(Simulation* const sim);
00076 virtual GameState exec(Simulation* const curSim);
00077 virtual void exitSim(Simulation* const curSim, const GameState& simResult);
00078 void updateTour(const Array<TourResult>& tourStatus);
00079
00080 private:
00081 friend class VisTourDisplayer;
00082
00083 void processGuiRequests(Simulation* sim);
00084
00085 Vector<TourResult> tourStatus;
00086 TourInitInfo initInfo;
00087 int curSimNum;
00088
00089 wxStopWatch* watch;
00090
00091 VisDebugSupervisor* debugger;
00092 };
00093
00094 class VisTourDisplayer : public TourDisplayer {
00095
00096 public:
00097 VisTourDisplayer(VisSupervisor* super);
00098
00099 virtual TourStatusType update(const Array<TourResult>& status);
00100 virtual void init(const TourInitInfo& info) { super->initInfo = info; super->curSimNum = 0; }
00101 virtual void exit(TourStatusType exitType, const Array<TourResult>& result) {}
00102 private:
00103 VisSupervisor* super;
00104 };
00105
00106
00107 class VisDebugSupervisor : public SimSupervisor, public BotErrorHandler
00108 {
00109 public:
00110 VisDebugSupervisor(Frontend* parent);
00111 ~VisDebugSupervisor();
00112 virtual unsigned long getStepCycles();
00113 virtual void initSim(Simulation* const sim);
00114 virtual GameState exec(Simulation* const curSim);
00115 virtual void exitSim(Simulation* const curSim, const GameState& simResult);
00116 virtual void handleBotError(const Bot* affectedBot, ExecReturnType type);
00117
00118 private:
00119 void processGuiRequests(Simulation* sim);
00120 friend class VisSupervisor;
00121
00122 Map<int, DebugInfo> debugInfo;
00123 int nextDebugID;
00124 WxFrontend* parent;
00125 };
00126
00127 }
00128
00129 #endif
00130