SUMO - Simulation of Urban MObility
MSStopOut.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // Ouput information about planned vehicle stop
18 /****************************************************************************/
19 #ifndef MSStopOut_h
20 #define MSStopOut_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <map>
33 #include <utils/common/SUMOTime.h>
34 #include <microsim/MSVehicle.h>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class OutputDevice;
41 class SUMOVehicle;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
56 class MSStopOut {
57 public:
58 
61  static void init();
62 
63  static bool active() {
64  return myInstance != 0;
65  }
66 
67  static MSStopOut* getInstance() {
68  return myInstance;
69  }
70 
72  MSStopOut(OutputDevice& dev);
73 
75  virtual ~MSStopOut();
76 
77  void stopStarted(const SUMOVehicle* veh, int numPersons, int numContainers);
78 
79  void loadedPersons(const SUMOVehicle* veh, int n);
80  void unloadedPersons(const SUMOVehicle* veh, int n);
81 
82  void loadedContainers(const SUMOVehicle* veh, int n);
83  void unloadedContainers(const SUMOVehicle* veh, int n);
84 
85  void stopEnded(const SUMOVehicle* veh, const MSVehicle::Stop& stop);
86 
87 
88 private:
89  struct StopInfo {
90 
91  StopInfo(SUMOTime t, int numPersons, int numContainers) :
92  started(t),
93  initialNumPersons(numPersons),
94  loadedPersons(0),
95  unloadedPersons(0),
96  initialNumContainers(numContainers),
97  loadedContainers(0),
98  unloadedContainers(0) {
99  }
100 
101  // @note: need default constructor or std::map doesn't work
103  started(-1),
105  loadedPersons(0),
106  unloadedPersons(0),
108  loadedContainers(0),
109  unloadedContainers(0) {
110  }
111 
119  };
120 
121  typedef std::map<const SUMOVehicle*, StopInfo> Stopped;
122  Stopped myStopped;
123 
125 
127 
129  MSStopOut(const MSStopOut&);
130 
132  MSStopOut& operator=(const MSStopOut&);
133 
134 
135 };
136 
137 
138 #endif
139 
140 /****************************************************************************/
141 
static bool active()
Definition: MSStopOut.h:63
static void init()
Static intialization.
Definition: MSStopOut.cpp:45
Stopped myStopped
Definition: MSStopOut.h:122
void loadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:83
void unloadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:78
Representation of a vehicle.
Definition: SUMOVehicle.h:66
MSStopOut & operator=(const MSStopOut &)
Invalidated assignment operator.
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers)
Definition: MSStopOut.cpp:63
static MSStopOut * myInstance
Definition: MSStopOut.h:126
void stopEnded(const SUMOVehicle *veh, const MSVehicle::Stop &stop)
Definition: MSStopOut.cpp:93
void unloadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:88
virtual ~MSStopOut()
Destructor.
Definition: MSStopOut.cpp:59
OutputDevice & myDevice
Definition: MSStopOut.h:124
static MSStopOut * getInstance()
Definition: MSStopOut.h:67
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
long long int SUMOTime
Definition: TraCIDefs.h:51
std::map< const SUMOVehicle *, StopInfo > Stopped
Definition: MSStopOut.h:121
void loadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:73
Realises dumping the complete network state.
Definition: MSStopOut.h:56
StopInfo(SUMOTime t, int numPersons, int numContainers)
Definition: MSStopOut.h:91
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:901
MSStopOut(OutputDevice &dev)
constructor.
Definition: MSStopOut.cpp:55