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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Ouput information about planned vehicle stop
16 /****************************************************************************/
17 #ifndef MSStopOut_h
18 #define MSStopOut_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <map>
27 #include <utils/common/SUMOTime.h>
28 #include <microsim/MSVehicle.h>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class OutputDevice;
35 class SUMOVehicle;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
50 class MSStopOut {
51 public:
52 
55  static void init();
56 
57  static bool active() {
58  return myInstance != 0;
59  }
60 
61  static void cleanup();
62 
63  static MSStopOut* getInstance() {
64  return myInstance;
65  }
66 
68  MSStopOut(OutputDevice& dev);
69 
71  virtual ~MSStopOut();
72 
73  void stopStarted(const SUMOVehicle* veh, int numPersons, int numContainers, SUMOTime time);
74 
75  void loadedPersons(const SUMOVehicle* veh, int n);
76  void unloadedPersons(const SUMOVehicle* veh, int n);
77 
78  void loadedContainers(const SUMOVehicle* veh, int n);
79  void unloadedContainers(const SUMOVehicle* veh, int n);
80 
81  void stopEnded(const SUMOVehicle* veh, const SUMOVehicleParameter::Stop& stop, const std::string& laneOrEdgeID);
82 
83 
84 private:
85  struct StopInfo {
86 
87  StopInfo(SUMOTime t, int numPersons, int numContainers) :
88  started(t),
89  initialNumPersons(numPersons),
90  loadedPersons(0),
91  unloadedPersons(0),
92  initialNumContainers(numContainers),
93  loadedContainers(0),
94  unloadedContainers(0) {
95  }
96 
97  // @note: need default constructor or std::map doesn't work
99  started(-1),
101  loadedPersons(0),
102  unloadedPersons(0),
104  loadedContainers(0),
105  unloadedContainers(0) {
106  }
107 
115  };
116 
117  typedef std::map<const SUMOVehicle*, StopInfo> Stopped;
118  Stopped myStopped;
119 
121 
123 
125  MSStopOut(const MSStopOut&);
126 
128  MSStopOut& operator=(const MSStopOut&);
129 
130 
131 };
132 
133 
134 #endif
135 
136 /****************************************************************************/
137 
static bool active()
Definition: MSStopOut.h:57
long long int SUMOTime
Definition: SUMOTime.h:36
static void init()
Static intialization.
Definition: MSStopOut.cpp:41
Stopped myStopped
Definition: MSStopOut.h:118
void loadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:89
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID)
Definition: MSStopOut.cpp:99
void unloadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:84
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
Definition: MSStopOut.cpp:64
Representation of a vehicle.
Definition: SUMOVehicle.h:60
static void cleanup()
Definition: MSStopOut.cpp:48
MSStopOut & operator=(const MSStopOut &)
Invalidated assignment operator.
static MSStopOut * myInstance
Definition: MSStopOut.h:122
void unloadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:94
virtual ~MSStopOut()
Destructor.
Definition: MSStopOut.cpp:60
Definition of vehicle stop (position and duration)
OutputDevice & myDevice
Definition: MSStopOut.h:120
static MSStopOut * getInstance()
Definition: MSStopOut.h:63
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
std::map< const SUMOVehicle *, StopInfo > Stopped
Definition: MSStopOut.h:117
void loadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:76
Realises dumping the complete network state.
Definition: MSStopOut.h:50
StopInfo(SUMOTime t, int numPersons, int numContainers)
Definition: MSStopOut.h:87
MSStopOut(OutputDevice &dev)
constructor.
Definition: MSStopOut.cpp:56