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.dlr.de/
12 // Copyright (C) 2001-2016 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 GUIEvent;
50 class OutputDevice;
51 
52 
53 // ===========================================================================
54 // class definition
55 // ===========================================================================
64 public:
68 
70  virtual ~GUIRunThread();
71 
73  virtual bool init(GUINet* net, SUMOTime start, SUMOTime end);
74 
76  virtual FXint run();
77 
80  void resume();
81 
84  void singleStep();
85 
87  virtual void begin();
88 
90  void stop();
91 
93  bool simulationAvailable() const;
94 
95  virtual bool simulationIsStartable() const;
96  virtual bool simulationIsStopable() const;
97  virtual bool simulationIsStepable() const;
98 
100  virtual void deleteSim();
101 
103  GUINet& getNet() const;
104 
106  void prepareDestruction();
107 
109  void retrieveMessage(const MsgHandler::MsgType type, const std::string& msg);
110 
112  return mySimEndTime;
113  }
114 
115  std::vector<SUMOTime>& getBreakpoints() {
116  return myBreakpoints;
117  }
118 
119  FXMutex& getBreakpointLock() {
120  return myBreakpointLock;
121  }
122 
123 protected:
124  void makeStep();
125 
126 protected:
129 
132 
134  bool myHalting;
135 
138  bool myQuit;
139 
144 
145  bool myOk;
146 
148  bool mySingle;
149 
153 
155 
157 
159 
161 
163  std::vector<SUMOTime> myBreakpoints;
164 
167 
168 };
169 
170 
171 #endif
172 
173 /****************************************************************************/
174 
GUIRunThread(FXApp *app, MFXInterThreadEventClient *mw, FXRealSpinDial &simDelay, MFXEventQue< GUIEvent *> &eq, FXEX::FXThreadEvent &ev)
constructor
long long int SUMOTime
Definition: SUMOTime.h:43
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
GUINet & getNet() const
virtual bool simulationIsStopable() const
virtual bool simulationIsStepable() const
std::vector< SUMOTime > & getBreakpoints()
Definition: GUIRunThread.h:115
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:134
std::vector< SUMOTime > myBreakpoints
List of breakpoints.
Definition: GUIRunThread.h:163
MFXMutex mySimulationLock
Definition: GUIRunThread.h:160
virtual ~GUIRunThread()
destructor
SUMOTime mySimEndTime
Definition: GUIRunThread.h:131
virtual bool simulationIsStartable() const
bool simulationAvailable() const
bool mySimulationInProgress
Definition: GUIRunThread.h:143
OutputDevice * myWarningRetriever
Definition: GUIRunThread.h:152
GUINet * myNet
the loaded simulation network
Definition: GUIRunThread.h:128
FXMutex & getBreakpointLock()
Definition: GUIRunThread.h:119
OutputDevice * myMessageRetriever
Definition: GUIRunThread.h:152
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations Needed to be deleted from the handler later on...
Definition: GUIRunThread.h:152
void prepareDestruction()
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:89
MFXEventQue< GUIEvent * > & myEventQue
Definition: GUIRunThread.h:156
FXMutex myBreakpointLock
Lock for modifying the list of breakpoints.
Definition: GUIRunThread.h:166
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
virtual void begin()
FXEX::FXThreadEvent & myEventThrow
Definition: GUIRunThread.h:158
SUMOTime mySimStartTime
the times the simulation starts and ends with
Definition: GUIRunThread.h:131
Spinner control.
SUMOTime getSimEndTime() const
Definition: GUIRunThread.h:111
FXRealSpinDial & mySimDelay
Definition: GUIRunThread.h:154