00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef TARGET_H
00025 #define TARGET_H
00026
00027 #include <QObject>
00028 #include <valarray>
00029 #include "../compiler/compiler.h"
00030
00031 namespace Aseba
00032 {
00035
00036 struct TargetDescription;
00037
00039 class Target: public QObject
00040 {
00041 Q_OBJECT
00042
00043 public:
00045 enum ExecutionMode
00046 {
00048 EXECUTION_STOP,
00050 EXECUTION_RUN,
00052 EXECUTION_STEP_BY_STEP,
00054 EXECUTION_UNKNOWN,
00055 };
00056
00057 signals:
00059 void nodeConnected(unsigned node);
00061 void nodeDisconnected(unsigned node);
00063 void networkDisconnected();
00064
00066 void userEvent(unsigned id, const VariablesDataVector &data);
00068 void userEventsDropped(unsigned amount);
00069
00071 void arrayAccessOutOfBounds(unsigned node, unsigned line, unsigned size, unsigned index);
00073 void divisionByZero(unsigned node, unsigned line);
00075 void eventExecutionKilled(unsigned node, unsigned line);
00077 void nodeSpecificError(unsigned node, unsigned line, const QString& message);
00078
00080 void executionPosChanged(unsigned node, unsigned line);
00082 void executionModeChanged(unsigned node, Target::ExecutionMode mode);
00084 void variablesMemoryEstimatedDirty(unsigned node);
00085
00087 void variablesMemoryChanged(unsigned node, unsigned start, const VariablesDataVector &variables);
00088
00090 void breakpointSetResult(unsigned node, unsigned line, bool success);
00091
00092 public:
00094 virtual ~Target() { }
00095
00096
00098
00099
00100 public:
00102 virtual QString getLanguage() const = 0;
00103
00105 const QString getName(unsigned node) const;
00106
00108 virtual const TargetDescription * const getDescription(unsigned node) const = 0;
00109
00111 virtual void uploadBytecode(unsigned node, const BytecodeVector &bytecode) = 0;
00112
00114 virtual void writeBytecode(unsigned node) = 0;
00115
00117 virtual void reboot(unsigned node) = 0;
00118
00120 virtual void sendEvent(unsigned id, const VariablesDataVector &data) = 0;
00121
00122
00123
00125 virtual void setVariables(unsigned node, unsigned start, const VariablesDataVector &data) = 0;
00126
00128 virtual void getVariables(unsigned node, unsigned start, unsigned length) = 0;
00129
00130
00131
00133 virtual void reset(unsigned node) = 0;
00134
00136 virtual void run(unsigned node) = 0;
00137
00139 virtual void pause(unsigned node) = 0;
00140
00142 virtual void next(unsigned node) = 0;
00143
00145 virtual void stop(unsigned node) = 0;
00146
00147
00148
00150 virtual void setBreakpoint(unsigned node, unsigned line) = 0;
00151
00153 virtual void clearBreakpoint(unsigned node, unsigned line) = 0;
00154
00156 virtual void clearBreakpoints(unsigned node) = 0;
00157 };
00158
00160 };
00161
00162 #endif