Eclipse 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-2019 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 /****************************************************************************/
14 // Ouput information about planned vehicle stop
15 /****************************************************************************/
16 #ifndef MSStopOut_h
17 #define MSStopOut_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <map>
26 #include <utils/common/SUMOTime.h>
27 #include <microsim/MSVehicle.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class OutputDevice;
34 class SUMOVehicle;
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
49 class MSStopOut {
50 public:
51 
54  static void init();
55 
56  static bool active() {
57  return myInstance != 0;
58  }
59 
60  static void cleanup();
61 
62  static MSStopOut* getInstance() {
63  return myInstance;
64  }
65 
67  MSStopOut(OutputDevice& dev);
68 
70  virtual ~MSStopOut();
71 
72  void stopStarted(const SUMOVehicle* veh, int numPersons, int numContainers, SUMOTime time);
73 
74  void loadedPersons(const SUMOVehicle* veh, int n);
75  void unloadedPersons(const SUMOVehicle* veh, int n);
76 
77  void loadedContainers(const SUMOVehicle* veh, int n);
78  void unloadedContainers(const SUMOVehicle* veh, int n);
79 
80  void stopEnded(const SUMOVehicle* veh, const SUMOVehicleParameter::Stop& stop, const std::string& laneOrEdgeID);
81 
82 
83 private:
84  struct StopInfo {
85 
86  StopInfo(SUMOTime t, int numPersons, int numContainers) :
87  started(t),
88  initialNumPersons(numPersons),
89  loadedPersons(0),
90  unloadedPersons(0),
91  initialNumContainers(numContainers),
94  }
95 
96  // @note: need default constructor or std::map doesn't work
98  started(-1),
100  loadedPersons(0),
101  unloadedPersons(0),
103  loadedContainers(0),
104  unloadedContainers(0) {
105  }
106 
114  };
115 
116  typedef std::map<const SUMOVehicle*, StopInfo> Stopped;
118 
120 
122 
124  MSStopOut(const MSStopOut&);
125 
127  MSStopOut& operator=(const MSStopOut&);
128 
129 
130 };
131 
132 
133 #endif
134 
135 /****************************************************************************/
136 
MSStopOut::unloadedContainers
void unloadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:93
MSStopOut::MSStopOut
MSStopOut(OutputDevice &dev)
constructor.
Definition: MSStopOut.cpp:55
SUMOTime.h
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSStopOut::getInstance
static MSStopOut * getInstance()
Definition: MSStopOut.h:62
MSStopOut::StopInfo::unloadedPersons
int unloadedPersons
Definition: MSStopOut.h:110
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MSStopOut::loadedPersons
void loadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:75
MSStopOut::loadedContainers
void loadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:88
MSStopOut
Realises dumping the complete network state.
Definition: MSStopOut.h:49
MSVehicle.h
MSStopOut::init
static void init()
Static intialization.
Definition: MSStopOut.cpp:40
MSStopOut::operator=
MSStopOut & operator=(const MSStopOut &)
Invalidated assignment operator.
MSStopOut::StopInfo::unloadedContainers
int unloadedContainers
Definition: MSStopOut.h:113
MSStopOut::cleanup
static void cleanup()
Definition: MSStopOut.cpp:47
MSStopOut::myDevice
OutputDevice & myDevice
Definition: MSStopOut.h:119
MSStopOut::active
static bool active()
Definition: MSStopOut.h:56
MSStopOut::Stopped
std::map< const SUMOVehicle *, StopInfo > Stopped
Definition: MSStopOut.h:116
MSStopOut::StopInfo::loadedContainers
int loadedContainers
Definition: MSStopOut.h:112
MSStopOut::StopInfo::started
SUMOTime started
Definition: MSStopOut.h:107
MSStopOut::~MSStopOut
virtual ~MSStopOut()
Destructor.
Definition: MSStopOut.cpp:59
MSStopOut::myStopped
Stopped myStopped
Definition: MSStopOut.h:117
MSStopOut::StopInfo::StopInfo
StopInfo(SUMOTime t, int numPersons, int numContainers)
Definition: MSStopOut.h:86
MSStopOut::myInstance
static MSStopOut * myInstance
Definition: MSStopOut.h:121
MSStopOut::StopInfo::initialNumContainers
int initialNumContainers
Definition: MSStopOut.h:111
MSStopOut::unloadedPersons
void unloadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:83
MSStopOut::stopStarted
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
Definition: MSStopOut.cpp:63
config.h
MSStopOut::StopInfo::initialNumPersons
int initialNumPersons
Definition: MSStopOut.h:108
MSStopOut::stopEnded
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID)
Definition: MSStopOut.cpp:98
MSStopOut::StopInfo::loadedPersons
int loadedPersons
Definition: MSStopOut.h:109
MSStopOut::StopInfo::StopInfo
StopInfo()
Definition: MSStopOut.h:97
MSStopOut::StopInfo
Definition: MSStopOut.h:84
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:572