OpenASIP 2.2
Loading...
Searching...
No Matches
SimulatorEvent.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file SimulatorEvent.hh
26 *
27 * Declaration of SimulatorEvent class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_SIMULATOR_EVENT_HH
34#define TTA_SIMULATOR_EVENT_HH
35
36#include <string>
37#include <wx/wx.h>
38
39/**
40 * A custom wxEvent class for passing simulator events to Proxim windows.
41 */
42class SimulatorEvent : public wxEvent {
43public:
44 SimulatorEvent(WXTYPE eventType, std::string data = "");
45 virtual ~SimulatorEvent();
46 virtual wxEvent* Clone(void) const { return new SimulatorEvent(*this); }
47 std::string data() const;
48
49
50 // Simulator event type IDs:
51 // -------------------------
52 /// Command received from the GUI.
53 static const wxEventType EVT_SIMULATOR_COMMAND;
54 /// Command execution completed.
55 static const wxEventType EVT_SIMULATOR_COMMAND_DONE;
56 /// Simulator thread terminated.
57 static const wxEventType EVT_SIMULATOR_TERMINATED;
58
59 /// Textual output event from simulator interpreter.
60 static const wxEventType EVT_SIMULATOR_OUTPUT;
61 /// Simulator error event.
62 static const wxEventType EVT_SIMULATOR_ERROR;
63 /// Runtime error event.
64 static const wxEventType EVT_SIMULATOR_RUNTIME_ERROR;
65 /// Runtime warning event.
66 static const wxEventType EVT_SIMULATOR_RUNTIME_WARNING;
67
68 /// Simulation started.
69 static const wxEventType EVT_SIMULATOR_START;
70 /// Simulation stopped.
71 static const wxEventType EVT_SIMULATOR_STOP;
72 /// Simulation ran/resumed.
73 static const wxEventType EVT_SIMULATOR_RUN;
74
75
76 /// Machine loading started.
77 static const wxEventType EVT_SIMULATOR_LOADING_MACHINE;
78 /// Machine loaded event.
79 static const wxEventType EVT_SIMULATOR_MACHINE_LOADED;
80 /// Program loading started.
81 static const wxEventType EVT_SIMULATOR_LOADING_PROGRAM;
82 /// Program loaded event.
83 static const wxEventType EVT_SIMULATOR_PROGRAM_LOADED;
84 /// Sent before program,machine or memory model is destroyed.
85 static const wxEventType EVT_SIMULATOR_RESET;
86 // -------------------------
87
88private:
89 std::string data_;
90};
91
92
93// Macro for setting up event handler for simulation thread termination.
94#define EVT_SIMULATOR_TERMINATED(id, fn) \
95 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_TERMINATED, id, -1, \
96 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
97 (wxObject*)NULL ),
98
99// Macro for setting up event handler for simulation start.
100#define EVT_SIMULATOR_START(id, fn) \
101 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_START, id, -1, \
102 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
103 (wxObject*)NULL ),
104
105// Macro for setting up event handler simulation stop.
106#define EVT_SIMULATOR_STOP(id, fn) \
107 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_STOP, id, -1, \
108 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
109 (wxObject*)NULL ),
110
111// Macro for setting up event handler for textual output from the
112// simulator interpreter.
113#define EVT_SIMULATOR_OUTPUT(id, fn) \
114 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_OUTPUT, id, -1, \
115 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
116 (wxObject*)NULL ),
117
118// Macro for setting up event handler for executed command event
119// from the simulator interpreter.
120#define EVT_SIMULATOR_COMMAND(id, fn) \
121 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_COMMAND, id, -1, \
122 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
123 (wxObject*)NULL ),
124
125// Macro for setting up event handler for completed command execution event
126// from the simulator interpreter.
127#define EVT_SIMULATOR_COMMAND_DONE(id, fn) \
128 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_COMMAND_DONE, \
129 id, -1, \
130 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
131 (wxObject*)NULL ),
132
133// Macro for setting up event handler for simulator error event.
134#define EVT_SIMULATOR_ERROR(id, fn) \
135 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_ERROR, id, -1, \
136 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
137 (wxObject*)NULL ),
138
139#define EVT_SIMULATOR_MACHINE_LOADED(id, fn) \
140 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_MACHINE_LOADED, \
141 id, -1, \
142 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
143 (wxObject*)NULL ),
144
145#define EVT_SIMULATOR_LOADING_PROGRAM(id, fn) \
146 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_LOADING_PROGRAM, \
147 id, -1, \
148 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
149 (wxObject*)NULL ),
150
151#define EVT_SIMULATOR_PROGRAM_LOADED(id, fn) \
152 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_PROGRAM_LOADED, \
153 id, -1, \
154 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
155 (wxObject*)NULL ),
156
157#define EVT_SIMULATOR_LOADING_MACHINE(id, fn) \
158 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_LOADING_MACHINE, \
159 id, -1, \
160 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
161 (wxObject*)NULL ),
162
163#define EVT_SIMULATOR_MACHINE_LOADED(id, fn) \
164 DECLARE_EVENT_TABLE_ENTRY(SimulatorEvent::EVT_SIMULATOR_MACHINE_LOADED, \
165 id, -1, \
166 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
167 (wxObject*)NULL ),
168
169#define EVT_SIMULATOR_RUNTIME_ERROR(id, fn) \
170 DECLARE_EVENT_TABLE_ENTRY(\
171 SimulatorEvent::EVT_SIMULATOR_RUNTIME_ERROR, \
172 id, -1, \
173 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
174 (wxObject*)NULL ),
175
176#define EVT_SIMULATOR_RUNTIME_WARNING(id, fn) \
177 DECLARE_EVENT_TABLE_ENTRY(\
178 SimulatorEvent::EVT_SIMULATOR_RUNTIME_WARNING, \
179 id, -1, \
180 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
181 (wxObject*)NULL ),
182
183#define EVT_SIMULATOR_RUN(id, fn) \
184 DECLARE_EVENT_TABLE_ENTRY(\
185 SimulatorEvent::EVT_SIMULATOR_RUN, \
186 id, -1, \
187 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
188 (wxObject*)NULL ),
189
190#define EVT_SIMULATOR_RESET(id, fn) \
191 DECLARE_EVENT_TABLE_ENTRY(\
192 SimulatorEvent::EVT_SIMULATOR_RESET, \
193 id, -1, \
194 (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
195 (wxObject*)NULL ),
196
197#endif
static const wxEventType EVT_SIMULATOR_START
Simulation started.
static const wxEventType EVT_SIMULATOR_RESET
Sent before program,machine or memory model is destroyed.
static const wxEventType EVT_SIMULATOR_RUNTIME_WARNING
Runtime warning event.
static const wxEventType EVT_SIMULATOR_ERROR
Simulator error event.
static const wxEventType EVT_SIMULATOR_RUNTIME_ERROR
Runtime error event.
static const wxEventType EVT_SIMULATOR_TERMINATED
Simulator thread terminated.
static const wxEventType EVT_SIMULATOR_MACHINE_LOADED
Machine loaded event.
virtual ~SimulatorEvent()
static const wxEventType EVT_SIMULATOR_RUN
Simulation ran/resumed.
static const wxEventType EVT_SIMULATOR_PROGRAM_LOADED
Program loaded event.
static const wxEventType EVT_SIMULATOR_LOADING_MACHINE
Machine loading started.
std::string data_
static const wxEventType EVT_SIMULATOR_COMMAND_DONE
Command execution completed.
virtual wxEvent * Clone(void) const
static const wxEventType EVT_SIMULATOR_COMMAND
Command received from the GUI.
std::string data() const
static const wxEventType EVT_SIMULATOR_OUTPUT
Textual output event from simulator interpreter.
static const wxEventType EVT_SIMULATOR_LOADING_PROGRAM
Program loading started.
static const wxEventType EVT_SIMULATOR_STOP
Simulation stopped.