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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Ouput information about planned vehicle stop
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include <map>
24 #include <utils/common/SUMOTime.h>
26 
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 class OutputDevice;
32 class SUMOVehicle;
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
47 class MSStopOut {
48 public:
49 
52  static void init();
53 
54  static bool active() {
55  return myInstance != 0;
56  }
57 
58  static void cleanup();
59 
60  static MSStopOut* getInstance() {
61  return myInstance;
62  }
63 
65  MSStopOut(OutputDevice& dev);
66 
68  virtual ~MSStopOut();
69 
70  void stopStarted(const SUMOVehicle* veh, int numPersons, int numContainers, SUMOTime time);
71 
72  void loadedPersons(const SUMOVehicle* veh, int n);
73  void unloadedPersons(const SUMOVehicle* veh, int n);
74 
75  void loadedContainers(const SUMOVehicle* veh, int n);
76  void unloadedContainers(const SUMOVehicle* veh, int n);
77 
78  void stopEnded(const SUMOVehicle* veh, const SUMOVehicleParameter::Stop& stop, const std::string& laneOrEdgeID);
79 
80 
81 private:
82  struct StopInfo {
83 
84  StopInfo(int numPersons, int numContainers) :
85  initialNumPersons(numPersons),
86  loadedPersons(0),
87  unloadedPersons(0),
88  initialNumContainers(numContainers),
91  }
92 
99  };
100 
101  std::map<const SUMOVehicle*, StopInfo> myStopped;
102 
104 
106 
109 
112 
113 
114 };
long long int SUMOTime
Definition: SUMOTime.h:31
Realises dumping the complete network state.
Definition: MSStopOut.h:47
virtual ~MSStopOut()
Destructor.
Definition: MSStopOut.cpp:61
void loadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:88
static MSStopOut * getInstance()
Definition: MSStopOut.h:60
MSStopOut(const MSStopOut &)
Invalidated copy constructor.
static void init()
Static intialization.
Definition: MSStopOut.cpp:42
MSStopOut(OutputDevice &dev)
constructor.
Definition: MSStopOut.cpp:57
static bool active()
Definition: MSStopOut.h:54
std::map< const SUMOVehicle *, StopInfo > myStopped
Definition: MSStopOut.h:101
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID)
Definition: MSStopOut.cpp:98
void unloadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:83
static void cleanup()
Definition: MSStopOut.cpp:49
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
Definition: MSStopOut.cpp:65
void unloadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:93
static MSStopOut * myInstance
Definition: MSStopOut.h:105
OutputDevice & myDevice
Definition: MSStopOut.h:103
MSStopOut & operator=(const MSStopOut &)
Invalidated assignment operator.
void loadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:75
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
Representation of a vehicle.
Definition: SUMOVehicle.h:58
Definition of vehicle stop (position and duration)
StopInfo(int numPersons, int numContainers)
Definition: MSStopOut.h:84