SUMO - Simulation of Urban MObility
GUIRunThread.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // The thread that runs the simulation
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GUIRunThread_h
23 #define GUIRunThread_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <iostream>
37 #include <fx.h>
42 #include <utils/common/SUMOTime.h>
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class GUINet;
49 class OutputDevice;
50 
51 
52 // ===========================================================================
53 // class definition
54 // ===========================================================================
63 public:
66  FXRealSpinDial& simDelay, MFXEventQue& eq, FXEX::FXThreadEvent& ev);
67 
69  virtual ~GUIRunThread();
70 
72  virtual bool init(GUINet* net, SUMOTime start, SUMOTime end);
73 
75  virtual FXint run();
76 
79  void resume();
80 
83  void singleStep();
84 
86  virtual void begin();
87 
89  void stop();
90 
92  bool simulationAvailable() const;
93 
94  virtual bool simulationIsStartable() const;
95  virtual bool simulationIsStopable() const;
96  virtual bool simulationIsStepable() const;
97 
99  virtual void deleteSim();
100 
102  GUINet& getNet() const;
103 
105  void prepareDestruction();
106 
108  void retrieveMessage(const MsgHandler::MsgType type, const std::string& msg);
109 
111  return mySimEndTime;
112  }
113 
114  std::vector<SUMOTime>& getBreakpoints() {
115  return myBreakpoints;
116  }
117 
119  return myBreakpointLock;
120  }
121 
122 protected:
123  void makeStep();
124 
125 protected:
128 
131 
133  bool myHalting;
134 
137  bool myQuit;
138 
143 
144  bool myOk;
145 
147  bool mySingle;
148 
152 
154 
156 
158 
160 
162  std::vector<SUMOTime> myBreakpoints;
163 
166 
167 };
168 
169 
170 #endif
171 
172 /****************************************************************************/
173 
MFXMutex & getBreakpointLock()
Definition: GUIRunThread.h:118
virtual bool simulationIsStepable() const
virtual FXint run()
starts the execution
virtual void deleteSim()
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
virtual bool simulationIsStartable() const
std::vector< SUMOTime > & getBreakpoints()
Definition: GUIRunThread.h:114
void retrieveMessage(const MsgHandler::MsgType type, const std::string &msg)
Retrieves messages from the loading module.
bool myHalting
information whether the simulation is halting (is not being executed)
Definition: GUIRunThread.h:133
std::vector< SUMOTime > myBreakpoints
List of breakpoints.
Definition: GUIRunThread.h:162
MFXMutex mySimulationLock
Definition: GUIRunThread.h:159
virtual ~GUIRunThread()
destructor
SUMOTime mySimEndTime
Definition: GUIRunThread.h:130
bool mySimulationInProgress
Definition: GUIRunThread.h:142
virtual bool simulationIsStopable() const
GUIRunThread(FXApp *app, MFXInterThreadEventClient *mw, FXRealSpinDial &simDelay, MFXEventQue &eq, FXEX::FXThreadEvent &ev)
constructor
OutputDevice * myWarningRetriever
Definition: GUIRunThread.h:151
GUINet * myNet
the loaded simulation network
Definition: GUIRunThread.h:127
GUINet & getNet() const
MFXMutex myBreakpointLock
Lock for modifying the list of breakpoints.
Definition: GUIRunThread.h:165
OutputDevice * myMessageRetriever
Definition: GUIRunThread.h:151
MFXEventQue & myEventQue
Definition: GUIRunThread.h:155
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations Needed to be deleted from the handler later on...
Definition: GUIRunThread.h:151
void prepareDestruction()
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:90
SUMOTime getSimEndTime() const
Definition: GUIRunThread.h:110
bool simulationAvailable() const
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
virtual void begin()
FXEX::FXThreadEvent & myEventThrow
Definition: GUIRunThread.h:157
SUMOTime mySimStartTime
the times the simulation starts and ends with
Definition: GUIRunThread.h:130
Spinner control.
FXRealSpinDial & mySimDelay
Definition: GUIRunThread.h:153